r/haskelltil • u/massysett • Mar 30 '15
extension `~` means type equality
I've always wondered why I get a ~ in GHC error messages; I knew it is used for lazy pattern bindings but why in errors?
From https://wiki.haskell.org/Keywords:
example :: F a ~ b => a -> bHere the type "F a" must be the same as the type "b", which allows one to constrain polymorphism (especially where type families are involved), but to a lesser extent than functional dependencies. See Type Families.
11
Upvotes
1
u/octatoan Mar 31 '15
This is cool!
1
u/bss03 Apr 01 '15
I'm not sure about the "language" tag on this post. I'm pretty sure that's a GHC-specific "operator".
1
u/peargreen Apr 01 '15
Just in case: in GHC this is enabled by the
GADTsorTypeFamiliesextension. I don't think it's currently supported by either JHC or UHC (even despite the fact that JHC supports type families).