@@ -89,9 +89,9 @@ instance 'FromJSON' a => 'FromJSON' (D a) where
89 case conVal of
89 case conVal of
90 'Array' arr ->
90 'Array' arr ->
91 if V.length arr == 3
91 if V.length arr == 3
92− then Product \<$\> 'parseJSON' (arr V.! 0)
92+ then Product \<$\> 'parseJSON' (arr `V.unsafeIndex` 0)
93− \<*\> 'parseJSON' (arr V.! 1)
93+ \<*\> 'parseJSON' (arr `V.unsafeIndex` 1)
94− \<*\> 'parseJSON' (arr V.! 2)
94+ \<*\> 'parseJSON' (arr `V.unsafeIndex` 2)
95 else fail \"\<error message\>\"
95 else fail \"\<error message\>\"
96 _ -> fail \"\<error message\>\"
96 _ -> fail \"\<error message\>\"
97 | conKey == T.pack \"Record\" ->
97 | conKey == T.pack \"Record\" ->
@@ -178,7 +178,7 @@ import Language.Haskell.TH
178-- from text:
178-- from text:
179import qualified Data.Text as T ( Text, pack, unpack )
179import qualified Data.Text as T ( Text, pack, unpack )
180-- from vector:
180-- from vector:
181−import qualified Data.Vector as V ( (!), null, length )
181+import qualified Data.Vector as V ( unsafeIndex, null, length )
@@ -385,8 +385,8 @@ encodeArgs withExp withField (ForallC _ _ con) =
385-- \value -> case value of
385-- \value -> case value of
386-- 'Array' arr ->
386-- 'Array' arr ->
387-- if (V.length arr == 2)
387-- if (V.length arr == 2)
388−-- then Foo \<$\> 'parseJSON' (arr V.! 0)
388+-- then Foo \<$\> 'parseJSON' (arr `V.unsafeIndex` 0)
389−-- \<*\> 'parseJSON' (arr V.! 1)
389+-- \<*\> 'parseJSON' (arr `V.unsafeIndex` 1)
390-- else fail \"\<error message\>\"
390-- else fail \"\<error message\>\"
391-- other -> fail \"\<error message\>\"
391-- other -> fail \"\<error message\>\"
@@ -600,11 +600,11 @@ parseProduct :: Name -- ^ Name of the type to which the constructor belongs.
600 -> [Q Match]
600 -> [Q Match]
601parseProduct tName conName numArgs =
601parseProduct tName conName numArgs =
602 [ do arr <- newName "arr"
602 [ do arr <- newName "arr"
603− -- List of: "parseJSON (arr V.! <IX>)"
603+ -- List of: "parseJSON (arr `V.unsafeIndex` <IX>)"
604 let x:xs = [ [|parseJSON|]
604 let x:xs = [ [|parseJSON|]
606 infixApp (varE arr)
606 infixApp (varE arr)
607− [|(V.!)|]
607+ [|V.unsafeIndex|]
608 (litE $ integerL ix)
608 (litE $ integerL ix)
609 | ix <- [0 .. numArgs - 1]
609 | ix <- [0 .. numArgs - 1]