mirror of
https://github.com/github/semantic.git
synced 2024-12-24 23:42:31 +03:00
Use Text for gensym’d names.
This commit is contained in:
parent
06e3c7f0be
commit
e9968caa45
@ -202,8 +202,8 @@ addressStyle heap = (G.defaultStyle vertex) { G.edgeAttributes }
|
||||
fromName (User s) = s
|
||||
fromName (Gen sym) = fromGensym sym
|
||||
fromName (Path p) = pack $ show p
|
||||
fromGensym (Root s) = pack s
|
||||
fromGensym (ss :/ (s, i)) = fromGensym ss <> "." <> pack s <> pack (show i)
|
||||
fromGensym (Root s) = s
|
||||
fromGensym (ss :/ (s, i)) = fromGensym ss <> "." <> s <> pack (show i)
|
||||
|
||||
data EdgeType
|
||||
= Edge Core.Edge
|
||||
|
@ -1,4 +1,4 @@
|
||||
{-# LANGUAGE FlexibleContexts, ScopedTypeVariables #-}
|
||||
{-# LANGUAGE FlexibleContexts, OverloadedStrings, ScopedTypeVariables #-}
|
||||
module Analysis.FlowInsensitive
|
||||
( Heap
|
||||
, FrameId(..)
|
||||
|
@ -1,4 +1,4 @@
|
||||
{-# LANGUAGE FlexibleContexts, RecordWildCards #-}
|
||||
{-# LANGUAGE FlexibleContexts, OverloadedStrings, RecordWildCards #-}
|
||||
module Analysis.ImportGraph
|
||||
( ImportGraph
|
||||
, importGraph
|
||||
|
@ -1,4 +1,4 @@
|
||||
{-# LANGUAGE DeriveFunctor, FlexibleContexts, FlexibleInstances, LambdaCase, RecordWildCards, ScopedTypeVariables, TypeApplications #-}
|
||||
{-# LANGUAGE DeriveFunctor, FlexibleContexts, FlexibleInstances, LambdaCase, OverloadedStrings, RecordWildCards, ScopedTypeVariables, TypeApplications #-}
|
||||
module Analysis.Typecheck
|
||||
( Monotype (..)
|
||||
, Meta
|
||||
|
@ -77,8 +77,8 @@ isSimpleCharacter = \case
|
||||
c -> Char.isAlphaNum c
|
||||
|
||||
data Gensym
|
||||
= Root String
|
||||
| Gensym :/ (String, Int)
|
||||
= Root Text
|
||||
| Gensym :/ (Text, Int)
|
||||
deriving (Eq, Ord, Show)
|
||||
|
||||
instance Pretty Gensym where
|
||||
@ -86,21 +86,21 @@ instance Pretty Gensym where
|
||||
Root s -> pretty s
|
||||
p :/ (n, x) -> Pretty.hcat [pretty p, "/", pretty n, "^", pretty x]
|
||||
|
||||
(//) :: Gensym -> String -> Gensym
|
||||
(//) :: Gensym -> Text -> Gensym
|
||||
root // s = root :/ (s, 0)
|
||||
|
||||
infixl 6 //
|
||||
|
||||
gensym :: (Carrier sig m, Member Naming sig) => String -> m Gensym
|
||||
gensym :: (Carrier sig m, Member Naming sig) => Text -> m Gensym
|
||||
gensym s = send (Gensym s pure)
|
||||
|
||||
namespace :: (Carrier sig m, Member Naming sig) => String -> m a -> m a
|
||||
namespace :: (Carrier sig m, Member Naming sig) => Text -> m a -> m a
|
||||
namespace s m = send (Namespace s m pure)
|
||||
|
||||
|
||||
data Naming m k
|
||||
= Gensym String (Gensym -> k)
|
||||
| forall a . Namespace String (m a) (a -> k)
|
||||
= Gensym Text (Gensym -> k)
|
||||
| forall a . Namespace Text (m a) (a -> k)
|
||||
|
||||
deriving instance Functor (Naming m)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user