[Haskell-beginners] arrow type signature question

Daniel Fischer daniel.is.fischer at web.de
Thu Nov 18 10:52:59 EST 2010


On Thursday 18 November 2010 16:07:34, MH wrote:
> I am looking at signatures for Arrow and Composable classes and I cannot
> understand some of them. Could you please explain me the following:
> Let's take for example the following:
>
> class FunAble h => FunDble h where
>   resultFun   :: (h b -> h b') -> (h (a->b) -> h (a->b'))
>
> class FunAble h where
>   secondFun :: (h b -> h b') -> (h (a,b) -> h (a,b')) -- for 'second'
>
>
> in the signatures:
> resultFun   :: (h b -> h b') -> (h (a->b) -> h (a->b'))
> secondFun :: (h b -> h b') -> (h (a,b) -> h (a,b'))
>
> if (h b -> h b') is the input of these functions where does 'a' comes
> from in the output?

'a' is arbitrary, so it works for all 'a'. The result of resultFun foo, 
resp. secondFun foo is a function of type

h (a -> b) -> h (a -> b')

resp.

h (a,b) -> h (a,b')

where the types b and b' have been determined by foo (not necessarily 
completely, if foo is id, all that has been determined is that b' = b) and 
'a' is still arbitrary. The type variable 'a' is fixed or restricted when 
xxxFun gets its second argument, bar in

resultFun foo bar

resp.

secondFun foo bar.

>
> Thanks,

HTH,
Daniel



More information about the Beginners mailing list