ChristmasTree-0.1.2: Changing Haskell's Read Implementation Such That by Mainpulating Abstract Syntax Trees it Reads Expressions EfficientlySource codeContentsIndex
Text.GRead.Derive
Description

Automatically derive Text.GRead.Gram instances for data types.

Note! This is not a complete implementation and will not work for all datatypes.

Unsupported are

  • Multiple type arguments
  • Tuple, Function, List types
  • All primitive types (also when used in user defined types!)

Use with care.

Synopsis
deriveGrammar :: Name -> Q [Dec]
deriveSimpleGrammar :: Name -> Q [Dec]
Documentation
deriveGrammar :: Name -> Q [Dec]Source

Derive a Text.GRead.Gram instance. This is a Template Haskell function. Usage example:

data T1 = C1 | C2 | C3

$(deriveGrammar ''T1)
deriveSimpleGrammar :: Name -> Q [Dec]Source

Simpler version of deriveGrammar that doesn't do binding group calculations. Use this for large types without cyclic references to other types.

For example, if you want to derive the HDYRM.Gram for T3 and T4 below, you will need the normal deriveGrammar.

data T3 = T3 T4 | C3
data T4 = T4 T3 | C4
Produced by Haddock version 2.4.2