Skip to content

Commit

Permalink
GMap examples: fix encoding issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
debug-ito committed Nov 15, 2022
1 parent 1529a83 commit 1ce8608
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions greskell-core/greskell-core.cabal
Expand Up @@ -39,7 +39,8 @@ library
semigroups >=0.18.2 && <0.21,
vector >=0.12.0.1 && <0.14,
containers >=0.5.7.1 && <0.7,
uuid >=1.3.13 && <1.4
uuid >=1.3.13 && <1.4,
bytestring >=0.10.8.1 && <0.12

test-suite spec
type: exitcode-stdio-1.0
Expand All @@ -55,11 +56,10 @@ test-suite spec
Data.Greskell.Test.QuickCheck,
ExamplesSpec
build-tool-depends: hspec-discover:hspec-discover
build-depends: base, text, aeson, unordered-containers, vector,
build-depends: base, text, aeson, unordered-containers, vector, bytestring,
greskell-core,
hspec >=2.2.3,
QuickCheck >=2.8.2 && <2.15,
bytestring >=0.10.8.1 && <0.12
QuickCheck >=2.8.2 && <2.15

test-suite doctest
type: exitcode-stdio-1.0
Expand Down
3 changes: 2 additions & 1 deletion greskell-core/src/Data/Greskell/GMap.hs
Expand Up @@ -40,6 +40,7 @@ import qualified Data.Aeson.Key as Key
import Data.Aeson.KeyMap (KeyMap)
import qualified Data.Aeson.KeyMap as KM
import Data.Aeson.Types (Parser)
import qualified Data.ByteString.Lazy.Char8 as BSLC8
import Data.Either (isLeft)
import Data.Foldable (Foldable, length)
import Data.Hashable (Hashable)
Expand Down Expand Up @@ -310,7 +311,7 @@ examples = forFlattenedMap
forFlattenedMap =
[ (show $ fmap toSortedList $ decode "[10, \"ten\", 11, \"eleven\"]", "Right [(10,\"ten\"),(11,\"eleven\")]")
, (show $ fmap toSortedList $ decode "[]", "Right []")
, (show $ Aeson.encode $ FlattenedMap $ (HashMap.fromList [(10, "ten")] :: HashMap Int String), "[10,\"ten\"]")
, (BSLC8.unpack $ Aeson.encode $ FlattenedMap $ (HashMap.fromList [(10, "ten")] :: HashMap Int String), "[10,\"ten\"]")

-- >>> let (Left err_msg) = decode "[10, \"ten\", 11]"
-- >>> err_msg
Expand Down

0 comments on commit 1ce8608

Please sign in to comment.