There are a number of things one might expect RebindableSyntax to support, but it doesn't. Another examples is that `[1..2]' uses `GHC.Enum.enumFromTo' instead of the `enumFromTo' in scope.

My guess is that RebindableSyntax isn't on the priority list.

- Adam



On Sun, Feb 7, 2016 at 8:08 PM, Chris Smith <cdsmith@gmail.com> wrote:
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

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe