[Haskell] Proposal: Allow "\=" for field update in record update syntax

Keean Schupke k.schupke at imperial.ac.uk
Fri Mar 4 17:44:09 EST 2005


Benjamin Franksen wrote:

>On Friday 04 March 2005 16:32, Keean Schupke wrote:
>  
>
>>robert dockins wrote:
>>    
>>
>>>Is that really how this is done?  That doesn't seem like it can be right:
>>>
>>>instance X (a b)  -- single parameter class where 'a' has an arrow kind
>>>
>>>is very different from:
>>>
>>>instance X a b    -- multiple parameter class
>>>
>>>I would expect a type constructed with 'appT' to correspond to the
>>>first declaration, and not to the second.
>>>      
>>>
>>Yup, thats how it is done, I have some complex working TH that generates
>>multi parameter classes with fundeps
>>instances etc... and I can say for definite it all works fine:
>>
>>For the above examples
>>
>>appT X (appT a b) -- X is applied once (to a applied to b)
>>
>>appT (appT X a) b -- X is applied twice first to a then to b
>>    
>>
>
>But this has nothing to do with the instance question. I agree with Robert 
>that
>
>	AppT a b
>
>definitely sounds like type constructor application. How can this help with 
>multi parameter class instances? Consider:
>
>	class Bogus a b
>	instance Bogus Int Char
>
>How do you express the /instance/ in TH? Using AppT? AppT would make sense for
>
>	instance Show a => Show [a] where ...
>
>where one would express the '[a]' in TH as
>
>	AppT LiftT (VarT mkName "a")
>  
>
That would be:

(using 6.4 syntax)

AppT (AppT (ConT (mkName "Bogus")) (ConT ''Int)) (ConT ''Char)

If the instance is using type variables:

instance Bogus Int a

you get:

AppT (AppT (ConT (mkName "Bogus")) (ConT ''Int)) (VarT (mkName "a"))

    Keean.



More information about the Haskell mailing list