diff options
author | Joey Hess <joeyh@joeyh.name> | 2019-03-06 16:44:17 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2019-03-06 16:44:17 -0400 |
commit | 3b412aaae06dd091dcbcdaad5de2aabe34b4c50d (patch) | |
tree | f76dd237a78edc2f905e68e3af3014bd1dc54c67 /Types/UUID.hs | |
parent | 1b3d04979e922c3bd15aac8fb7c29498ead7308a (diff) |
simplify Applicative instance
Diffstat (limited to 'Types/UUID.hs')
-rw-r--r-- | Types/UUID.hs | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/Types/UUID.hs b/Types/UUID.hs index 0bb2e72c31..91df671493 100644 --- a/Types/UUID.hs +++ b/Types/UUID.hs @@ -14,7 +14,6 @@ import qualified Data.Map as M import qualified Data.UUID as U import Data.Maybe import Data.String -import Data.Char import Data.ByteString.Builder import qualified Data.Semigroup as Sem @@ -87,11 +86,5 @@ instance Proto.Serializable UUID where instance Arbitrary UUID where arbitrary = frequency [(1, return NoUUID), (3, UUID <$> arb)] where - -- Avoid non-ascii because fully arbitrary - -- strings may not be encoded using the filesystem - -- encoding, which is normally applied to all input. - -- Avoid whitespace because UUIDs are used in log files. - -- Avoid empty because that's NoUUID - arb = encodeBS . getNonEmpty <$> arbitrary - `suchThat` (all isAscii . getNonEmpty) - `suchThat` (all (not . isSpace) . getNonEmpty) + arb = encodeBS <$> listOf1 (elements uuidchars) + uuidchars = '-' : ['a'..'z'] ++ ['A'..'Z'] ++ ['0'..'9'] |