on master help sign in
Use ByteStrings in Kernel chunks

This will get put in the big .elmo files for whole packages. It will eventually be used to produce ByteStrings, so it makes sense to only do the conversion once while making the big object file.

commit3db3bdff5db729a755e9ea3b512393639469c939 authorEvan Czaplicki <evancz@users.noreply.github.com> dateMon 15 May 2017, 23:48 (9 years ago) parente2a5157
2 files changed+6−3
src/Parse/Kernel.hs+2−1 src/Parse/Primitives.hs+4−2
src/Parse/Kernel.hs+2−1
@@ -6,6 +6,7 @@ module Parse.Kernel
66 )
77 where
88
9+import qualified Data.ByteString as BS
910import qualified Data.Map as Map
1011import Data.Monoid ((<>))
1112import Data.Text (Text)
@@ -25,7 +26,7 @@ import qualified Reporting.Annotation as A
2526
2627
2728data Chunk
28− = JS Text
29+ = JS BS.ByteString
2930 | Var Module.Raw Text
3031
3132
src/Parse/Primitives.hs+4−2
@@ -22,12 +22,14 @@ module Parse.Primitives
2222import Prelude hiding (length)
2323import qualified Control.Applicative as Applicative ( Applicative(..), Alternative(..) )
2424import Control.Monad
25+import qualified Data.ByteString as BS
2526import qualified Data.Char as Char
2627import Data.Monoid ((<>))
2728import qualified Data.Set as Set
2829import Data.Text (Text)
2930import qualified Data.Text as Text
3031import qualified Data.Text.Array as Text
32+import qualified Data.Text.Encoding as Text
3133import qualified Data.Text.Internal as Text
3234import qualified Data.Text.Unsafe as Text
3335import qualified Data.Text.Lazy as LT
@@ -1305,7 +1307,7 @@ eatShader array offset length row col =
13051307-- KERNEL CHOMP
13061308
13071309
1308−kernelChunk :: Parser (Either Text (Text, Text))
1310+kernelChunk :: Parser (Either BS.ByteString (BS.ByteString, Text))
13091311kernelChunk =
13101312 Parser $ \(State array offset length indent row col ctx) cok _ _ _ ->
13111313 let
@@ -1313,7 +1315,7 @@ kernelChunk =
13131315 kernelChunkHelp array offset length row col
13141316
13151317 javascript =
1316− Text.Text array offset (newOffset - offset)
1318+ Text.encodeUtf8 (Text.Text array offset (newOffset - offset))
13171319 in
13181320 if not isAtUnderscores then
13191321