Permalink
Browse files

polymorphic data types

  • Loading branch information...
1 parent 9969d58 commit 09ab078ecfa25aeaa0a0cf78075017a34e44078e @mikeplus64 mikeplus64 committed Jan 23, 2013
Showing with 5 additions and 22 deletions.
  1. +5 −22 tests/templates.hs
View
@@ -95,38 +95,21 @@ data Foo = Foo { _fooX, _fooY :: Int }
makeClassy ''Foo
-data Dude = Dude
+data Dude a = Dude
{ _dudeLevel :: Int
, _dudeAlias :: String
, _dudeLife :: ()
+ , _dudeThing :: a
}
-data Lebowski = Lebowski
+data Lebowski a = Lebowski
{ _lebowskiAlias :: String
, _lebowskiLife :: Int
, _lebowskiMansion :: String
+ , _lebowskiThing :: Maybe a
}
+
makeFields ''Dude
makeFields ''Lebowski
--- class HasLevel c e | c -> e where
--- level :: Lens' c e
--- instance HasLevel Dude Int where
--- level = _dudeLevelLens
--- class HasAlias c e | c -> e where
--- alias :: Lens' c e
--- instance HasAlias Dude String where
--- alias = _dudeAliasLens
--- class HasLife c e | c -> e where
--- life :: Lens' c e
--- instance HasLife Dude () where
--- life = _dudeLifeLens
--- instance HasAlias Lebowski String where
--- alias = _lebowskiAliasLens
--- instance HasLife Lebowski Int where
--- life = _lebowskiLifeLens
--- class HasMansion c e | c -> e where
--- mansion :: Lens' c e
--- instance HasMansion Lebowski String where
--- mansion = _lebowskiMansionLens
main :: IO ()
main = putStrLn "test/templates.hs: ok"

0 comments on commit 09ab078

Please sign in to comment.