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 Main where | |
import Prelude | |
import Effect (Effect) | |
import Data.Foldable (fold) | |
import TryPureScript (h1, h2, p, text, list, indent, link, render, code) | |
import Unsafe.Coerce (unsafeCoerce) | |
import Prim.RowList | |
import Prim.Row |
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 TypeFamilies, DataKinds, GADTs #-} | |
module TypeFam where | |
data JsValue = VArray [JsValue] | VNum Double | VString String deriving (Show) | |
data JsTypeMap | |
= AsDouble | |
| AsList JsTypeMap | |
| AsString | |
deriving (Show) |
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 ICat2 | |
%default total | |
data Ft -- functors | |
= Var Nat | |
| Terminal | |
| Prod Ft Ft | |
| Exp Ft Ft |
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 FlexibleInstances #-} | |
module LC where | |
import Control.Monad.Cont | |
import Control.Monad (guard) | |
import Control.Concurrent | |
import Data.Bifunctor (bimap) | |
-- Interface to retrieve a boolean and then produce a boolean. | |
interface1 :: FT |
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 Linc where | |
import Data.STRef | |
import Control.Monad.ST | |
import Control.Monad ((>=>)) | |
data Structure = Structure | |
{ term :: Tm Int Int | |
, link_count :: Int | |
, opt_count :: Int |
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 INet where | |
import Data.STRef | |
import Control.Monad.ST | |
-- This kind of implementation of optimal reduction | |
-- accumulates control nodes (Croissants and brackets) | |
-- | |
-- I'd guess the reason for that is that it's lacking essential structure. | |
-- Adding a "box" around the exponential solves the problem, but also removes the optimality. |
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 GS2 where | |
import Data.STRef | |
import Control.Monad.ST | |
import qualified Data.Map as Map | |
import Data.Map (Map) | |
-- Terms to normalise | |
type Arity = (Int, Int, Int) | |
data Tm |
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
-- Haven't tested this, may contain trivial bugs. | |
module GS2 where | |
import Control.Concurrent | |
import Control.Concurrent.MVar | |
-- import qualified Data.Map as Map | |
-- import Data.Map (Map) | |
data Ty | |
= Initial |
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
-- Haven't tested this, may contain trivial bugs. | |
module GS2 where | |
import Control.Concurrent | |
import Control.Concurrent.MVar | |
-- import qualified Data.Map as Map | |
-- import Data.Map (Map) | |
data Ty | |
= Initial |
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
/* There may be mistakes here. | |
This program implements "optimal reduction" in CHR, | |
it runs in CHR.js playground. | |
The N in front of each structure is a label. | |
Rest of the numbers are edges between combinators. | |
fresh(N) tracks fresh numbers to produce new edges. | |
*/ | |
eq(X,Y), eq(Y,Z) <=> eq(X,Z) |