
7 Feb
2016
7 Feb
'16
2:08 p.m.
In a custom prelude, I have written the following definitions: data Truth = True | False ifThenElse :: Truth -> a -> a -> a ifThenElse True x _ = x ifThenElse False _ x = x (==) :: a -> a -> Truth (==) = ... I'm replacing Bool with my own Truth type. Clients will be built with RebindableSyntax, so that they will use these definitions for desugaring. However, if I write this: f :: Text -> Text f "r" = "rrr" f other = other I get a build error indicating that GHC expected the (==) operator to return a value of type Bool, rather than Truth. Shouldn't pattern matching desugar to use overloaded ifThenElse in these situations? Or is it expected that use of GHC.Types.Bool is hard-coded even with RebindableSyntax enabled? Thanks, Chris