Last change
on this file since b965774 was
1725989,
checked in by Peter A. Buhr <pabuhr@…>, 2 months ago
|
add enumeration test programs for different programming languages
|
-
Property mode set to
100644
|
File size:
356 bytes
|
Rev | Line | |
---|
[1725989] | 1 | data Week = Mon | Tue | Wed | Thu | Fri | Sat | Sun deriving(Eq, Enum, Show) |
---|
| 2 | |
---|
| 3 | day = Tue |
---|
| 4 | main = do |
---|
| 5 | if day == Tue then |
---|
| 6 | print day |
---|
| 7 | else |
---|
| 8 | putStr "not Tue" |
---|
| 9 | print (enumFrom Mon) -- week |
---|
| 10 | print (enumFromTo Mon Fri) -- weekday |
---|
| 11 | print (enumFromTo Sat Sun) -- weekend |
---|
| 12 | |
---|
| 13 | -- Local Variables: -- |
---|
| 14 | -- compile-command: "ghc test1.hs; ./test1" -- |
---|
| 15 | -- End: -- |
---|
Note: See
TracBrowser
for help on using the repository browser.