Module

BoomBoom.Generic.Interpret

Package
purescript-boomboom
Repository
paluh/purescript-boomboom

#R Source

data R a

Here we are defining machinery for "tree of records" interpretation. As we are defining this tree on the type level and operating on it through type classes this stragegy should not suffer from the "expression problem" and should be extensible - you should be able to extend given node set but also interpretation set for predefined nodes.

This interpreting machinery allows to run transformations similar to catamorphisms but also less elegant/simple scenarios which require information about parent node too.

Constructors

Instances

#V Source

data V a

Constructors

Instances

#B Source

data B t

Constructors

Instances

#Field Source

data Field :: Type

Only root of our tree is not a field of a record. This kind allows us to represent this option.

#Root Source

data Root :: Field

Instances

#Field Source

data Field :: Symbol -> Symbol -> Field

Allow case analysis on constrctor:

  1. Parent name - it will be changed to parent type soon. It provides a way to break usual "locality" of *morphisms algebras which is required in case of BoomBooms generation.
  2. Field name which we are in.

Instances

#InterpretProxy Source

data InterpretProxy (interpreter :: Symbol) (field :: Field)

Constructors

#MapProxy Source

data MapProxy (interpreter :: Symbol) (parent :: Symbol)

Constructors

#MapRecord Source

class MapRecord interpreter parent il i o | interpreter il -> o where

Members

Instances

#Interpret Source

class Interpret interpreter field a b | interpreter field a -> b where

Members

Instances

#AlgProxy Source

data AlgProxy (interpreter :: Symbol) (field :: Field) (term :: Type)

We are storing here:

  • name of our interpreter
  • field information (parent constructor name + field name)
  • original term type (like in paramorphism)

Constructors

#Alg Source

class Alg interpreter field term a b | interpreter field term -> a, interpreter field term a -> b where

I'm not sure about these functional dependencies but without them we have a problem...

Members

Instances

#AddField Source

class AddField parent name a b | parent a -> b where

Members

Instances

#Prefix Source

class Prefix tok  where

Members

Instances

#ApplicativeCat Source

newtype ApplicativeCat appl cat a b

Constructors

Instances

#ReaderCat Source

type ReaderCat v cat a b = ApplicativeCat (Function v) cat a b

#SameLabels Source

class SameLabels (list :: RowList) (row :: Row Type) | list -> row

Instances

#interpret Source

interpret :: forall interpreter b a. IsSymbol interpreter => Interpret interpreter Root a b => SProxy interpreter -> a -> b