packages feed

semantic-source 0.0.0.1 → 0.0.1.0

raw patch · 3 files changed

+17/−8 lines, 3 files

Files

CHANGELOG.md view
@@ -1,3 +1,10 @@+# 0.0.1.0++- Adds an `NFData` instance for `Source`.++- Decodes to `Text` leniently instead of throwing exceptions.++ # 0.0.0.1  - Loosens the upper bound on `hashable`.
semantic-source.cabal view
@@ -1,7 +1,7 @@ cabal-version:       2.4  name:                semantic-source-version:             0.0.0.1+version:             0.0.1.0 synopsis:            Types and functionality for working with source code description:         Types and functionality for working with source code (program text). homepage:            https://github.com/github/semantic/tree/master/semantic-source#readme@@ -22,7 +22,7 @@   GHC == 8.6.5   GHC == 8.8.1 -common common+common haskell   default-language: Haskell2010   ghc-options:     -Weverything@@ -40,7 +40,7 @@     ghc-options: -Wno-missing-deriving-strategies  library-  import: common+  import: haskell   exposed-modules:     Source.Loc     Source.Range@@ -58,7 +58,7 @@   hs-source-dirs: src  test-suite doctest-  import: common+  import: haskell   type: exitcode-stdio-1.0   main-is: Doctest.hs   build-depends:@@ -69,8 +69,9 @@   hs-source-dirs: test  test-suite test-  import: common+  import: haskell   type: exitcode-stdio-1.0+  hs-source-dirs: test   main-is: Test.hs   other-modules:     Source.Test@@ -82,7 +83,6 @@     , tasty-hedgehog  ^>= 1.0.0.1     , tasty-hunit      >= 0.10 && <1     , text-  hs-source-dirs: test  source-repository head   type:     git
src/Source/Source.hs view
@@ -32,6 +32,7 @@ import Prelude hiding (drop, take)  import           Control.Arrow ((&&&))+import           Control.DeepSeq (NFData) import           Data.Aeson (FromJSON (..), withText) import qualified Data.ByteString as B import           Data.Char (ord)@@ -41,6 +42,7 @@ import           Data.String (IsString (..)) import qualified Data.Text as T import qualified Data.Text.Encoding as T+import           Data.Text.Encoding.Error (lenientDecode) import           GHC.Generics (Generic) import           Source.Range import           Source.Span (Span(Span), Pos(..))@@ -50,7 +52,7 @@ -- 'ByteString' under the hood. Construct these with 'fromUTF8'; obviously, -- passing 'fromUTF8' non-UTF8 bytes will cause crashes. newtype Source = Source { bytes :: B.ByteString }-  deriving (Eq, Semigroup, Monoid, IsString, Show, Generic)+  deriving (Eq, Semigroup, Monoid, IsString, Show, Generic, NFData)  fromUTF8 :: B.ByteString -> Source fromUTF8 = Source@@ -86,7 +88,7 @@  -- | Return the Text contained in the 'Source'. toText :: Source -> T.Text-toText = T.decodeUtf8 . bytes+toText = T.decodeUtf8With lenientDecode . bytes   -- Slicing