Den 2017-12-02 kl. 21:56, skrev Joachim Breitner:
With a wee bit of higher-order matching, one might make `u` and `v`
functions and instead write:
foo (\ x -> fmap (u x) (v x)) = bar u v
In that case I'd expect `u` and `v` to be synthesized rather than
literally matched. For instance, `foo
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>
(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 <glasgow-haskell-users
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
2012-08-26 08:03, Manuel M T Chakravarty skrev:
Emil Axelsson e...@chalmers.se:
2012-08-24 11:08, Simon Marlow skrev:
On 24/08/2012 07:39, Emil Axelsson wrote:
Hi!
Are there any dangers in comparing two StableNames of different type?
stEq :: StableName a - StableName b - Bool
stEq a b
Hi!
Are there any dangers in comparing two StableNames of different type?
stEq :: StableName a - StableName b - Bool
stEq a b = a == (unsafeCoerce b)
I could guard the coercion by first comparing the type representations,
but that would give me a `Typeable` constraint that would spread
2012-08-24 11:08, Simon Marlow skrev:
On 24/08/2012 07:39, Emil Axelsson wrote:
Hi!
Are there any dangers in comparing two StableNames of different type?
stEq :: StableName a - StableName b - Bool
stEq a b = a == (unsafeCoerce b)
I could guard the coercion by first comparing the type
2012-08-24 11:18, Emil Axelsson skrev:
2012-08-24 11:08, Simon Marlow skrev:
On 24/08/2012 07:39, Emil Axelsson wrote:
Hi!
Are there any dangers in comparing two StableNames of different type?
stEq :: StableName a - StableName b - Bool
stEq a b = a == (unsafeCoerce b)
I could guard
Hello!
I attach a program which I suspect demonstrates a bug in GHC. The
important lines are:
showType :: forall a . Expr a - String
showType (Lit _) = show (typeOf (undefined :: a))
test1 = showType (mk :: Expr BOOL) -- Prints Bool (wrong?)
test2 = showType (Lit mk :: Expr BOOL)