on master help sign in
Update code rendering to start with a ByteString

May be possible to make things more efficient by slicing up the ByteString differently, maybe delaying the allocation of [Char] unless it is absolutely needed. Would need some profiling to know if it matters at all.

commit5b0204d8427c4481b6ce4f3a519b7558cb0a2409 authorEvan Czaplicki <evancz@users.noreply.github.com> dateTue 30 Apr 2019, 18:30 (8 years ago) parentab2b2b8
1 file changed+4−2
compiler/src/Reporting/Render/Code.hs+4−2
compiler/src/Reporting/Render/Code.hs+4−2
@@ -10,6 +10,8 @@ module Reporting.Render.Code
1010 where
1111
1212
13+import qualified Data.ByteString as B
14+import qualified Data.ByteString.UTF8 as UTF8_BS
1315import qualified Data.List as List
1416import Data.Word (Word16)
1517
@@ -26,10 +28,10 @@ newtype Source =
2628 Source [(Word16, String)]
2729
2830
29−toSource :: String -> Source
31+toSource :: B.ByteString -> Source
3032toSource source =
3133 Source $ zip [1..] $
32− lines source ++ [""]
34+ lines (UTF8_BS.toString source) ++ [""]
3335
3436
3537