mirror of
https://github.com/unisonweb/unison.git
synced 2024-11-12 04:34:38 +03:00
compiles, but not hooked up to the codebase yet
This commit is contained in:
parent
e12bd6a4f7
commit
c2b7c56703
@ -10,10 +10,13 @@ import Text.RawString.QQ (r)
|
||||
import Unison.FileParsers (parseAndSynthesizeFile)
|
||||
import Unison.Parser (Ann(..))
|
||||
import Unison.Symbol (Symbol)
|
||||
import qualified Data.Map as Map
|
||||
import qualified Unison.Builtin as Builtin
|
||||
import qualified Unison.Reference as R
|
||||
import qualified Unison.Result as Result
|
||||
import qualified Unison.Typechecker.TypeLookup as TL
|
||||
import qualified Unison.UnisonFile as UF
|
||||
import qualified Unison.Var as Var
|
||||
|
||||
typecheckedFile :: UF.TypecheckedUnisonFile Symbol Ann
|
||||
typecheckedFile = let
|
||||
@ -25,6 +28,23 @@ typecheckedFile = let
|
||||
(Just (_ppe, Nothing), notes) -> error $ "typechecking failed" <> show notes
|
||||
(Just (_, Just file), _) -> file
|
||||
|
||||
typeNamed :: String -> R.Reference
|
||||
typeNamed s =
|
||||
case Map.lookup (Var.nameds s) (UF.dataDeclarations' typecheckedFile) of
|
||||
Nothing -> error $ "No builtin type called: " <> s
|
||||
Just (r, _) -> r
|
||||
|
||||
abilityNamed :: String -> R.Reference
|
||||
abilityNamed s =
|
||||
case Map.lookup (Var.nameds s) (UF.effectDeclarations' typecheckedFile) of
|
||||
Nothing -> error $ "No builtin ability called: " <> s
|
||||
Just (r, _) -> r
|
||||
|
||||
ioReference, bufferModeReference :: R.Reference
|
||||
ioReference = abilityNamed "IO"
|
||||
bufferModeReference = typeNamed "BufferMode"
|
||||
-- .. todo - fill in the rest of these
|
||||
|
||||
source :: Text
|
||||
source = fromString [r|
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user