44B3SUXR4SUE7PO34G7RMVQWHH4G6X342OZ3RZURV6JJQPHOJZZAC KAJC3D5NCOYO6GMDVIZE5TRJ263IOJFRAXX5UODSCF5P5CQ2AB7AC 3BTFGIU5ONHANVU6H522GTBJBHVDBUCC7LMI6EBZSTAKXVLS6RYAC KF36I3CZFW4SKD4JX4D6EDR2BJGJ7RGN4LH75P6Y7XZPYAEOAC5AC XSLIBX4TIHUA4SS5IJMKJ6R575FNLYGF3VIWOGCTYDNPIKZG6QFAC 7P3WY2CHMA5QFOYGENWGIIYXDIHOUFWIIBACUPQ7KKSOWILGW3HAC J7LSWCNFU3UWTUXFHQLIRLW2BHXJA54AT6SR5JY6JK3XABO4ZIXQC 5EHCW5VT5CEA2VNAZ6RX6OBKKRKGJEFMT2FFEHV5QQWBX2UW4AOAC DT2CHVIEWBPILKXBYFYT6C3C3BOADG6ITIUXYY6VMQU7EFT6S6JQC instance ToJSON a => ToJSON (NonEmptyList a) wheretoEncoding (NonEmptyList x xs) = toEncoding (x:xs)instance FromJSON a => FromJSON (NonEmptyList a) whereparseJSON = withArray "NonEmptyList" $ \array ->maybe (fail "Unable to parse values") pure (parseValues array)whereparseVec = sequence . Vector.toList . Vector.map fromJSONparseValues array = Vector.uncons array >>=\(head, tail) -> case (fromJSON head, parseVec tail) of(Success x, Success xs) -> pure $ NonEmptyList x xs_ -> fail "Unable to parse values"
instance ToJSON a => ToJSON (NonEmptyList a) wheretoEncoding list =let (x, xs) = uncons listin toEncoding (x:xs)instance FromJSON a => FromJSON (NonEmptyList a) whereparseJSON = withArray "NonEmptyList" $ \array ->maybe (fail "Unable to parse values") pure (parseValues array)whereparseVec = sequence . Vector.toList . Vector.map fromJSONparseValues array = Vector.uncons array >>=\(head, tail) -> case (fromJSON head, parseVec tail) of(Success x, Success xs) -> fromList (x:xs)_ -> fail "Unable to parse values"