Re: Pattern synonyms and GADTs in GHC 8.0.1

2016-05-26 Thread Emil Axelsson
Aha, that's because `:t` operates on expressions, and when a pattern synonym is used as an expression the required and provided contexts are merged into one. Makes sense. / Emil Den 2016-05-26 kl. 20:59, skrev Emil Axelsson: However, it seems that `:t` gives the wrong type: *Main> :t AddP

Re: Pattern synonyms and GADTs in GHC 8.0.1

2016-05-26 Thread Emil Axelsson
Num a, Eq a) => Exp a -> Exp a -> Exp a Then it's fine Simon | -Original Message- | From: Glasgow-haskell-users [mailto:glasgow-haskell-users- | boun...@haskell.org] On Behalf Of Emil Axelsson | Sent: 26 May 2016 16:27 | To: glasgow-haskell-users | Subject: Pattern s

RE: Pattern synonyms and GADTs in GHC 8.0.1

2016-05-26 Thread Simon Peyton Jones
gow-haskell-users [mailto:glasgow-haskell-users- | boun...@haskell.org] On Behalf Of Emil Axelsson | Sent: 26 May 2016 16:27 | To: glasgow-haskell-users | Subject: Pattern synonyms and GADTs in GHC 8.0.1 | | I have a problem where a pattern synonym doesn't provide the expected | type r

Pattern synonyms and GADTs in GHC 8.0.1

2016-05-26 Thread Emil Axelsson
I have a problem where a pattern synonym doesn't provide the expected type refinement in GHC 8.0.1. {-# LANGUAGE GADTs #-} {-# LANGUAGE PatternSynonyms #-} data Exp a where Num :: (Eq a, Num a) => a -> Exp a Add :: (Eq a, Num a) => Exp a -> Exp a -> Exp a pattern NumP a = Num a pat