git.iko.soy/typeable/hjsonpointer
on master help sign in
0.3.0.0 - rewrite.
commit59434d8b8102a4a0b8201db65dd91bc88e06890a authorIan Grant Jeffries <ian@housejeffries.com> dateFri 19 Feb 2016, 16:47 (11 years ago) parent05c967e
9 files changed+363−173
.travis.yml+81 Example.hs+30 README.md+28−11 changelog.md+13 changelog.txt−9 hjsonpointer.cabal+20−8 src/Data/Aeson/Pointer.hs+122 src/Data/JsonPointer.hs−79 tests/Unit.hs+69−66
.travis.ymlnew file+81
@@ -0,0 +1,81 @@
1+# This file has been generated -- see https://github.com/hvr/multi-ghc-travis
2+#
3+# Manually modified to remove cabal check. I don't want a description field.
4+
5+language: c
6+sudo: false
7+
8+cache:
9+ directories:
10+ - $HOME/.cabsnap
11+ - $HOME/.cabal/packages
12+
13+before_cache:
14+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
15+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar
16+
17+matrix:
18+ include:
19+ - env: CABALVER=1.18 GHCVER=7.8.4
20+ compiler: ": #GHC 7.8.4"
21+ addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}}
22+ - env: CABALVER=1.22 GHCVER=7.10.2
23+ compiler: ": #GHC 7.10.2"
24+ addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2], sources: [hvr-ghc]}}
25+
26+before_install:
27+ - unset CC
28+ - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
29+
30+install:
31+ - cabal --version
32+ - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
33+ - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];
34+ then
35+ zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >
36+ $HOME/.cabal/packages/hackage.haskell.org/00-index.tar;
37+ fi
38+ - travis_retry cabal update -v
39+ - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config
40+ - cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt
41+ - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt
42+
43+# check whether current requested install-plan matches cached package-db snapshot
44+ - if diff -u installplan.txt $HOME/.cabsnap/installplan.txt;
45+ then
46+ echo "cabal build-cache HIT";
47+ rm -rfv .ghc;
48+ cp -a $HOME/.cabsnap/ghc $HOME/.ghc;
49+ cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;
50+ else
51+ echo "cabal build-cache MISS";
52+ rm -rf $HOME/.cabsnap;
53+ mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;
54+ cabal install --only-dependencies --enable-tests --enable-benchmarks;
55+ fi
56+
57+# snapshot package-db on cache miss
58+ - if [ ! -d $HOME/.cabsnap ];
59+ then
60+ echo "snapshotting package-db to build-cache";
61+ mkdir $HOME/.cabsnap;
62+ cp -a $HOME/.ghc $HOME/.cabsnap/ghc;
63+ cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;
64+ fi
65+
66+# Here starts the actual work to be performed for the package under test;
67+# any command which exits with a non-zero exit code causes the build to fail.
68+script:
69+ - if [ -f configure.ac ]; then autoreconf -i; fi
70+ - cabal configure --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging
71+ - cabal build # this builds all libraries and executables (including tests/benchmarks)
72+ - cabal test
73+ - cabal sdist # tests that a source-distribution can be generated
74+
75+# Check that the resulting source distribution can be built & installed.
76+# If there are no other `.tar.gz` files in `dist`, this can be even simpler:
77+# `cabal install --force-reinstalls dist/*-*.tar.gz`
78+ - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&
79+ (cd dist && cabal install --force-reinstalls "$SRC_TGZ")
80+
81+# EOF
Example.hsnew file+30
@@ -0,0 +1,30 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+
3+module Main where
4+
5+import Control.Monad (unless)
6+import Data.Aeson
7+import qualified Data.Aeson.Pointer as P
8+
9+main :: IO ()
10+main = do
11+ -- JSON Pointers must either be empty or start with a /.
12+ pntr1 <- case P.unescape "/foo/0" of
13+ Left _ -> error "Failed to construct JSON Pointer."
14+ Right pntr -> return pntr
15+
16+ -- We can also write JSON Pointers in Haskell.
17+ let pntr2 = P.Pointer [P.Token "/"]
18+ -- When we do this we don't have to escape / or ~ characters
19+ -- (as ~1 and ~0 respectively) like we do in an escaped JSON
20+ -- Pointer string.
21+ unless (P.unescape "/~1" == Right pntr2) (error "ohno!")
22+
23+ print (P.resolve pntr1 document)
24+ print (P.resolve pntr2 document)
25+
26+ where
27+ document :: Value
28+ document = object [ "foo" .= [String "bar", String "baz"]
29+ , "/" .= String "quux"
30+ ]
README.md+28−11
@@ -2,28 +2,45 @@
22
33[JSON Pointer](http://tools.ietf.org/html/rfc6901) library for Haskell.
44
5+[Hackage](https://hackage.haskell.org/package/hjsonpointer) / [GitHub](https://github.com/seagreen/hjsonpointer) / [Travis CI](https://travis-ci.org/seagreen/hjsonpointer)
6+
57# Example
68
7−```
9+```haskell
810{-# LANGUAGE OverloadedStrings #-}
911
1012module Main where
1113
14+import Control.Monad (unless)
1215import Data.Aeson
13−import qualified Data.HashMap.Strict as H
14−import Data.JsonPointer
16+import qualified Data.Aeson.Pointer as P
1517
1618main :: IO ()
17−main =
18− case jsonPointer "/foo" of
19− Left e -> print e
20− Right pntr ->
21− case resolvePointer pntr (Object $ H.singleton "foo" $ String "bar") of
22− Left e2 -> print e2
23− Right v -> print v
19+main = do
20+ -- JSON Pointers must either be empty or start with a /.
21+ pntr1 <- case P.unescape "/foo/0" of
22+ Left _ -> error "Failed to construct JSON Pointer."
23+ Right pntr -> pure pntr
24+
25+ -- We can also write JSON Pointers in Haskell.
26+ let pntr2 = P.Pointer [P.Token "/"]
27+ -- When we do this we don't have to escape / or ~ characters
28+ -- (as ~1 and ~0 respectively) like we do in an escaped JSON
29+ -- Pointer string.
30+ unless (P.unescape "/~1" == Right pntr2) (error "ohno!")
31+
32+ print (P.resolve pntr1 document)
33+ print (P.resolve pntr2 document)
34+
35+ where
36+ document :: Value
37+ document = object [ "foo" .= [String "bar", String "baz"]
38+ , "/" .= String "quux"
39+ ]
2440```
2541
2642Output:
2743```
28−String "bar"
44+Right (String "bar")
45+Right (String "quux")
2946```
changelog.mdnew file+13
@@ -0,0 +1,13 @@
1+# 0.3
2+
3++ Rewrite.
4+
5+# 0.2
6+
7++ Fix mistake in `resolveRefTok`.
8++ Split errors over two types.
9++ Switch the order of pointer and value arguments for functions that take both. The pointer now comes first.
10+
11+# 0.1
12+
13++ Initial implementation.
changelog.txtdeleted−9
@@ -1,9 +0,0 @@
1−# 0.2
2−
3−Fix mistake in resolveRefTok.
4−Split errors over two types.
5−Switch the order of pointer and value arguments for functions that take both. The pointer now comes first.
6−
7−# 0.1
8−
9−Initial implementation.
hjsonpointer.cabal+20−8
@@ -1,5 +1,5 @@
11name: hjsonpointer
2−version: 0.2.0.4
2+version: 0.3.0.0
33synopsis: JSON Pointer library
44homepage: https://github.com/seagreen/hjsonpointer
55license: MIT
@@ -9,17 +9,20 @@ maintainer: ian@housejeffries.com
99category: Data
1010build-type: Simple
1111cabal-version: >=1.10
12−extra-source-files: changelog.txt
12+tested-with: GHC == 7.8.4, GHC == 7.10.3
13+extra-source-files: changelog.md
1314 README.md
1415
1516library
1617 hs-source-dirs: src
17− exposed-modules: Data.JsonPointer
18+ exposed-modules: Data.Aeson.Pointer
1819 default-language: Haskell2010
1920 default-extensions: OverloadedStrings
21+ other-extensions: GeneralizedNewtypeDeriving
2022 ghc-options: -Wall
21− build-depends: aeson >= 0.7 && < 0.10
23+ build-depends: aeson >= 0.7 && < 0.12
2224 , base >= 4.6 && < 4.9
25+ , QuickCheck >= 2.8 && < 2.9
2326 , unordered-containers >= 0.2 && < 0.3
2427 , text >= 1.2 && < 1.3
2528 , vector >= 0.10 && < 0.12
@@ -37,10 +40,19 @@ test-suite unit
3740 , unordered-containers
3841 , text
3942 , vector
40− , http-types >= 0.8 && < 0.9
41− , HUnit >= 1.2 && < 1.4
42− , test-framework >= 0.8 && < 0.9
43− , test-framework-hunit >= 0.3 && < 0.4
43+ , http-types >= 0.8 && < 0.10
44+ , HUnit >= 1.2 && < 1.4
45+ , test-framework >= 0.8 && < 0.9
46+ , test-framework-hunit >= 0.3 && < 0.4
47+ , test-framework-quickcheck2 >= 0.3 && < 0.4
48+
49+executable example
50+ main-is: Example.hs
51+ default-language: Haskell2010
52+ ghc-options: -Wall
53+ build-depends: aeson
54+ , base
55+ , hjsonpointer
4456
4557source-repository head
4658 type: git
src/Data/Aeson/Pointer.hsnew file+122
@@ -0,0 +1,122 @@
1+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
2+
3+module Data.Aeson.Pointer where
4+
5+import Control.Monad (when)
6+import Data.Aeson
7+import qualified Data.HashMap.Strict as H
8+import Data.Text (Text)
9+import qualified Data.Text as T
10+import qualified Data.Vector as V
11+import Test.QuickCheck
12+import Text.Read (readMaybe)
13+
14+-- For GHCs before 7.10:
15+import Control.Applicative
16+import Data.Monoid
17+import Data.Traversable
18+
19+newtype Pointer
20+ = Pointer { _unPointer :: [Token] }
21+ deriving (Eq, Show, Monoid, Arbitrary)
22+
23+instance FromJSON Pointer where
24+ parseJSON = withText "JSON Pointer" $ \t ->
25+ case unescape t of
26+ Left e -> fail (show e)
27+ Right p -> pure p
28+
29+instance ToJSON Pointer where
30+ toJSON = String . escape
31+
32+-- | We don't try to distinguish between integer tokens and string
33+-- tokens since all tokens start as strings, and all tokens can
34+-- be used to resolve JSON objects.
35+newtype Token = Token { _unToken :: Text } deriving (Eq, Show)
36+
37+instance Arbitrary Token where
38+ arbitrary = Token . T.pack <$> arbitrary
39+
40+escape :: Pointer -> Text
41+escape (Pointer []) = ""
42+escape (Pointer ts) =
43+ T.cons '/'
44+ . T.intercalate "/"
45+ . fmap (T.replace "/" "~1" . T.replace "~" "~0" . _unToken)
46+ $ ts
47+
48+-- * Unescaping
49+
50+data FormatError
51+ = InvalidFirstChar
52+ -- ^ JSON Pointers must either be empty or start with a @/@.
53+ | UnescapedTilde
54+ deriving (Eq, Show)
55+
56+
57+-- | JSON Pointers must either be empty or start with a @/@. This means
58+-- that if you're turning a URI Fragment into a JSON Pointer you must
59+-- drop the initial @#@.
60+--
61+-- Note that the unescaping happening here is not the same as URI
62+-- decoding. If you are turning a URI fragment into a JSON Pointer you
63+-- must URI decode the 'Text' before using it as an argument to this
64+-- function. There's an example of how to do this in the tests using
65+-- "Network.HTTP.Types.URI.urlDecode" from http-types.
66+unescape :: Text -> Either FormatError Pointer
67+unescape txt =
68+ case T.splitOn "/" txt of
69+ [] -> Right (Pointer [])
70+ "":xs -> Pointer <$> traverse f xs
71+ _ -> Left InvalidFirstChar
72+ where
73+ f :: Text -> Either FormatError Token
74+ f t = case unescapeToken t of
75+ Nothing -> Left UnescapedTilde
76+ Just tok -> Right tok
77+
78+-- | For internal use by 'unescape'.
79+unescapeToken :: Text -> Maybe Token
80+unescapeToken t
81+ | not (isValid t) = Nothing
82+ | otherwise = Just . Token . replace $ t
83+ where
84+ -- All tildes must be followed by 0s or 1s.
85+ isValid :: Text -> Bool
86+ isValid x = all (\y -> T.isPrefixOf "0" y || T.isPrefixOf "1" y) afterTildes
87+ where
88+ afterTildes :: [Text]
89+ afterTildes = drop 1 $ T.splitOn "~" x
90+
91+ replace :: Text -> Text
92+ replace = T.replace "~0" "~" . T.replace "~1" "/"
93+
94+-- * Resolution
95+
96+data ResolutionError
97+ = ObjectLookupFailed
98+ | ArrayIndexInvalid
99+ | ArrayElemNotFound
100+ | ExpectedObjectOrArray
101+ deriving (Eq, Show)
102+
103+resolve :: Pointer -> Value -> Either ResolutionError Value
104+resolve (Pointer []) v = Right v
105+resolve (Pointer (t:ts)) v = resolveToken t v >>= resolve (Pointer ts)
106+
107+-- | For internal use (or specialized applications that don't want to
108+-- resolve an entire pointer at once).
109+resolveToken :: Token -> Value -> Either ResolutionError Value
110+resolveToken tok (Array vs) =
111+ case readMaybe . T.unpack . _unToken $ tok of
112+ Nothing -> Left ArrayIndexInvalid
113+ Just n -> do
114+ when (n < 0) (Left ArrayIndexInvalid)
115+ case vs V.!? n of
116+ Nothing -> Left ArrayElemNotFound
117+ Just res -> Right res
118+resolveToken tok (Object h) =
119+ case H.lookup (_unToken tok) h of
120+ Nothing -> Left ObjectLookupFailed
121+ Just res -> Right res
122+resolveToken _ _ = Left ExpectedObjectOrArray
src/Data/JsonPointer.hsdeleted−79
@@ -1,79 +0,0 @@
1−module Data.JsonPointer where
2−
3−import Control.Applicative
4−import Control.Monad
5−import Data.Aeson
6−import qualified Data.HashMap.Strict as H
7−import Data.Text (Text)
8−import qualified Data.Text as T
9−import qualified Data.Vector as V
10−import Text.Read (readMaybe)
11−
12−newtype JsonPointer = JsonPointer { _unJsonPointer :: [Text] } deriving (Eq, Show)
13−
14−data PointerFormatError
15− -- | The Text to build a JSON Pointer must either be empty
16− -- or start with a "/".
17− = InvalidFirstChar
18− | UnescapedTilde
19− deriving (Eq, Show)
20−
21−data ResolutionError
22− = ObjectLookupFailed
23− | ArrayIndexInvalid
24− | ArrayElemNotFound
25− | ExpectedObjectOrArray
26− deriving (Eq, Show)
27−
28−-- | The Text to build a JSON Pointer must either be empty or start
29−-- with a "/". If you're turning a URI Fragment into a JSON Pointer
30−-- you must drop the initial "#".
31−jsonPointer :: Text -> Either PointerFormatError JsonPointer
32−jsonPointer t =
33− JsonPointer <$> (unescape =<< process (T.splitOn "/" t))
34− where
35− process ::[Text] -> Either PointerFormatError [Text]
36− process [] = Right []
37− process (x:xs)
38− -- This checks that the JsonPointer started with a "/":
39− | (not . T.null $ x) = Left InvalidFirstChar
40− | otherwise = Right xs
41−
42− unescape :: [Text] -> Either PointerFormatError [Text]
43− unescape xs = do
44− void $ mapM checkValid xs
45− Right $ T.replace "~0" "~" . T.replace "~1" "/" <$> xs
46−
47− checkValid :: Text -> Either PointerFormatError ()
48− checkValid x = do
49− let afterTildes = drop 1 $ T.splitOn "~" x
50− if all (\y -> T.isPrefixOf "0" y || T.isPrefixOf "1" y) afterTildes
51− then Right ()
52− else Left UnescapedTilde
53−
54−resolvePointer :: JsonPointer -> Value -> Either ResolutionError Value
55−resolvePointer p v =
56− case _unJsonPointer p of
57− [] -> Right v
58− _ -> resolveRefTok p v >>= uncurry resolvePointer
59−
60−-- | For internal use and specialized applications that don't want to
61−-- resolve the entire pointer at once.
62−resolveRefTok :: JsonPointer -> Value -> Either ResolutionError (JsonPointer, Value)
63−resolveRefTok p v = do
64− case _unJsonPointer p of
65− [] -> Right (p, v)
66− (tok:ps) ->
67− case v of
68− Object h ->
69− case H.lookup tok h of
70− Nothing -> Left ObjectLookupFailed
71− Just vv -> Right (JsonPointer ps, vv)
72− Array vs -> do
73− case readMaybe (T.unpack tok) of
74− Nothing -> Left ArrayIndexInvalid
75− Just n -> do
76− when (n < 0) $ Left ArrayIndexInvalid
77− when (n >= V.length vs) $ Left ArrayElemNotFound
78− Right (JsonPointer ps, vs V.! n)
79− _ -> Left ExpectedObjectOrArray
tests/Unit.hs+69−66
@@ -1,87 +1,90 @@
1+
12module Main where
23
3−import Control.Applicative
44import Control.Arrow
5−import Control.Monad
65import Data.Aeson
7−import qualified Data.HashMap.Strict as H
8−import Data.JsonPointer
9−import Data.Monoid
10−import Data.Text (Text)
11−import qualified Data.Text as T
6+import qualified Data.Aeson.Pointer as P
7+import Data.Text (Text)
8+import qualified Data.Text as T
129import Data.Text.Encoding
13−import qualified Data.Vector as V
14−import Network.HTTP.Types.URI
15−import Test.Framework (defaultMain, testGroup)
16−import Test.Framework.Providers.HUnit (testCase)
17−import Test.HUnit hiding (Test)
10+import qualified Data.Vector as V
11+import Network.HTTP.Types.URI (urlDecode)
12+import Test.Framework (defaultMain, testGroup)
13+import Test.Framework.Providers.HUnit (testCase)
14+import Test.Framework.Providers.QuickCheck2 (testProperty)
15+import Test.HUnit hiding (Test)
1816
17+-- For GHCs before 7.10:
18+import Control.Applicative
19+import Data.Foldable
20+import Data.Monoid
1921
2022main :: IO ()
2123main = defaultMain
2224 [ testGroup "unit"
23− [ testCase "Can be represented in a JSON string value" jsonString
25+ [ testProperty "Storing a Pointer as JSON doesn't change its value" roundtrip
26+ , testCase "Can be represented in a JSON string value" jsonString
2427 , testCase "Can be represented in a URI fragment identifier" uriFragment
2528 ]
2629 ]
2730
28−specExample :: Value
29−specExample =
30− Object $ H.fromList
31− [ ("foo" , Array $ V.fromList ["bar", "baz"])
32− , ("" , Number 0)
33− , ("a/b" , Number 1)
34− , ("c%d" , Number 2)
35− , ("e^f" , Number 3)
36− , ("g|h" , Number 4)
37− , ("i\\j", Number 5)
38− , ("k\"l", Number 6)
39− , (" " , Number 7)
40− , ("m~n" , Number 8)
41− ]
42−
43−resolvesTo :: (Text, Value) -> Assertion
44−resolvesTo (t, expected) =
45− case jsonPointer t of
46− Left e -> assertFailure (show e <> " error for pointer: " <> show t)
47− Right p ->
48− assertEqual ("Resolved value for pointer: " <> show t)
49− (Right expected)
50− $ resolvePointer p specExample
31+roundtrip :: P.Pointer -> Bool
32+roundtrip a = Just a == decode (encode a)
5133
5234jsonString :: Assertion
53−jsonString =
54− void $ mapM resolvesTo
55− [ ("" , specExample)
56− , ("/foo" , Array $ V.fromList ["bar", "baz"])
57− , ("/foo/0", String "bar")
58− , ("/" , Number 0)
59− , ("/a~1b" , Number 1)
60− , ("/c%d" , Number 2)
61− , ("/e^f" , Number 3)
62− , ("/g|h" , Number 4)
63− , ("/i\\j" , Number 5)
64− , ("/k\"l" , Number 6)
65− , ("/ " , Number 7)
66− , ("/m~0n" , Number 8)
67− ]
35+jsonString = traverse_ resolvesTo
36+ [ ("" , specExample)
37+ , ("/foo" , Array $ V.fromList ["bar", "baz"])
38+ , ("/foo/0", String "bar")
39+ , ("/" , Number 0)
40+ , ("/a~1b" , Number 1)
41+ , ("/c%d" , Number 2)
42+ , ("/e^f" , Number 3)
43+ , ("/g|h" , Number 4)
44+ , ("/i\\j" , Number 5)
45+ , ("/k\"l" , Number 6)
46+ , ("/ " , Number 7)
47+ , ("/m~0n" , Number 8)
48+ ]
6849
6950uriFragment :: Assertion
70−uriFragment =
71− void $ mapM resolvesTo $ first decodeFragment <$>
72− [ ("#" , specExample)
73− , ("#/foo" , Array $ V.fromList ["bar", "baz"])
74− , ("#/foo/0", String "bar")
75− , ("#/" , Number 0)
76− , ("#/a~1b" , Number 1)
77− , ("#/c%25d", Number 2)
78− , ("#/e%5Ef", Number 3)
79− , ("#/g%7Ch", Number 4)
80− , ("#/i%5Cj", Number 5)
81− , ("#/k%22l", Number 6)
82− , ("#/%20" , Number 7)
83− , ("#/m~0n" , Number 8)
84− ]
51+uriFragment = traverse_ resolvesTo . fmap (first decodeFragment) $
52+ [ ("#" , specExample)
53+ , ("#/foo" , Array $ V.fromList ["bar", "baz"])
54+ , ("#/foo/0", String "bar")
55+ , ("#/" , Number 0)
56+ , ("#/a~1b" , Number 1)
57+ , ("#/c%25d", Number 2)
58+ , ("#/e%5Ef", Number 3)
59+ , ("#/g%7Ch", Number 4)
60+ , ("#/i%5Cj", Number 5)
61+ , ("#/k%22l", Number 6)
62+ , ("#/%20" , Number 7)
63+ , ("#/m~0n" , Number 8)
64+ ]
8565 where
8666 decodeFragment :: Text -> Text
8767 decodeFragment = T.drop 1 . decodeUtf8 . urlDecode True . encodeUtf8
68+
69+resolvesTo :: (Text, Value) -> Assertion
70+resolvesTo (t, expected) =
71+ case P.unescape t of
72+ Left e -> assertFailure (show e <> " error for pointer: " <> show t)
73+ Right p -> assertEqual
74+ ("Resolved value for pointer: " <> show t)
75+ (Right expected)
76+ (P.resolve p specExample)
77+
78+specExample :: Value
79+specExample = object
80+ [ "foo" .= (["bar", "baz"] :: [Text])
81+ , "" .= (0 :: Int)
82+ , "a/b" .= (1 :: Int)
83+ , "c%d" .= (2 :: Int)
84+ , "e^f" .= (3 :: Int)
85+ , "g|h" .= (4 :: Int)
86+ , "i\\j" .= (5 :: Int)
87+ , "k\"l" .= (6 :: Int)
88+ , " " .= (7 :: Int)
89+ , "m~n" .= (8 :: Int)
90+ ]