mirror of
https://github.com/iritmaximus/haskell.git
synced 2026-10-12 19:13:39 +03:00
5a ex6
This commit is contained in:
+5
-1
@@ -132,7 +132,11 @@ data Student = Freshman | NthYear Int | Graduated
|
||||
-- graduated student stays graduated even if he studies.
|
||||
|
||||
study :: Student -> Student
|
||||
study = todo
|
||||
study s = case s of
|
||||
Freshman -> NthYear 1
|
||||
NthYear 7 -> Graduated
|
||||
NthYear n -> NthYear (n+1)
|
||||
Graduated -> Graduated
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
-- Ex 7: define a datatype UpDown that represents a counter that can
|
||||
|
||||
Reference in New Issue
Block a user