lundi 17 octobre 2016

How to create matching pattern on a pair of functions in haskell

I have a problem because this code below isn't working. I think it compares types, so it will always return 'a' for my functions which I want to compare. How can I fix it please? Is there any function pattern that differs functions by name?

leftHasPriority :: (a->b->c) -> (e->f->g) -> Char
leftHasPriority _ (^) = 'a'
leftHasPriority (^) _ = 'b'
leftHasPriority (*) _ = 'c'
leftHasPriority (div) _ = 'd'
leftHasPriority _ (*) = 'e'
leftHasPriority _ (div) = 'f'
leftHasPriority _ _ = 'g'

Aucun commentaire:

Enregistrer un commentaire