@@ -1,11 +1,14 @@
11-- the Out-of-the-Tarpit example in Haskell and Project:M36
2−{-# LANGUAGE DeriveAnyClass #-}
2+{-# LANGUAGE DeriveAnyClass, DeriveGeneric #-}
33import ProjectM36.Client
44import qualified Data.Map as M
55import qualified Data.Set as S
66import Data.Maybe
77import Control.Monad
88import Data.Monoid
9+import GHC.Generics
10+import Data.Binary
11+import Control.DeepSeq
912
1013addressAtomType :: AtomType
1114addressAtomType = TextAtomType
@@ -19,15 +22,27 @@ priceAtomType = DoubleAtomType
1922fileNameAtomType :: AtomType
2023fileNameAtomType = TextAtomType
2124
22−roomAtomType :: AtomType
23−roomAtomType = ConstructedAtomType "Room" M.empty
24−
25+data Room = Kitchen | Bathroom | LivingRoom
26+ deriving (Generic, Atomable, Eq, Show, Binary, NFData)
27+
28+roomAtomType :: AtomType
29+roomAtomType = toAtomType (undefined :: Room)
30+
31+data PriceBand = Low | Medium | High | Premium
32+ deriving (Generic, Atomable, Eq, Show, Binary, NFData)
33+
2534priceBandAtomType :: AtomType
26−priceBandAtomType = ConstructedAtomType "PriceBand" M.empty
35+priceBandAtomType = toAtomType (undefined :: PriceBand)
36+
37+data AreaCode = City | Suburban | Rural
38+ deriving (Generic, Atomable, Eq, Show, Binary, NFData)
2739
2840areaCodeAtomType :: AtomType
2941areaCodeAtomType = ConstructedAtomType "AreaCode" M.empty
3042
43+data SpeedBand = VeryFastBand | FastBand | MediumBand | SlowBand
44+ deriving (Generic, Atomable, Eq, Show, Binary, NFData)
45+
3146speedBandAtomType :: AtomType
3247speedBandAtomType = ConstructedAtomType "SpeedBand" M.empty
3348