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

Safe Haskell | Ignore
Language | GHC2021

GHC.Cmm.Dataflow.Block

Synopsis

- data Extensibility
  - = Open
  - | Closed
- type O = 'Open
- type C = 'Closed
- data MaybeO (ex :: Extensibility) t where
  - JustO :: forall t. t -> MaybeO 'Open t
  - NothingO :: forall t. MaybeO 'Closed t
- type family IndexedCO (ex :: Extensibility) (a :: k) (b :: k) :: k
- data Block (n :: Extensibility -> Extensibility -> Type) (e :: Extensibility) (x :: Extensibility) where
  - BlockCO :: forall (n :: Extensibility -> Extensibility -> Type). n C O -> Block n O O -> Block n 'Closed 'Open
  - BlockCC :: forall (n :: Extensibility -> Extensibility -> Type). n C O -> Block n O O -> n O C -> Block n 'Closed 'Closed
  - BlockOC :: forall (n :: Extensibility -> Extensibility -> Type). Block n O O -> n O C -> Block n 'Open 'Closed
  - BNil :: forall (n :: Extensibility -> Extensibility -> Type). Block n 'Open 'Open
  - BMiddle :: forall (n :: Extensibility -> Extensibility -> Type). n O O -> Block n 'Open 'Open
  - BCat :: forall (n :: Extensibility -> Extensibility -> Type). Block n O O -> Block n O O -> Block n 'Open 'Open
  - BSnoc :: forall (n :: Extensibility -> Extensibility -> Type). Block n O O -> n O O -> Block n 'Open 'Open
  - BCons :: forall (n :: Extensibility -> Extensibility -> Type). n O O -> Block n O O -> Block n 'Open 'Open
- blockAppend :: forall (n :: Extensibility -> Extensibility -> Type) (e :: Extensibility) (x :: Extensibility). Block n e O -> Block n O x -> Block n e x
- blockConcat :: forall (n :: Extensibility -> Extensibility -> Type). [Block n O O] -> Block n O O
- blockCons :: forall n (x :: Extensibility). n O O -> Block n O x -> Block n O x
- blockFromList :: [n O O] -> Block n O O
- blockJoin :: n C O -> Block n O O -> n O C -> Block n C C
- blockJoinHead :: forall n (x :: Extensibility). n C O -> Block n O x -> Block n C x
- blockJoinTail :: forall n (e :: Extensibility). Block n e O -> n O C -> Block n e C
- blockSnoc :: forall n (e :: Extensibility). Block n e O -> n O O -> Block n e O
- blockSplit :: Block n C C -> (n C O, Block n O O, n O C)
- blockSplitHead :: forall n (x :: Extensibility). Block n C x -> (n C O, Block n O x)
- blockSplitTail :: forall n (e :: Extensibility). Block n e C -> (Block n e O, n O C)
- blockToList :: Block n O O -> [n O O]
- emptyBlock :: forall (n :: Extensibility -> Extensibility -> Type). Block n O O
- firstNode :: forall n (x :: Extensibility). Block n C x -> n C O
- foldBlockNodesB :: (forall (e :: Extensibility) (x :: Extensibility). n e x -> a -> a) -> forall (e :: Extensibility) (x :: Extensibility). Block n e x -> IndexedCO x a a -> IndexedCO e a a
- foldBlockNodesB3 :: forall n a b c. (n C O -> b -> c, n O O -> b -> b, n O C -> a -> b) -> forall (e :: Extensibility) (x :: Extensibility). Block n e x -> IndexedCO x a b -> IndexedCO e c b
- foldBlockNodesF :: (forall (e :: Extensibility) (x :: Extensibility). n e x -> a -> a) -> forall (e :: Extensibility) (x :: Extensibility). Block n e x -> IndexedCO e a a -> IndexedCO x a a
- isEmptyBlock :: forall (n :: Extensibility -> Extensibility -> Type) (e :: Extensibility) (x :: Extensibility). Block n e x -> Bool
- lastNode :: forall n (x :: Extensibility). Block n x C -> n O C
- mapBlock :: forall n n' (e :: Extensibility) (x :: Extensibility). (forall (e1 :: Extensibility) (x1 :: Extensibility). n e1 x1 -> n' e1 x1) -> Block n e x -> Block n' e x
- mapBlock' :: forall n n' (e :: Extensibility) (x :: Extensibility). (forall (e1 :: Extensibility) (x1 :: Extensibility). n e1 x1 -> n' e1 x1) -> Block n e x -> Block n' e x
- mapBlock3' :: forall n n' (e :: Extensibility) (x :: Extensibility). (n C O -> n' C O, n O O -> n' O O, n O C -> n' O C) -> Block n e x -> Block n' e x
- replaceFirstNode :: forall n (x :: Extensibility). Block n C x -> n C O -> Block n C x
- replaceLastNode :: forall n (x :: Extensibility). Block n x C -> n O C -> Block n x C

# Documentation

data Extensibility #

Used at the type level to indicate "open" vs "closed" structure.

Constructors

Open | An "open" structure with a unique, unnamed control-flow edge flowing in or out. "Fallthrough" and concatenation are permitted at an open point.
Closed | A "closed" structure which supports control transfer only through the use of named labels---no "fallthrough" is permitted. The number of control-flow edges is unconstrained.

type O = 'Open #

type C = 'Closed #

data MaybeO (ex :: Extensibility) t where #

Maybe type indexed by open/closed

Constructors

JustO :: forall t. t -> MaybeO 'Open t |
NothingO :: forall t. MaybeO 'Closed t |

#### Instances

Instances details

Functor (MaybeO ex) # |
Instance details Defined in GHC.Cmm.Dataflow.Block Methods fmap :: (a -> b) -> MaybeO ex a -> MaybeO ex b # (<$) :: a -> MaybeO ex b -> MaybeO ex a #

type family IndexedCO (ex :: Extensibility) (a :: k) (b :: k) :: k #

Either type indexed by closed/open using type families

#### Instances

Instances details

type IndexedCO C (a :: k) (_b :: k) # |
Instance details Defined in GHC.Cmm.Dataflow.Block type IndexedCO C (a :: k) (_b :: k) = a
type IndexedCO O (_a :: k) (b :: k) # |
Instance details Defined in GHC.Cmm.Dataflow.Block type IndexedCO O (_a :: k) (b :: k) = b

data Block (n :: Extensibility -> Extensibility -> Type) (e :: Extensibility) (x :: Extensibility) where #

A sequence of nodes. May be any of four shapes (OO, OC, CO, CC). Open at the entry means single entry, mutatis mutandis for exit. A closedclosed block is a basic/ block and can't be extended further. Clients should avoid manipulating blocks and should stick to either nodes or graphs.

Constructors

BlockCO :: forall (n :: Extensibility -> Extensibility -> Type). n C O -> Block n O O -> Block n 'Closed 'Open |
BlockCC :: forall (n :: Extensibility -> Extensibility -> Type). n C O -> Block n O O -> n O C -> Block n 'Closed 'Closed |
BlockOC :: forall (n :: Extensibility -> Extensibility -> Type). Block n O O -> n O C -> Block n 'Open 'Closed |
BNil :: forall (n :: Extensibility -> Extensibility -> Type). Block n 'Open 'Open |
BMiddle :: forall (n :: Extensibility -> Extensibility -> Type). n O O -> Block n 'Open 'Open |
BCat :: forall (n :: Extensibility -> Extensibility -> Type). Block n O O -> Block n O O -> Block n 'Open 'Open |
BSnoc :: forall (n :: Extensibility -> Extensibility -> Type). Block n O O -> n O O -> Block n 'Open 'Open |
BCons :: forall (n :: Extensibility -> Extensibility -> Type). n O O -> Block n O O -> Block n 'Open 'Open |

#### Instances

Instances details

OutputableP Platform (Block CmmNode C C) # |
Instance details Defined in GHC.Cmm.Node Methods pdoc :: Platform -> Block CmmNode C C -> SDoc #
OutputableP Platform (Block CmmNode C O) # |
Instance details Defined in GHC.Cmm.Node Methods pdoc :: Platform -> Block CmmNode C O -> SDoc #
OutputableP Platform (Block CmmNode O C) # |
Instance details Defined in GHC.Cmm.Node Methods pdoc :: Platform -> Block CmmNode O C -> SDoc #
OutputableP Platform (Block CmmNode O O) # |
Instance details Defined in GHC.Cmm.Node Methods pdoc :: Platform -> Block CmmNode O O -> SDoc #
OutputableP Platform (Graph CmmNode e x) # |
Instance details Defined in GHC.Cmm.Node Methods pdoc :: Platform -> Graph CmmNode e x -> SDoc #
NonLocal n => NonLocal (Block n) # |
Instance details Defined in GHC.Cmm.Dataflow.Graph Methods entryLabel :: forall (x :: Extensibility). Block n C x -> Label # successors :: forall (e :: Extensibility). Block n e C -> [Label] #

blockAppend :: forall (n :: Extensibility -> Extensibility -> Type) (e :: Extensibility) (x :: Extensibility). Block n e O -> Block n O x -> Block n e x #

blockConcat :: forall (n :: Extensibility -> Extensibility -> Type). [Block n O O] -> Block n O O #

blockCons :: forall n (x :: Extensibility). n O O -> Block n O x -> Block n O x #

blockFromList :: [n O O] -> Block n O O #

blockJoin :: n C O -> Block n O O -> n O C -> Block n C C #

blockJoinHead :: forall n (x :: Extensibility). n C O -> Block n O x -> Block n C x #

blockJoinTail :: forall n (e :: Extensibility). Block n e O -> n O C -> Block n e C #

blockSnoc :: forall n (e :: Extensibility). Block n e O -> n O O -> Block n e O #

blockSplit :: Block n C C -> (n C O, Block n O O, n O C) #

Split a closed block into its entry node, open middle block, and exit node.

blockSplitHead :: forall n (x :: Extensibility). Block n C x -> (n C O, Block n O x) #

blockSplitTail :: forall n (e :: Extensibility). Block n e C -> (Block n e O, n O C) #

blockToList :: Block n O O -> [n O O] #

emptyBlock :: forall (n :: Extensibility -> Extensibility -> Type). Block n O O #

firstNode :: forall n (x :: Extensibility). Block n C x -> n C O #

foldBlockNodesB :: (forall (e :: Extensibility) (x :: Extensibility). n e x -> a -> a) -> forall (e :: Extensibility) (x :: Extensibility). Block n e x -> IndexedCO x a a -> IndexedCO e a a #

foldBlockNodesB3 :: forall n a b c. (n C O -> b -> c, n O O -> b -> b, n O C -> a -> b) -> forall (e :: Extensibility) (x :: Extensibility). Block n e x -> IndexedCO x a b -> IndexedCO e c b #

foldBlockNodesF :: (forall (e :: Extensibility) (x :: Extensibility). n e x -> a -> a) -> forall (e :: Extensibility) (x :: Extensibility). Block n e x -> IndexedCO e a a -> IndexedCO x a a #

isEmptyBlock :: forall (n :: Extensibility -> Extensibility -> Type) (e :: Extensibility) (x :: Extensibility). Block n e x -> Bool #

lastNode :: forall n (x :: Extensibility). Block n x C -> n O C #

mapBlock :: forall n n' (e :: Extensibility) (x :: Extensibility). (forall (e1 :: Extensibility) (x1 :: Extensibility). n e1 x1 -> n' e1 x1) -> Block n e x -> Block n' e x #

map a function over the nodes of a `Block`

mapBlock' :: forall n n' (e :: Extensibility) (x :: Extensibility). (forall (e1 :: Extensibility) (x1 :: Extensibility). n e1 x1 -> n' e1 x1) -> Block n e x -> Block n' e x #

A strict `mapBlock`

mapBlock3' :: forall n n' (e :: Extensibility) (x :: Extensibility). (n C O -> n' C O, n O O -> n' O O, n O C -> n' O C) -> Block n e x -> Block n' e x #

map over a block, with different functions to apply to first nodes, middle nodes and last nodes respectively. The map is strict.

replaceFirstNode :: forall n (x :: Extensibility). Block n C x -> n C O -> Block n C x #

replaceLastNode :: forall n (x :: Extensibility). Block n x C -> n O C -> Block n x C #