shrub/pkg/hs/proto/app/Main.hs
2019-12-19 08:11:59 -08:00

42 lines
891 B
Haskell

module Main where
import ClassyPrelude
import Control.Lens ((&))
import Untyped.Parser hiding (main)
import Untyped.CST
import Untyped.Hoon
import Untyped.Core
import Nock
import SimpleNoun
import Dashboard
import Text.Show.Pretty (pPrint)
import qualified Prelude as P
-------------------------------------------------------------------------------
main :: IO ()
main = (P.head <$> getArgs) >>= compileHoonTest
compileHoonTest :: Text -> IO ()
compileHoonTest ln = do
cst <- parse ln & \case
Left x -> error (unpack x)
Right x -> pure x
-- pPrint cst
hon <- pure $ hone cst
pPrint hon
exp <- pure $ desugar hon
pPrint exp
nok <- pure $ copy exp
putStrLn "==== input ===="
putStrLn ln
putStrLn "==== nock ===="
pPrint nok
putStrLn "==== output ===="
res <- runCare $ nock (A 140) nok
pPrint res