projects
/
ghc-hetmet.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
(F)SLIT -> (f)sLit in ByteCodeGen
[ghc-hetmet.git]
/
compiler
/
ilxGen
/
tests
/
test13.hs
1
class NewFunctor f where
2
inj :: a -> f a
3
surj :: f a -> a
4
5
data N a = Z a
6
7
ninj x = (Z x)
8
nsurj (Z x) = x
9
10
instance NewFunctor N where
11
inj = ninj
12
surj = nsurj
13
14
twice :: NewFunctor f => a -> f (f a)
15
twice x = inj(inj x)
16
17
undo :: NewFunctor f => f (f a) -> a
18
undo x = surj(surj x)
19
20
main = putStr (undo (Z (Z "hello world\n")))