mirror of
https://github.com/iritmaximus/haskell.git
synced 2026-10-12 19:13:39 +03:00
5a ex1+2
This commit is contained in:
+2
-1
@@ -12,7 +12,7 @@ import Mooc.Todo
|
|||||||
-- Bus, Tram and Train.
|
-- Bus, Tram and Train.
|
||||||
--
|
--
|
||||||
-- The constructors don't need any fields.
|
-- The constructors don't need any fields.
|
||||||
|
data Vehicle = Bike | Bus | Tram | Train
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
-- Ex 2: Define the type BusTicket that can represent values like these:
|
-- Ex 2: Define the type BusTicket that can represent values like these:
|
||||||
@@ -20,6 +20,7 @@ import Mooc.Todo
|
|||||||
-- - MonthlyTicket "January"
|
-- - MonthlyTicket "January"
|
||||||
-- - MonthlyTicket "December"
|
-- - MonthlyTicket "December"
|
||||||
|
|
||||||
|
data BusTicket = SingleTicket | MonthlyTicket String
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
-- Ex 3: Here's the definition for a datatype ShoppingEntry that
|
-- Ex 3: Here's the definition for a datatype ShoppingEntry that
|
||||||
|
|||||||
Reference in New Issue
Block a user