This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE FlexibleContexts , ScopedTypeVariables , TypeFamilies #-} | |
import Data.Proxy | |
class Problem p where | |
type State p :: * | |
data Action p :: * | |
actions :: State p -> [Action p] | |
result :: State p -> Action p -> State p |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ExistentialQuantification #-} | |
import Prelude hiding (id,(.)) | |
import Control.Category | |
data Learn a b | |
= forall p. Learn | |
{ impl :: p -> a -> b | |
, update :: p -> a -> b -> p | |
, request :: p -> a -> b -> a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE | |
DeriveAnyClass | |
, DeriveGeneric | |
, DerivingStrategies | |
, GADTs | |
, LambdaCase | |
, OverloadedStrings | |
#-} | |
module Migratory where |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Data.Distributor | |
( -- * lax monoidal profunctors | |
Monoidal (unit, (>*<)) , dimap2, (>*), (*<) | |
, replicateP, replicateP_, foreverP | |
, Mon (Mon), liftMon | |
-- * lax distributors | |
, Distributor (zero, (>+<), several, several1, possibly) | |
, dialt, (>|<) | |
, Dist (DistEmpty, DistEither) | |
, DistAlt (DistAlts), liftDistAlt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
newtype Grammar a b = Grammar | |
(Loop (String := Production) () (Production a b)) | |
type Production = DistAlt (ChooseMon (Token Char Char)) | |
newtype Loop p a b = Loop | |
{ runLoop | |
:: forall q. ArrowLoop q | |
=> (forall x y. p x y -> q x y) | |
-> q a b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Given distributive category | |
* -C>, >C<, 1C, +C+, 0C | |
And monoidal category | |
* -D>, >D<, 1D | |
A lax alternative functor consists of | |
* A functor | |
- F : C -> D | |
* morphisms | |
- eps : 1D -D> F(1C) | |
- mu : F(a) >D< F(b) -D> F(a >C< b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Constraint.Trans where | |
class (forall a. c a => d (f a)) | |
=> CFunctor c d f | f -> c, f -> d where | |
-- prop> cmap id = id | |
-- prop> cmap (g . f) = cmap g . cmap f | |
cmap :: (c a, c b) => (a -> b) -> f a -> f b | |
class CFunctor c d f | |
=> CTrans c d f where |