Update README and REPL formatting for list outputs
This commit is contained in:
parent
d804a114bb
commit
14b95f90b5
21
README.md
21
README.md
@ -17,24 +17,25 @@ This is an active experimentation project by [someone who has no idea what they'
|
|||||||
|
|
||||||
```
|
```
|
||||||
false = t
|
false = t
|
||||||
|
_ = t
|
||||||
true = t t
|
true = t t
|
||||||
id = (\\a : a)
|
id = (\a : a)
|
||||||
triage = (\\a b c : t (t a b) c)
|
triage = (\a b c : t (t a b) c)
|
||||||
match_bool = (\\ot of : triage of (\\z : ot) t)
|
match_bool = (\ot of : triage of (\_ : ot) t)
|
||||||
and = match_bool id (\\z : false)
|
and = match_bool id (\_ : false)
|
||||||
if = (\\cond then else : t (t else (t t then)) t cond)
|
if = (\cond then else : t (t else (t t then)) t cond)
|
||||||
triage = (\\a b c : t (t a b) c)
|
triage = (\a b c : t (t a b) c)
|
||||||
test = triage \"leaf\" (\\z : \"stem\") (\\a b : \"fork\")
|
test = triage "leaf" (\_ : "stem") (\_ _ : "fork")
|
||||||
|
|
||||||
|
-- The REPL outputs the tree form results by default; they are elided here.
|
||||||
sapling < test t
|
sapling < test t
|
||||||
sapling > Fork (...)
|
|
||||||
DECODE -: "leaf"
|
DECODE -: "leaf"
|
||||||
sapling < test (t t)
|
sapling < test (t t)
|
||||||
sapling > Fork (...)
|
|
||||||
DECODE -: "stem"
|
DECODE -: "stem"
|
||||||
sapling < test (t t t)
|
sapling < test (t t t)
|
||||||
sapling > Fork (...)
|
|
||||||
DECODE -: "fork"
|
DECODE -: "fork"
|
||||||
|
sapling < map (\i : listConcat i " is super cool!") [("He") ("She") ("Everybody")]
|
||||||
|
DECODE -: ["He is super cool!", "She is super cool!", "Everybody is super cool!"]
|
||||||
```
|
```
|
||||||
|
|
||||||
## How to use
|
## How to use
|
||||||
|
@ -6,6 +6,7 @@ import Parser
|
|||||||
import Research
|
import Research
|
||||||
|
|
||||||
import Control.Monad (void)
|
import Control.Monad (void)
|
||||||
|
import Data.List (intercalate)
|
||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
import System.Console.Haskeline
|
import System.Console.Haskeline
|
||||||
import System.IO (hFlush, stdout)
|
import System.IO (hFlush, stdout)
|
||||||
@ -38,5 +39,5 @@ decodeResult tc = case ofNumber tc of
|
|||||||
Left _ -> case ofString tc of
|
Left _ -> case ofString tc of
|
||||||
Right str -> "\"" ++ str ++ "\""
|
Right str -> "\"" ++ str ++ "\""
|
||||||
Left _ -> case ofList tc of
|
Left _ -> case ofList tc of
|
||||||
Right list -> "[" ++ unlines (map decodeResult list) ++ "]"
|
Right list -> "[" ++ intercalate ", " (map decodeResult list) ++ "]"
|
||||||
Left _ -> ""
|
Left _ -> ""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user