diff options
| author | Danny Navarro <j@dannynavarro.net> | 2017-03-01 22:04:13 -0300 |
|---|---|---|
| committer | Danny Navarro <j@dannynavarro.net> | 2017-03-01 17:04:13 -0300 |
| commit | 285ccb0af954059879b12e33754fd10ccbed646d (patch) | |
| tree | 14fa3e0e93b915232347f4efe9cd7eac6869553c /tests/Test/StarWars/Data.hs | |
| parent | 6a10e28ba85d593184f6a1885bbab2347466ea0e (diff) | |
| download | graphql-285ccb0af954059879b12e33754fd10ccbed646d.tar.gz | |
Implement type instrospection tests
The main intention with this commit is to show a poor's man way to support type
instrospection.
Diffstat (limited to 'tests/Test/StarWars/Data.hs')
| -rw-r--r-- | tests/Test/StarWars/Data.hs | 9 |
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' |
