Skip to content

implement associated type synonyms

When I try to compile:

class Foo a where
    type Bar a :: *
    aBar :: Bar a

I get this "type error":

Test.hs:1:0:
    Type synonym `Bar' should have 1 argument, but has been given 1
    When checking the class method: aBar :: Bar a
    In the class declaration for `Foo'

I've tracked it down to this case in typecheck/TcMType.lhs:

check_tau_type rank ubx_tup ty@(TyConApp tc tys)
  | isSynTyCon tc	

which calls tcView, which in turn calls tcExpandTyCon_maybe, which doesn't handle open type synonyms. (And so Nothing is returned down the line, and you get this nasty error.)

It should be pretty easy to fix if you actually have a clue what you are doing ;-). So, please fix it. Then I can get back to trying to reimplement the MTL with ATs ;-).

Trac metadata
Trac field Value
Version 6.5
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown
Architecture Unknown
Edited by Samuel Bronson
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information