This repository was archived by the owner on Apr 1, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +13
-8
lines changed
Expand file tree Collapse file tree 6 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ library
4747 , prettyprinter-ansi-terminal ^>= 1.1.1
4848 , recursion-schemes ^>= 5.1
4949 , semigroupoids ^>= 5.3
50+ , text ^>= 1.2.3.1
5051 , transformers ^>= 0.5.6
5152 , trifecta ^>= 2
5253 , unordered-containers ^>= 0.2.10
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ import Data.Loc
2929import qualified Data.Map as Map
3030import Data.Monoid (Alt (.. ))
3131import Data.Name
32+ import Data.Text (Text )
3233import Prelude hiding (fail )
3334
3435type Precise = Int
@@ -41,7 +42,7 @@ data Concrete
4142 = Closure Loc Name Core. Core Precise
4243 | Unit
4344 | Bool Bool
44- | String String
45+ | String Text
4546 | Obj Frame
4647 deriving (Eq , Ord , Show )
4748
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import Data.Functor
2121import Data.Loc
2222import Data.Maybe (fromJust )
2323import Data.Name
24+ import Data.Text (Text , unpack )
2425import GHC.Stack
2526import Prelude hiding (fail )
2627
@@ -42,7 +43,7 @@ eval Analysis{..} eval = \case
4243 String s -> string s
4344 Load p -> do
4445 path <- eval p >>= asString
45- lookupEnv' (Path path) >>= deref' (Path path)
46+ lookupEnv' (Path (unpack path)) >>= deref' (Path (unpack path) )
4647 Edge e a -> ref a >>= edge e >> unit
4748 Frame -> frame
4849 a :. b -> do
@@ -207,8 +208,8 @@ data Analysis address value m = Analysis
207208 , unit :: m value
208209 , bool :: Bool -> m value
209210 , asBool :: value -> m Bool
210- , string :: String -> m value -- FIXME: Text
211- , asString :: value -> m String
211+ , string :: Text -> m value -- FIXME: Text
212+ , asString :: value -> m Text
212213 , frame :: m value
213214 , edge :: Edge -> address -> m ()
214215 , (...) :: forall a . address -> m a -> m a
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import Data.Loc
2222import qualified Data.Map as Map
2323import Data.Name
2424import qualified Data.Set as Set
25+ import Data.Text (Text )
2526import Prelude hiding (fail )
2627
2728type ImportGraph = Map. Map FilePath (Set. Set FilePath )
@@ -41,7 +42,7 @@ instance Monoid Value where
4142data Semi
4243 = Closure Loc Name Core. Core Name
4344 -- FIXME: Bound String values.
44- | String String
45+ | String Text
4546 | Abstract
4647 deriving (Eq , Ord , Show )
4748
@@ -98,7 +99,7 @@ importGraphAnalysis = Analysis{..}
9899 asBool _ = pure True <|> pure False
99100 string s = pure (Value (String s) mempty )
100101 asString (Value (String s) _) = pure s
101- asString _ = pure " "
102+ asString _ = pure mempty
102103 frame = pure mempty
103104 edge Core. Import (Path to) = do
104105 Loc {locPath= from} <- ask
Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ typecheckingAnalysis = Analysis{..}
160160 bool _ = pure MBool
161161 asBool b = unify MBool b >> pure True <|> pure False
162162 string _ = pure MString
163- asString s = unify MString s *> pure " "
163+ asString s = unify MString s *> pure mempty
164164 frame = fail " unimplemented"
165165 edge _ _ = pure ()
166166 _ ... m = m
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import Data.Foldable (foldl')
2020import Data.Loc
2121import Data.Name
2222import Data.Stack
23+ import Data.Text (Text )
2324import GHC.Stack
2425
2526data Edge = Lexical | Import
@@ -36,7 +37,7 @@ data Core
3637 | Unit
3738 | Bool Bool
3839 | If Core Core Core
39- | String String -- FIXME: Text
40+ | String Text
4041 -- | Load the specified file (by path).
4142 | Load Core
4243 | Edge Edge Core
You can’t perform that action at this time.
0 commit comments