Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

polymorphic data types

  • Loading branch information...
commit 09ab078ecfa25aeaa0a0cf78075017a34e44078e 1 parent 9969d58
@mikeplus64 mikeplus64 authored
Showing with 5 additions and 22 deletions.
  1. +5 −22 tests/templates.hs
View
27 tests/templates.hs
@@ -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"
Please sign in to comment.
Something went wrong with that request. Please try again.