Home

Awesome

A simple crud DSL with an interpreter written as cofree commonad in Purescript

The store type is simply

type Store = Array User

where

newtype User = User
    { id :: Int
    , name :: String
    }

There are four commands in the DSL:

data Command a = Add User a
               | Remove Int a
               | ChangeName Int String a
               | GetUsers (Array User -> a)
               | SaveUser User a

The type of the DSL is

type StoreDSL a = Free Command a

There are two interpreters