1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 09:15:01 +03:00

Missing one case for this monoid instance to be associative

This commit is contained in:
Timothy Clem 2017-05-05 07:51:59 -07:00
parent bee7d1ee6a
commit e53a8342a3

View File

@ -181,6 +181,7 @@ instance Monoid Value where
mempty = Null
mappend a b | Null <- b = A.Array (singleton a)
| Null <- a = A.Array (singleton b)
| A.Array a' <- a, A.Array b' <- b = A.Array (a' ++ b')
| A.Array b' <- b = A.Array (singleton a ++ b')
| A.Array a' <- a = A.Array (a' ++ singleton b)
| otherwise = A.Array (fromList [a, b])