@@ -1,13 +1,13 @@
11module Spago.Search.TypeDecoder where
22
3−import Data.Either
4−import Data.Traversable
3+
54import Prelude
65
7−import Data.Argonaut.Core (Json, caseJsonArray, caseJsonObject, fromArray, fromObject, jsonEmptyObject, jsonNull, stringify, toArray)
6+import Data.Argonaut.Core (Json, caseJsonObject, fromArray, fromObject, jsonEmptyObject, stringify, toArray)
87import Data.Argonaut.Decode (class DecodeJson, decodeJson, (.:))
98import Data.Argonaut.Encode (class EncodeJson, encodeJson)
109import Data.Array ((!!))
10+import Data.Either (Either(..))
1111import Data.Generic.Rep (class Generic)
1212import Data.Generic.Rep.Show (genericShow)
1313import Data.Maybe (Maybe(..), fromMaybe)
@@ -57,10 +57,7 @@ derive instance eqKind :: Eq Kind
5757derive instance genericKind :: Generic Kind _
5858
5959instance showKind :: Show Kind where
60− show = case _ of
61− Row k -> "(Row " <> show k <> ")"
62− FunKind k1 k2 -> "(FunKind " <> show k1 <> " " <> show k2 <> ")"
63− NamedKind name -> "(NamedKind " <> show name <> ")"
60+ show x = genericShow x
6461
6562instance decodeJsonKind :: DecodeJson Kind where
6663 decodeJson json = do
@@ -165,31 +162,7 @@ derive instance eqType :: Eq Type
165162derive instance genericType :: Generic Type _
166163
167164instance showType :: Show Type where
168− show = case _ of
169− TypeVar _String ->
170− "(TypeVar " <> show _String <> ")"
171− TypeLevelString _String ->
172− "(TypeLevelString " <> show _String <> ")"
173− TypeWildcard ->
174− "TypeWildcard"
175− TypeConstructor _QualifiedName ->
176− "(TypeConstructor " <> show _QualifiedName <> ")"
177− TypeOp _QualifiedName ->
178− "(TypeOp " <> show _QualifiedName <> ")"
179− TypeApp _Type1 _Type2 ->
180− "(TypeApp " <> show _Type1 <> " " <> show _Type2 <> ")"
181− ForAll _String _Type _Maybe_Kind ->
182− "(ForAll " <> show _String <> " " <> show _Type <> " " <> show _Maybe_Kind <> ")"
183− ConstrainedType _Constraint _Type ->
184− "(ConstrainedType " <> show _Constraint <> " " <> show _Type <> ")"
185− REmpty ->
186− "REmpty"
187− RCons _String _Type1 _Type2 ->
188− "(RConsLabel " <> show _String <> " " <> show _Type1 <> " " <> show _Type2 <> ")"
189− BinaryNoParensType _Type1 _Type2 _Type3 ->
190− "(BinaryNoParensTypeType " <> show _Type1 <> " " <> show _Type2 <> " " <> show _Type3 <> ")"
191− ParensInType _Type ->
192− "(ParensInType " <> show _Type <> ")"
165+ show x = genericShow x
193166
194167instance decodeJsonType :: DecodeJson Type where
195168 decodeJson json = do