Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • compiler/GHC/Utils/Binary.hs
    ... ... @@ -150,6 +150,7 @@ import qualified Data.ByteString.Lazy as LBS
    150 150
     import qualified Data.ByteString.Internal as BS
    
    151 151
     import qualified Data.ByteString.Unsafe   as BS
    
    152 152
     import qualified Data.ByteString.Short.Internal as SBS
    
    153
    +import qualified Data.Text.Internal as T
    
    153 154
     import Data.IORef
    
    154 155
     import Data.Char                ( ord, chr )
    
    155 156
     import Data.List.NonEmpty       ( NonEmpty(..))
    
    ... ... @@ -1816,13 +1817,19 @@ putSBS :: WriteBinHandle -> SBS.ShortByteString -> IO ()
    1816 1817
     putSBS bh sbs = do
    
    1817 1818
       let l = SBS.length sbs
    
    1818 1819
       put_ bh l
    
    1819
    -  putPrim bh l (\p -> SBS.copyToPtr sbs 0 p l)
    
    1820
    +  putSBSOffLen bh sbs 0 l
    
    1820 1821
     
    
    1822
    +putSBSOffLen :: WriteBinHandle -> SBS.ShortByteString -> Int -> Int -> IO ()
    
    1823
    +putSBSOffLen bh sbs off len =
    
    1824
    +  putPrim bh len $ \p -> SBS.copyToPtr sbs off p len
    
    1821 1825
     
    
    1822 1826
     getSBS :: ReadBinHandle -> IO SBS.ShortByteString
    
    1823 1827
     getSBS bh = do
    
    1824 1828
       l <- get bh :: IO Int
    
    1825
    -  getPrim bh l (\src -> SBS.createFromPtr src l)
    
    1829
    +  getSBSLen bh l
    
    1830
    +
    
    1831
    +getSBSLen :: ReadBinHandle -> Int -> IO SBS.ShortByteString
    
    1832
    +getSBSLen bh len = getPrim bh len $ \src -> SBS.createFromPtr src len
    
    1826 1833
     
    
    1827 1834
     putBS :: WriteBinHandle -> ByteString -> IO ()
    
    1828 1835
     putBS bh bs =
    
    ... ... @@ -1856,6 +1863,16 @@ instance Binary LBS.ByteString where
    1856 1863
     
    
    1857 1864
       get bh = LBS.fromStrict <$> get bh
    
    1858 1865
     
    
    1866
    +instance Binary T.Text where
    
    1867
    +  put_ bh (T.Text ba off len) = do
    
    1868
    +    put_ bh len
    
    1869
    +    putSBSOffLen bh (SBS.ShortByteString ba) off len
    
    1870
    +
    
    1871
    +  get bh = do
    
    1872
    +    len <- get bh
    
    1873
    +    SBS.ShortByteString ba <- getSBSLen bh len
    
    1874
    +    pure $ T.Text ba 0 len
    
    1875
    +
    
    1859 1876
     instance Binary FastString where
    
    1860 1877
       put_ bh f =
    
    1861 1878
         case findUserDataWriter (Proxy :: Proxy FastString) bh of
    

  • compiler/ghc.cabal.in
    ... ... @@ -120,6 +120,7 @@ Library
    120 120
                        process    >= 1   && < 1.7,
    
    121 121
                        bytestring >= 0.11 && < 0.13,
    
    122 122
                        binary     == 0.8.*,
    
    123
    +                   text       >= 2.0 && < 2.2,
    
    123 124
                        time       >= 1.4 && < 1.16,
    
    124 125
                        containers >= 0.6.2.1 && < 0.9,
    
    125 126
                        array      >= 0.1 && < 0.6,