Skip to content

Instantly share code, notes, and snippets.

@bergmark
Created November 26, 2013 08:32
Show Gist options
  • Select an option

  • Save bergmark/7655113 to your computer and use it in GitHub Desktop.

Select an option

Save bergmark/7655113 to your computer and use it in GitHub Desktop.
{-# LANGUAGE RankNTypes #-}
module Test where
import Data.Data (Data)
import Data.Generics.Uniplate.Data
import Data.Typeable (Typeable)
import Language.Haskell.Exts.Annotated hiding (binds, loc)
import Prelude hiding (exp)
desugarPatField :: forall l. (Data l, Typeable l) => Module l -> Module l
desugarPatField = t $ \pf -> case pf of
-- {a} => {a=a} for R{a}
PFieldPun l n -> PFieldPat l (UnQual l n) (PVar l n)
_ -> pf
where
t :: (Data l, Typeable l) => (PatField l -> PatField l) -> Module l -> Module l
t = transformBi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment