Malcolm Wallace malcolm.wallace at me.com writes:
data Bar f a = Foo f = Bar {bar :: f a}
The class context on the data constructor buys you nothing extra in terms of
expressivity in the language.
All it does is force you to repeat the context on every function that uses
the
On Thu, Jun 9, 2011 at 09:46, DavidA polyom...@f2s.com wrote:
I think that's exactly what the original poster is complaining about. As a
real-
life example, consider
data Graph a = Ord a = G [a] [[a]]
My intention is that whenever I have a Graph a, I want to be able to use the
Ord
...@gmx.de
To: haskell-cafe@haskell.org
Cc: Guy guytsalmave...@yahoo.com
Sent: Thursday, 9 June 2011, 2:06
Subject: Re: [Haskell-cafe] Type Constraints on Data Constructors
Hello,
you might be thinking of this type?
{-# LANGUAGE Rank2Types #-}
class Foo f where
foo :: a - f a
data Baz
Correction: I meant
data Baz f a = Baz (Foo f = f a)
(Dropped the 'forall', which would make the inner 'f' have nothing to do with
the type parameter 'f' of 'Baz')
On 2011-June-09 Thursday 01:07:13 Daniel Schüssler wrote:
Hello,
you might be thinking of this type?
{-# LANGUAGE
-
From: Daniel Schüssler dan...@gmx.de
To: haskell-cafe@haskell.org
Cc: Guy guytsalmave...@yahoo.com
Sent: Thursday, 9 June 2011, 2:06
Subject: Re: [Haskell-cafe] Type Constraints on Data Constructors
Hello,
you might be thinking of this type?
{-# LANGUAGE Rank2Types #-}
class
Malcolm Wallace malcolm.wallace at me.com writes:
The class context on the data constructor buys you nothing extra in terms of
expressivity in the language.
All it does is force you to repeat the context on every function that uses the
datatype. For this reason, the
language committee has
{- continuing discussion from beginners@ -}
I have code such as
class Foo f where
foo :: a - f a
data Bar f a = Foo f = Bar {bar :: f a}
instance Foo (Bar f) where
foo a = Bar $ foo a
GHC insists that I put Foo f = on the instance declaration, even though the
constructor for Bar
data Bar f a = Foo f = Bar {bar :: f a}
The class context on the data constructor buys you nothing extra in terms of
expressivity in the language. All it does is force you to repeat the context
on every function that uses the datatype. For this reason, the language
committee has decided
On Wed, Jun 8, 2011 at 3:15 PM, Malcolm Wallace malcolm.wall...@me.com wrote:
data Bar f a = Foo f = Bar {bar :: f a}
The class context on the data constructor buys you nothing extra in terms of
expressivity in the language. All it does is force you to repeat the context
on every function
Hello,
you might be thinking of this type?
{-# LANGUAGE Rank2Types #-}
class Foo f where
foo :: a - f a
data Baz f a = Baz (forall f. Foo f = f a)
instance Foo (Baz f) where
foo a = Baz (foo a)
Maybe the difference between Bar and Baz ist best explained by writing it with
an
10 matches
Mail list logo