diff --git a/compiler/utils/Bag.hs b/compiler/utils/Bag.hs index 727d1c5f3d60a615eb3aedd40462bbf1365210b0..41c80390cc3fbdae501b74e9822f850524cd5c21 100644 --- a/compiler/utils/Bag.hs +++ b/compiler/utils/Bag.hs @@ -328,6 +328,7 @@ mapAccumBagLM f s (ListBag xs) = do { (s', xs') <- mapAccumLM f s xs listToBag :: [a] -> Bag a listToBag [] = EmptyBag +listToBag [x] = UnitBag x listToBag vs = ListBag vs bagToList :: Bag a -> [a] diff --git a/compiler/utils/OrdList.hs b/compiler/utils/OrdList.hs index 081210a53426701540159fa4e4f59e23b1eb9aab..a5739764d4a5337d389255759222b41a5ac44428 100644 --- a/compiler/utils/OrdList.hs +++ b/compiler/utils/OrdList.hs @@ -122,4 +122,5 @@ foldlOL k z (Many xs) = foldl k z xs toOL :: [a] -> OrdList a toOL [] = None +toOL [x] = One x toOL xs = Many xs