peakachu-0.2: Experiemental library for composable interactive programsSource codeContentsIndex
Data.ADT.Getters
Description

ADT getters generation with Template Haskell

Example:

 {-# LANGUAGE TemplateHaskell #-}
 data Blah a = NoBlah | YesBlah a | ManyBlah a Int
 $(mkADTGetters ''Blah)

Generates

 gNoBlah :: Blah a -> Maybe ()
 gYesBlah :: Blah a -> Maybe a
 gManyBlah :: Blah a -> Maybe (a, Int)

Where

 gYesBlah (YesBlah a) = Just a
 gYesBlah _ = Nothing

etc.

Documentation
mkADTGetters :: Name -> Q [Dec]Source
Produced by Haddock version 2.4.2