shrub/pkg/hs/proto/app/Main.hs

42 lines
891 B
Haskell
Raw Normal View History

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