-- \"Scrap your boilerplate\" --- Generic programming in Haskell
-- See <http://www.cs.vu.nl/boilerplate/>. The present module
-- instantiates the class Data for Prelude-like datatypes.
+-- (This module does not export anything. It really just defines instances.)
--
-----------------------------------------------------------------------------
module Data.Generics.Instances
+
where
trueConstr = mkConstr boolDataType "True" [] Prefix
boolDataType = mkDataType "Prelude.Bool" [falseConstr,trueConstr]
+
instance Data Bool where
toConstr False = falseConstr
toConstr True = trueConstr
------------------------------------------------------------------------------
-nilConstr = mkConstr listDataType "[]" [] Prefix
+nilConstr = mkConstr listDataType "[]" [] Prefix
consConstr = mkConstr listDataType "(:)" [] Infix
listDataType = mkDataType "Prelude.[]" [nilConstr,consConstr]