Skip to content

Format Miso.UUID and match the Data.UUID API - #1671

Merged
dmjio merged 6 commits into
masterfrom
uuid-module-header
Oct 7, 2026
Merged

dmjio merged 6 commits into
masterfrom
uuid-module-header

Conversation

@dmjio

@dmjio dmjio commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner
  • 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 like Miso.Storage and Miso.Random.

  • Miso.UUID (feat: Miso.UUID #1670) was missing from miso.cabal, so it was never compiled. Adds it to exposed-modules (alphabetized). The library is Haskell2010, so ImportQualifiedPost imports become import qualified.

  • Renames newV4 to nextRandom (matching the uuid package).

  • Matches the Data.UUID API: toString/fromString, toText/fromText, toASCIIBytes/fromASCIIBytes, toLazyASCIIBytes/fromLazyASCIIBytes, toByteString/fromByteString (16 bytes, network order, lazy like uuid), toWords/fromWords, toWords64/fromWords64. No new dependencies (only base, text, bytestring).

  • Show/Read now use the unquoted 8-4-4-4-12 form, like Data.UUID (previously quoted, derived from MisoString).

  • Not included: the Data, Storable, Binary, NFData, Hashable, Random/Uniform, and Lift instances, which would need new dependencies.

  • Imports from Prelude, Miso.DSL and Miso.String instead of Miso.Prelude, whose (.) MicroHs rejects as ambiguous.

  • Adds Miso.UUID tests to tests/app/Main.hs: parsing, Show/Read, all conversions, nil, MisoString/JSON/JSVal/Router round trips, and nextRandom producing distinct v4 UUIDs.

cabal build lib:miso passes with no warnings. Checked parsing, show/read, word and byte values, and round trips for every to/from pair.

dmjio added 3 commits October 6, 2026 23:46
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.
@dmjio dmjio changed the title Format Miso.UUID like the other modules Format Miso.UUID and match the Data.UUID API Oct 7, 2026
dmjio added 2 commits October 7, 2026 00:21
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.
@dmjio dmjio changed the title Format Miso.UUID and match the Data.UUID API Format Miso.UUID and match the Data.UUID API Oct 7, 2026
@dmjio
dmjio merged commit f1e1b38 into master Oct 7, 2026
5 of 6 checks passed
@dmjio
dmjio deleted the uuid-module-header branch October 7, 2026 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant