diff --git a/src/Data/Binary/Class.hs b/src/Data/Binary/Class.hs index 2eed93e065a10208a95a47cb96fe74f72c07a850..3bec0145603afca803804df763007e74fb41ad39 100644 --- a/src/Data/Binary/Class.hs +++ b/src/Data/Binary/Class.hs @@ -830,7 +830,11 @@ instance (Binary a, Binary b) => Binary (Semigroup.Arg a b) where -- | /Since: 0.8.4.0/ instance Binary a => Binary (NE.NonEmpty a) where - get = fmap NE.fromList get + get = do + list <- get + case list of + [] -> fail "NonEmpty is actually empty!" + x:xs -> pure (x NE.:| xs) put = put . NE.toList #endif