[Haskell-cafe] Context for type parameters of type constructors
Henning Thielemann
iakd0 at clusterf.urz.uni-halle.de
Tue Mar 30 14:32:20 EST 2004
On Tue, 30 Mar 2004, Keith Wansbrough wrote:
> > My question was why he doesn't believe that. My definition
> > data (Num a) => VList a = VList [a]
> > clearly states that VLists will ever get types of class Num as
> > parameters.
>
> Ah. Constraints on datatype declarations are a misfeature of Haskell, and
> have no useful effect. You shouldn't use them.
Ok.
Btw. ghc suggests:
VectorSpace.lhs:37:
Could not deduce (Num a) from the context (VectorSpace VList)
arising from the literal `0' at VectorSpace.lhs:37
Probable fix:
Add (Num a) to the class or instance method `zero'
^^^^^^^^^^^^^^^
I know how to add context information to the signature in a class
definition. But how can I add context information at the point of
instantation of a method?
More information about the Haskell-Cafe
mailing list