hnock

A Nock interpreter.
git clone git://git.jtobin.io/hnock.git
Log | Files | Refs | README | LICENSE

Nock.hs (493B)


      1 {-# OPTIONS_GHC -Wall #-}
      2 
      3 module Nock (
      4     module L
      5   , module P
      6 
      7   , nock
      8   , hnock
      9 
     10   , E.eval
     11   ) where
     12 
     13 import Data.Text as T
     14 import qualified Nock.Eval as E
     15 import Nock.Language as L
     16 import Nock.Parse as P
     17 
     18 hnock :: T.Text -> Noun
     19 hnock input = case P.parse input of
     20   Left perr -> error (show perr)
     21   Right ex  -> case E.eval ex of
     22     Left err -> error (show err)
     23     Right e  -> e
     24 
     25 nock :: Noun -> Noun
     26 nock noun = case E.nock noun of
     27   Left err -> error (show err)
     28   Right e  -> e
     29