[Haskell] Re: Using implicit parameter constraints in data decl
Benjamin Franksen
benjamin.franksen at bessy.de
Mon Nov 8 10:04:32 EST 2004
On Sunday 07 November 2004 23:19, Ben Rudiak-Gould wrote:
> Benjamin Franksen wrote:
> >data (?val::Bool) => Test = Test { name :: String }
> >
> >is rejected by the compiler:
> >
> >TestBug.hs:3:
> > Illegal constraint ?val :: Bool
> > In the context: (?val :: Bool)
> > While checking the context of the data type declaration for `Test'
> > In the data type declaration for `Test'
> >
> >which is unfortunate since it means that you cannot put a function that
> >depends on an implicit parameter into a data structure.
>
> Does this do what you want?:
>
> data Test = Test { name :: (?val::Bool) => String }
Thanks for the hint, but no:
TestBug.hs:4:
Illegal constraint ?val :: Bool
In the type: ({?val :: Bool} => String) -> Test
While checking the type of constructor `Test'
In the data type declaration for `Test'
Ben
More information about the Haskell
mailing list