Tuesday 15 September 2015

Understanding how Haskell precedence rules work with multiple partial application -


Please describe how Hassel determines priority with classes, tasks that have many logic and several partially implemented Take the function. Sometimes I find it difficult to find out which part of the function will be when the whole expression takes many arguments, then which argument will apply.

Here are some example functions, although I'm sure there can be more clearly in different examples. The first one has been taken from the 'Programming Programming with Influence' article.

  sequence :: [IO a] A ???? Io [A] Sequence [] = Return [] Sequence (C: CS) = Return (:) 'AP` C' AP 'Sequence CS (.) (.) (.) (.) (.)   

Is there any device to convert such expression into lambda expression form?

A list of identifiers in the function app such as abcd to ( ((Ab) c) d) as parsed. The bracketed infix operator is treated like an identifier (.) .

then (.) (.) (.) parses as ((.) (.)) (.) .

In general, such a variable operator

  `functionname`   

has left the associate by default, And the function is less priority than the application, but it can be modified with a infixl or infixr declaration. The ap function has not been modified by default, so pases in the form of sequence :

  ((return (:)) AP (C) (AP (Return (:)) C) (Sequence CS)  (AP C) `AP` (Sequence CS)   

or equivalent

  / Code>   

No comments:

Post a Comment