packages feed

type-level-show 0.2.1 → 0.3.0

raw patch · 3 files changed

+21/−13 lines, 3 filesdep ~singleraeh

Dependency ranges changed: singleraeh

Files

CHANGELOG.md view
@@ -1,3 +1,6 @@+## 0.3.0 (2024-06-01)+* update singleraeh+ ## 0.2.1 (2024-05-25) * add `Demotable Doc` instance * single `ShowChar`
src/TypeLevelShow/Doc.hs view
@@ -22,6 +22,7 @@ import GHC.TypeLits qualified as TE -- TE = TypeError import GHC.TypeLits hiding ( ErrorMessage(..) ) import Singleraeh.Demote+import Singleraeh.SingI  -- | Simple pretty document ADT. --@@ -76,6 +77,17 @@     (:$<>:) :: SDoc docl -> SDoc docr -> SDoc (docl :<>: docr)     (:$$$:) :: SDoc docl -> SDoc docr -> SDoc (docl :$$: docr) +-- | Demote an 'SDoc' singleton to the corresponding base 'Doc'.+demoteDoc :: SDoc doc -> Doc String+demoteDoc = \case+  SText s   -> Text $ fromSSymbol s+  l :$<>: r -> demoteDoc l :<>: demoteDoc r+  l :$$$: r -> demoteDoc l :$$: demoteDoc r++instance Demotable SDoc where+    type Demote SDoc = Doc String+    demote = demoteDoc+ -- | Produce the singleton for the given promoted 'Doc'. class SingDoc (doc :: PDoc) where     singDoc :: SDoc doc@@ -89,16 +101,9 @@ instance (SingDoc l, SingDoc r) => SingDoc (l :$$: r) where     singDoc = singDoc @l :$$$: singDoc @r --- | Demote an 'SDoc' singleton to the corresponding base 'Doc'.-demoteDoc :: SDoc doc -> Doc String-demoteDoc = \case-  SText s   -> Text $ fromSSymbol s-  l :$<>: r -> demoteDoc l :<>: demoteDoc r-  l :$$$: r -> demoteDoc l :$$: demoteDoc r--instance Demotable SDoc where-    type Demote SDoc = Doc String-    demote = demoteDoc+instance SingDoc doc => SingI doc where+    type Sing = SDoc+    sing' = singDoc  -- | Reify a promoted 'Doc' to the corresponding term-level one. reifyDoc :: forall (doc :: PDoc). SingDoc doc => Doc String
type-level-show.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           type-level-show-version:        0.2.1+version:        0.3.0 synopsis:       Utilities for writing Show-like type families description:    Please see README.md. category:       Types, Data@@ -50,7 +50,7 @@       MagicHash   ghc-options: -Wall -Wno-unticked-promoted-constructors   build-depends:-      base >=4.16 && <5+      base >=4.18 && <5     , defun-core ==0.1.*-    , singleraeh ==0.2.*+    , singleraeh >=0.4.0 && <0.5   default-language: GHC2021