ghc-lib-parser-9.8.2.20240223: The GHC API, decoupled from GHC versions

Safe Haskell | None
Language | Haskell2010

GHC.JS.Transform

Contents

- Saturation
- Generic traversal (via compos)

Synopsis

- identsS :: JStat -> [Ident]
- identsV :: JVal -> [Ident]
- identsE :: JExpr -> [Ident]
- satJStat :: Maybe FastString -> JStat -> JStat
- satJExpr :: Maybe FastString -> JExpr -> JExpr
- class JMacro a where
  - jtoGADT :: a -> JMGadt a
  - jfromGADT :: JMGadt a -> a
- data JMGadt a where
  - JMGId :: Ident -> JMGadt Ident
  - JMGStat :: JStat -> JMGadt JStat
  - JMGExpr :: JExpr -> JMGadt JExpr
  - JMGVal :: JVal -> JMGadt JVal
- class Compos (t :: Type -> Type) where
  - compos :: (forall a. a -> m a) -> (forall a b. m (a -> b) -> m a -> m b) -> (forall a. t a -> m (t a)) -> t c -> m (t c)
- composOp :: Compos t => (forall a. t a -> t a) -> t b -> t b
- composOpM :: (Compos t, Monad m) => (forall a. t a -> m (t a)) -> t b -> m (t b)
- composOpM_ :: (Compos t, Monad m) => (forall a. t a -> m ()) -> t b -> m ()
- composOpFold :: Compos t => b -> (b -> b -> b) -> (forall a. t a -> b) -> t c -> b

# Documentation

identsS :: JStat -> [Ident] #

identsV :: JVal -> [Ident] #

identsE :: JExpr -> [Ident] #

# Saturation

satJStat :: Maybe FastString -> JStat -> JStat #

Given an optional prefix, fills in all free variable names with a supply of names generated by the prefix.

satJExpr :: Maybe FastString -> JExpr -> JExpr #

# Generic traversal (via compos)

class JMacro a where #

Compos and ops for generic traversal as defined over the JMacro ADT.

Utility class to coerce the ADT into a regular structure.

Methods

jtoGADT :: a -> JMGadt a #

jfromGADT :: JMGadt a -> a #

#### Instances

Instances details

JMacro Ident # |
Instance details Defined in GHC.JS.Transform Methods jtoGADT :: Ident -> JMGadt Ident # jfromGADT :: JMGadt Ident -> Ident #
JMacro JExpr # |
Instance details Defined in GHC.JS.Transform Methods jtoGADT :: JExpr -> JMGadt JExpr # jfromGADT :: JMGadt JExpr -> JExpr #
JMacro JStat # |
Instance details Defined in GHC.JS.Transform Methods jtoGADT :: JStat -> JMGadt JStat # jfromGADT :: JMGadt JStat -> JStat #
JMacro JVal # |
Instance details Defined in GHC.JS.Transform Methods jtoGADT :: JVal -> JMGadt JVal # jfromGADT :: JMGadt JVal -> JVal #

data JMGadt a where #

Union type to allow regular traversal by compos.

Constructors

JMGId :: Ident -> JMGadt Ident |
JMGStat :: JStat -> JMGadt JStat |
JMGExpr :: JExpr -> JMGadt JExpr |
JMGVal :: JVal -> JMGadt JVal |

#### Instances

Instances details

Compos JMGadt # |
Instance details Defined in GHC.JS.Transform Methods compos :: (forall a. a -> m a) -> (forall a b. m (a -> b) -> m a -> m b) -> (forall a. JMGadt a -> m (JMGadt a)) -> JMGadt c -> m (JMGadt c) #

class Compos (t :: Type -> Type) where #

Methods

compos :: (forall a. a -> m a) -> (forall a b. m (a -> b) -> m a -> m b) -> (forall a. t a -> m (t a)) -> t c -> m (t c) #

#### Instances

Instances details

Compos JMGadt # |
Instance details Defined in GHC.JS.Transform Methods compos :: (forall a. a -> m a) -> (forall a b. m (a -> b) -> m a -> m b) -> (forall a. JMGadt a -> m (JMGadt a)) -> JMGadt c -> m (JMGadt c) #

composOp :: Compos t => (forall a. t a -> t a) -> t b -> t b #

composOpM :: (Compos t, Monad m) => (forall a. t a -> m (t a)) -> t b -> m (t b) #

composOpM_ :: (Compos t, Monad m) => (forall a. t a -> m ()) -> t b -> m () #

composOpFold :: Compos t => b -> (b -> b -> b) -> (forall a. t a -> b) -> t c -> b #