[Haskell] Re: Using implicit parameter constraints in data decl

Ben Rudiak-Gould Benjamin.Rudiak-Gould at cl.cam.ac.uk
Mon Nov 8 10:36:05 EST 2004


Benjamin Franksen wrote:

 >On Sunday 07 November 2004 23:19, Ben Rudiak-Gould wrote:
 >
 >>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'

Try using -fglasgow-exts instead of -fimplicit-params. Without 
glasgow-exts you can't use nested contexts in any circumstances; e.g. 
you can't write

    test :: ((?val::Bool) => String) -> ()

which is (similar to) the type that the data constructor Test needs to have.

-- Ben



More information about the Haskell mailing list