This commit is contained in:
James Eversole 2024-12-18 19:41:12 -06:00
parent ad0df667aa
commit fb04c9fffc
4 changed files with 6 additions and 39 deletions

View File

@ -1,6 +1,6 @@
# sapling # sapling
sapling is a "micro-language" that I'm working on to investigate [Tree Calculus](https://treecalcul.us/specification) . sapling is a "micro-language" that I'm working on to investigate [Tree Calculus](https://github.com/barry-jay-personal/typed_tree_calculus/blob/main/typed_program_analysis.pdf) .
It offers a minimal amount of syntax sugar: It offers a minimal amount of syntax sugar:
@ -9,10 +9,10 @@ It offers a minimal amount of syntax sugar:
- Lambda abstractions - Lambda abstractions
- List, Integer, and String literals - List, Integer, and String literals
This is an active experimentation project by someone who has no idea what they're doing. This is an active experimentation project by [someone who has no idea what they're doing](https://eversole.co).
## Acknowledgements ## Acknowledgements
Tree Calculus was discovered by [Barry Jay](https://github.com/barry-jay-personal/blog). Tree Calculus was discovered by [Barry Jay](https://github.com/barry-jay-personal/blog).
[treecalcul.us](https://treecalcul.us) is an excellent website with an intuitive playground created by [Johannes Bader](https://johannes-bader.com/) that introduced me to Tree Calculus. If sapling sounds interesting but you don't want to figure out how to compile Haskell, check his site out. [treecalcul.us](https://treecalcul.us) is an excellent website with an intuitive playground created by [Johannes Bader](https://johannes-bader.com/) that introduced me to Tree Calculus. If sapling sounds interesting but compiling this repo sounds like a hassle, you should check out his site.

View File

@ -41,26 +41,5 @@
}; };
devShell = self.devShells.${system}.default; devShell = self.devShells.${system}.default;
packages.${containerPackageName} = pkgs.dockerTools.buildImage {
name = "sapling";
copyToRoot = pkgs.buildEnv {
name = "image-root";
paths = [ sapling ];
pathsToLink = [ "/bin" ];
};
tag = "latest";
config = {
Cmd = [
"/bin/sapling"
];
WorkingDir = "/app";
ExposedPorts = {
"3000/tcp" = {};
};
extraCommands = ''
'';
};
};
}); });
} }

View File

@ -2,7 +2,7 @@ cabal-version: 1.12
name: sapling name: sapling
version: 0.0.1 version: 0.0.1
description: Tree Calculus Experiment description: Tree Calculus experiment repository
author: James Eversole author: James Eversole
maintainer: james@eversole.co maintainer: james@eversole.co
copyright: James Eversole copyright: James Eversole
@ -10,8 +10,7 @@ license: ISC
license-file: LICENSE license-file: LICENSE
build-type: Simple build-type: Simple
extra-source-files: extra-source-files:
README README.md
ChangeLog.md
executable sapling executable sapling
main-is: Main.hs main-is: Main.hs

View File

@ -5,10 +5,7 @@ import Control.Monad.State
import qualified Data.Map as Map import qualified Data.Map as Map
import Data.Map (Map) import Data.Map (Map)
data T data T = Leaf | Stem T | Fork T T
= Leaf -- t
| Stem T -- t t
| Fork T T -- t a b
deriving (Show, Eq, Ord) deriving (Show, Eq, Ord)
apply :: T -> T -> T apply :: T -> T -> T
@ -40,14 +37,6 @@ _K = Stem Leaf
_I :: T _I :: T
_I = apply (apply _S _K) _K -- Fork (Stem (Stem Leaf)) (Stem Leaf) _I = apply (apply _S _K) _K -- Fork (Stem (Stem Leaf)) (Stem Leaf)
-- Lambda
data Lambda
= Var String
| App Lambda Lambda
| Lam String Lambda
| TC T
deriving (Show, Eq)
-- Booleans -- Booleans
_false :: T _false :: T
_false = Leaf _false = Leaf