summaryrefslogtreecommitdiff
path: root/tests/Test/StarWars/Data.hs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Test/StarWars/Data.hs')
-rw-r--r--tests/Test/StarWars/Data.hs9
1 files changed, 3 insertions, 6 deletions
diff --git a/tests/Test/StarWars/Data.hs b/tests/Test/StarWars/Data.hs
index 17263c0..a710dd8 100644
--- a/tests/Test/StarWars/Data.hs
+++ b/tests/Test/StarWars/Data.hs
@@ -1,11 +1,7 @@
-{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
module Test.StarWars.Data where
-#if !MIN_VERSION_base(4,8,0)
-import Control.Applicative ((<$>), pure)
import Data.Monoid (mempty)
-#endif
import Control.Applicative (Alternative, (<|>), empty, liftA2)
import Data.Maybe (catMaybes)
@@ -38,8 +34,6 @@ data Droid = Droid
type Character = Either Droid Human
--- I still don't think this is cumbersome enough to bring lens
-
id_ :: Character -> ID
id_ (Left x) = _id_ . _droidChar $ x
id_ (Right x) = _id_ . _humanChar $ x
@@ -59,6 +53,9 @@ appearsIn (Right x) = _appearsIn . _humanChar $ x
secretBackstory :: Character -> Text
secretBackstory = error "secretBackstory is secret."
+typeName :: Character -> Text
+typeName = either (const "Droid") (const "Human")
+
luke :: Character
luke = Right luke'