Ad esempio, ParsecT ha più variabili di tipo nella sua definizione.Qual è la regola dell'ordine di più variabili di tipo in haskell?
newtype ParsecT s u m a
= ParsecT {unParser :: forall b .
State s u
-> (a -> State s u -> ParseError -> m b)
-> (ParseError -> m b)
-> (a -> State s u -> ParseError -> m b)
-> (ParseError -> m b)
-> m b
}
Possiamo farlo in questo modo?
newtype ParsecT m a s u -- Only the order of s u m a is changed to m a s u.
= ParsecT {unParser :: forall b .
State s u
-> (a -> State s u -> ParseError -> m b)
-> (ParseError -> m b)
-> (a -> State s u -> ParseError -> m b)
-> (ParseError -> m b)
-> m b
}
mi chiedo se c'è una regola o principio circa l'ordine delle variabili di tipo quando si definisce una newtype.
Una domanda simile a livello di valore è qui: http://stackoverflow.com/questions/5863128/ordering-of-parameters-to-make-use-of-currying – cheecheeo