Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,844
    • Issues 4,844
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 453
    • Merge requests 453
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #14715

Closed
Open
Created Jan 24, 2018 by Ryan Scott@RyanGlScottMaintainer

GHC 8.4.1-alpha regression with PartialTypeSignatures

This bug prevents lol-apps' tests and benchmarks from building with GHC 8.4.1-alpha2. This is as much as I'm able to minimize the issue:

{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -Wno-partial-type-signatures #-}
module Bug (bench_mulPublic) where

data Cyc r
data CT zp r'q
class Reduce a b
type family LiftOf b

bench_mulPublic :: forall z zp zq . (z ~ LiftOf zq, _) => Cyc zp -> Cyc z -> IO (zp,zq)
bench_mulPublic pt sk = do
  ct :: CT zp (Cyc zq) <- encrypt sk pt
  undefined ct

encrypt :: forall z zp zq. Reduce z zq => Cyc z -> Cyc zp -> IO (CT zp (Cyc zq))
encrypt = undefined

On GHC 8.2.2, this compiles without issue. But on GHC 8.4.1-alpha2, this errors with:

$ /opt/ghc/8.4.1/bin/ghc Bug.hs
[1 of 1] Compiling Bug              ( Bug.hs, Bug.o )

Bug.hs:15:1: error:
    • Could not deduce (Reduce fsk0 zq)
      from the context: (z ~ LiftOf zq, Reduce fsk zq)
        bound by the inferred type for ‘bench_mulPublic’:
                   forall z zp zq fsk.
                   (z ~ LiftOf zq, Reduce fsk zq) =>
                   Cyc zp -> Cyc z -> IO (zp, zq)
        at Bug.hs:(15,1)-(17,14)
      The type variable ‘fsk0’ is ambiguous
    • In the ambiguity check for the inferred type for ‘bench_mulPublic’
      To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
      When checking the inferred type
        bench_mulPublic :: forall z zp zq fsk.
                           (z ~ LiftOf zq, Reduce fsk zq) =>
                           Cyc zp -> Cyc z -> IO (zp, zq)
   |
15 | bench_mulPublic pt sk = do
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^...
Trac metadata
Trac field Value
Version 8.4.1-alpha1
Type Bug
TypeOfFailure OtherFailure
Priority highest
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking