urbit/pkg/proto/app/Main.hs

38 lines
770 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 Noun
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
pPrint cst
hon <- pure $ hone cst
pPrint hon
exp <- pure $ desugar hon
pPrint exp
nok <- pure $ copy exp
pPrint nok
res <- runCare $ nock (A 140) nok
pPrint res