Ur Rosetta Stone
From Impredicative Wiki
(Difference between revisions)
(done top module) |
(added monad) |
Latest revision as of 17:45, 24 June 2011
These rough translations are designed to aid understanding, rather than to be rigorous! In some cases the types of the Ur functions and the functions in other languages will correspond exactly; in other cases the Ur function types will be more precise and/or more general.
[edit] module option
Ur | Haskell |
---|---|
option | Maybe |
Some | Just |
None | Nothing |
eq | instance Eq Maybe |
ord | instance Ord Maybe |
isNone | isNothing |
isSome | isJust |
mp | fmap |
bind | (=<<) |
get | fromMaybe |
[edit] module top
Ur | Haskell |
---|---|
not | not |
ex P | data Foo = MkFoo (forall a. P a) |
ex_intro | MkFoo (see previous row) |
ex_elim | ex_elim (MkFoo x) f = f x (see previous rows) |
compose | (.) |
show option | instance Show Maybe |
read option | instance Read Maybe |
map0 | replicate n [*] |
foldUR | foldr [*] |
foldUR2 | zipWith [*] |
[edit] module monad
Ur | Haskell |
---|---|
exec | sequence [*] |
ignore | ignore x = x >> return () |
mp | liftM |
mapR0 | replicateM n [*] |
appR | mapM_ [*] |
foldMapR | mapAccumR (but monadic) [*] |
appR2 | zipWithM_ [*] |
[*] Not an exact translation