|
1 | | -{-# LANGUAGE FlexibleContexts, FlexibleInstances, GeneralizedNewtypeDeriving, LambdaCase, MultiParamTypeClasses, NamedFieldPuns, RecordWildCards, TypeApplications, TypeOperators, UndecidableInstances #-} |
| 1 | +{-# LANGUAGE FlexibleContexts, FlexibleInstances, GeneralizedNewtypeDeriving, LambdaCase, MultiParamTypeClasses, NamedFieldPuns, OverloadedStrings, RecordWildCards, TypeApplications, TypeOperators, UndecidableInstances #-} |
2 | 2 | module Analysis.Concrete |
3 | 3 | ( Concrete(..) |
4 | 4 | , concrete |
@@ -29,7 +29,7 @@ import Data.Loc |
29 | 29 | import qualified Data.Map as Map |
30 | 30 | import Data.Monoid (Alt(..)) |
31 | 31 | import Data.Name |
32 | | -import Data.Text (Text, unpack) |
| 32 | +import Data.Text (Text, pack) |
33 | 33 | import Prelude hiding (fail) |
34 | 34 |
|
35 | 35 | type Precise = Int |
@@ -185,25 +185,25 @@ heapValueGraph h = heapGraph (const id) (const fromAddr) h |
185 | 185 | heapAddressGraph :: Heap -> G.Graph (EdgeType, Precise) |
186 | 186 | heapAddressGraph = heapGraph (\ addr v -> (Value v, addr)) (fmap G.vertex . (,) . either Edge Slot) |
187 | 187 |
|
188 | | -addressStyle :: Heap -> G.Style (EdgeType, Precise) String |
| 188 | +addressStyle :: Heap -> G.Style (EdgeType, Precise) Text |
189 | 189 | addressStyle heap = (G.defaultStyle vertex) { G.edgeAttributes } |
190 | | - where vertex (_, addr) = maybe (show addr <> " = ?") (((show addr <> " = ") <>) . fromConcrete) (IntMap.lookup addr heap) |
| 190 | + where vertex (_, addr) = maybe (pack (show addr) <> " = ?") (((pack (show addr) <> " = ") <>) . fromConcrete) (IntMap.lookup addr heap) |
191 | 191 | edgeAttributes _ (Slot name, _) = ["label" G.:= fromName name] |
192 | 192 | edgeAttributes _ (Edge Core.Import, _) = ["color" G.:= "blue"] |
193 | 193 | edgeAttributes _ (Edge Core.Lexical, _) = ["color" G.:= "green"] |
194 | 194 | edgeAttributes _ _ = [] |
195 | 195 | fromConcrete = \case |
196 | 196 | Unit -> "()" |
197 | | - Bool b -> show b |
198 | | - String s -> show s |
199 | | - Closure (Loc p (Span s e)) n _ _ -> "\\\\ " <> fromName n <> " [" <> unpack p <> ":" <> showPos s <> "-" <> showPos e <> "]" |
| 197 | + Bool b -> pack $ show b |
| 198 | + String s -> pack $ show s |
| 199 | + Closure (Loc p (Span s e)) n _ _ -> "\\\\ " <> fromName n <> " [" <> p <> ":" <> showPos s <> "-" <> showPos e <> "]" |
200 | 200 | Obj _ -> "{}" |
201 | | - showPos (Pos l c) = show l <> ":" <> show c |
| 201 | + showPos (Pos l c) = pack (show l) <> ":" <> pack (show c) |
202 | 202 | fromName (User s) = s |
203 | 203 | fromName (Gen sym) = fromGensym sym |
204 | | - fromName (Path p) = show p |
205 | | - fromGensym (Root s) = s |
206 | | - fromGensym (ss :/ (s, i)) = fromGensym ss <> "." <> s <> show i |
| 204 | + fromName (Path p) = pack $ show p |
| 205 | + fromGensym (Root s) = pack s |
| 206 | + fromGensym (ss :/ (s, i)) = fromGensym ss <> "." <> pack s <> pack (show i) |
207 | 207 |
|
208 | 208 | data EdgeType |
209 | 209 | = Edge Core.Edge |
|
0 commit comments