author | haftmann |
Thu, 26 Apr 2007 13:32:55 +0200 | |
changeset 22798 | e3962371f568 |
parent 22751 | 1bfd75c1f232 |
child 24421 | acfb2413faa3 |
permissions | -rw-r--r-- |
22015 | 1 |
module Codegen where { |
2 |
||
3 |
import qualified Nat; |
|
21147 | 4 |
|
22015 | 5 |
class Null a where { |
6 |
nulla :: a; |
|
7 |
}; |
|
8 |
||
22798 | 9 |
heada :: (Codegen.Null b) => [b] -> b; |
22751 | 10 |
heada (x : xs) = x; |
22015 | 11 |
heada [] = Codegen.nulla; |
21147 | 12 |
|
22188
a63889770d57
adjusted manual to improved treatment of overloaded constants
haftmann
parents:
22015
diff
changeset
|
13 |
null_option :: Maybe a; |
22015 | 14 |
null_option = Nothing; |
21147 | 15 |
|
22015 | 16 |
instance Codegen.Null (Maybe b) where { |
17 |
nulla = Codegen.null_option; |
|
18 |
}; |
|
21147 | 19 |
|
22015 | 20 |
dummy :: Maybe Nat.Nat; |
21 |
dummy = Codegen.heada [Just (Nat.Suc Nat.Zero_nat), Nothing]; |
|
21147 | 22 |
|
22015 | 23 |
} |