Repository navigation
Format Miso.UUID and match the Data.UUID API - #1671
Merged
Merged
Conversation
Add the standard module header with an overview, separator lines, 2-space indentation, aligned imports, and an export list grouped under headings. The module was not listed in miso.cabal, so it was never compiled; add it to exposed-modules. The library is Haskell2010, so use 'import qualified' and enable DerivingStrategies and GeneralizedNewtypeDeriving for 'deriving newtype'.
Add toString/fromString, toText/fromText, the strict and lazy ASCII ByteString conversions, toByteString/fromByteString (16 bytes, network order), and toWords/fromWords and toWords64/fromWords64, as in the uuid package. They only use base, text and bytestring, which miso already depends on. Show and Read now use the unquoted 8-4-4-4-12 form, like Data.UUID, instead of the quoted form derived from MisoString.
MicroHs rejects Miso.Prelude's (.) as ambiguous between Data.Function and Control.Category. No other library module uses Miso.Prelude, so import from Prelude, Miso.DSL and Miso.String like the rest of miso.
Cover parsing, Show/Read, the Word32/Word64/ByteString/Text conversions, nil, MisoString, JSON, JSVal and Router round trips, and that nextRandom gives distinct v4 UUIDs.
Miso.UUID and match the Data.UUID API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the standard module header (copyright, license, maintainer, overview, quick start),
---separator lines, 2-space indentation, aligned imports, and a grouped export list, matching modules likeMiso.StorageandMiso.Random.Miso.UUID(feat: Miso.UUID #1670) was missing frommiso.cabal, so it was never compiled. Adds it toexposed-modules(alphabetized). The library isHaskell2010, soImportQualifiedPostimports becomeimport qualified.Renames
newV4tonextRandom(matching theuuidpackage).Matches the
Data.UUIDAPI:toString/fromString,toText/fromText,toASCIIBytes/fromASCIIBytes,toLazyASCIIBytes/fromLazyASCIIBytes,toByteString/fromByteString(16 bytes, network order, lazy likeuuid),toWords/fromWords,toWords64/fromWords64. No new dependencies (onlybase,text,bytestring).Show/Readnow use the unquoted8-4-4-4-12form, likeData.UUID(previously quoted, derived fromMisoString).Not included: the
Data,Storable,Binary,NFData,Hashable,Random/Uniform, andLiftinstances, which would need new dependencies.Imports from
Prelude,Miso.DSLandMiso.Stringinstead ofMiso.Prelude, whose(.)MicroHs rejects as ambiguous.Adds
Miso.UUID teststotests/app/Main.hs: parsing,Show/Read, all conversions, nil,MisoString/JSON/JSVal/Routerround trips, andnextRandomproducing distinct v4 UUIDs.cabal build lib:misopasses with no warnings. Checked parsing,show/read, word and byte values, and round trips for every to/from pair.