driverslop
This commit is contained in:
@@ -27,6 +27,7 @@ import Gyehoek.Scheme.Syntax (Lit(LitInt))
|
||||
import Text.Printf
|
||||
import qualified Data.Text as T
|
||||
import qualified Data.Vector.Strict as V
|
||||
import Data.IntMap.Strict (IntMap)
|
||||
|
||||
|
||||
type Emit = Writer (Vector Text)
|
||||
@@ -64,6 +65,18 @@ tshow = T.pack . show
|
||||
|
||||
|
||||
|
||||
data Module = MkModule
|
||||
{ funcs :: IntMap Func
|
||||
}
|
||||
deriving (Show, Generic)
|
||||
|
||||
data Func = MkFunc
|
||||
{ code :: Text
|
||||
}
|
||||
deriving (Show, Generic)
|
||||
|
||||
|
||||
|
||||
lowerVal :: Env -> Val -> Vector Text
|
||||
|
||||
lowerVal g (ValLit l) =
|
||||
|
||||
+10
-2
@@ -8,7 +8,7 @@ module Main
|
||||
import Gyehoek.Options
|
||||
import qualified Data.Text.IO as TIO
|
||||
import Data.Text (Text)
|
||||
import Prelude hiding (readFile, (.),id)
|
||||
import Prelude hiding (readFile)
|
||||
import Options.Applicative
|
||||
import Control.Lens
|
||||
import Data.Generics.Labels
|
||||
@@ -50,8 +50,16 @@ hGetContents h = T.decodeUtf8 <$> FB.hGetContents h
|
||||
readFile :: FileSystem :> es => FilePath -> Eff es Text
|
||||
readFile f = FS.withFile f FS.ReadMode hGetContents
|
||||
|
||||
withFile
|
||||
:: (FileSystem :> es)
|
||||
=> FilePath -> FS.IOMode -> (Handle -> Eff es a) -> Eff es a
|
||||
withFile "-" _ k = k FS.stdin
|
||||
withFile f m k = FS.withFile f m k
|
||||
|
||||
readScm :: FileSystem :> es => FilePath -> Eff es (List Scm.Exp)
|
||||
readScm f = (Sexp.parseSexps f <$> readFile f) >>= either error pure
|
||||
readScm f =
|
||||
withFile f FS.ReadMode $ \h ->
|
||||
Sexp.parseSexps f <$> hGetContents h >>= either error pure
|
||||
|
||||
driver
|
||||
:: (GenSym :> es, FileSystem :> es, IOE :> es)
|
||||
|
||||
Reference in New Issue
Block a user