There are some things you can construct by using the constructors directly that don't make sense, aren't useful, or can be represented in several ways
Choice [] -- Doesn't match anything
Choice [foo,foo] = foo
Choice [Choice foo] = Choice [foo]
Tuple [] = Constant (Aeson.Array Vector.empty) = Array (LengthtBound (Just 0) (Just 0))
Null -- Same as Constant Aeson.Null
LengthBound (Just -2) (Just -1) -- Doesn't match anything
Some of these are hard to fix we can not (afaict) use a (Hash)Set for Choice since Aeson doesn't implement Ord or Hashable.
We can fix some of this by unexposing the constructors and only using smart constructors instead, <|> for Choice, <+> for Tuple, Value etc could have a Maybe Bound instead so you can create one by doing mkBound <$> foo 1 <*> foo 2.
I'm going to remove Null in the next release, but I'll let the rest air out for a bit.
There are some things you can construct by using the constructors directly that don't make sense, aren't useful, or can be represented in several ways
Some of these are hard to fix we can not (afaict) use a (Hash)Set for Choice since Aeson doesn't implement Ord or Hashable.
We can fix some of this by unexposing the constructors and only using smart constructors instead,
<|>for Choice,<+>for Tuple, Value etc could have a Maybe Bound instead so you can create one by doingmkBound <$> foo 1 <*> foo 2.I'm going to remove
Nullin the next release, but I'll let the rest air out for a bit.