Clean's type system.
Arjan van IJzendoorn
arjanij@cs.kun.nl
Thu, 6 Nov 1997 10:39:12 +0100
Hello Nick,
>jump :: Addr State -> State.
>
>A more elegant way of looking at jump is as a function that takes an address
>and ruturns an Instruction. Thus,
>
>jump :: Addr -> Instruction.
>
>"Unfortunately, the Clean type system does not allow us to write [this]" (p.
>257).
Clean's type system DOES allow you to write this. It only enforces
that the arity of the type is the same as the arity of the definition.
I don't know what jump does, but you can write something like:
jump :: Addr -> Instruction
jump address = \state -> changePC state
where
changePC state = ....
Or you can write...
jump :: Addr -> Instruction
jump address = realJump
where
realJump state = changePC state
changePC state = ....do something with address...
...if you do not like lambda-expressions.
Greetings,
Arjan