packages feed

singletons 3.0.1 → 3.0.2

raw patch · 5 files changed

+34/−16 lines, 5 filesdep ~base

Dependency ranges changed: base

Files

CHANGES.md view
@@ -1,6 +1,14 @@ Changelog for the `singletons` project ====================================== +3.0.2 [2022.08.23]+------------------+* Allow building with GHC 9.4.+* When building with GHC 9.4 or later, use the new+  [`withDict`](https://hackage.haskell.org/package/ghc-prim-0.9.0/docs/GHC-Magic-Dict.html#v:withDict)+  primitive to implement `withSingI` instead of `unsafeCoerce`. This change+  should not have any consequences for user-facing code.+ 3.0.1 [2021.10.30] ------------------ * Add `SingI1` and `SingI2`, higher-order versions of `SingI`, to
README.md view
@@ -6,7 +6,7 @@ `singletons` contains the basic types and definitions needed to support dependently typed programming techniques in Haskell. This library was originally presented in-[_Dependently Typed Programming with Singletons_](https://cs.brynmawr.edu/~rae/papers/2012/singletons/paper.pdf),+[_Dependently Typed Programming with Singletons_](https://richarde.dev/papers/2012/singletons/paper.pdf), published at the Haskell Symposium, 2012.  `singletons` is intended to be a small, foundational library on which other
singletons.cabal view
@@ -1,5 +1,5 @@ name:           singletons-version:        3.0.1+version:        3.0.2 cabal-version:  1.24 synopsis:       Basic singleton types and definitions homepage:       http://www.github.com/goldfirere/singletons@@ -14,8 +14,9 @@               , GHC == 8.6.5               , GHC == 8.8.4               , GHC == 8.10.7-              , GHC == 9.0.1-              , GHC == 9.2.1+              , GHC == 9.0.2+              , GHC == 9.2.4+              , GHC == 9.4.1               , GHCJS==8.4 extra-source-files: README.md, CHANGES.md license:        BSD3@@ -26,7 +27,7 @@     dependently typed programming techniques in Haskell. This library was     originally presented in /Dependently Typed Programming with Singletons/,     published at the Haskell Symposium, 2012.-    (<https://cs.brynmawr.edu/~rae/papers/2012/singletons/paper.pdf>)+    (<https://richarde.dev/papers/2012/singletons/paper.pdf>)     .     @singletons@ is intended to be a small, foundational library on which other     projects can build. As such, @singletons@ has a minimal dependency@@ -47,7 +48,7 @@   type:     git   location: https://github.com/goldfirere/singletons.git   subdir:   singletons-  tag:      v3.0.1+  tag:      v3.0.2  source-repository head   type:     git@@ -57,7 +58,7 @@  library   hs-source-dirs:     src-  build-depends:      base >= 4.9 && < 4.17+  build-depends:      base >= 4.9 && < 4.18   default-language:   Haskell2010   exposed-modules:    Data.Singletons                       Data.Singletons.Decide@@ -74,5 +75,5 @@   other-modules:      ByHand                       ByHand2 -  build-depends:      base >= 4.9 && < 4.17,+  build-depends:      base >= 4.9 && < 4.18,                       singletons
src/Data/Singletons.hs view
@@ -43,8 +43,8 @@ -- -- You may also want to read -- the original papers presenting this library, available at--- <http://cs.brynmawr.edu/~rae/papers/2012/singletons/paper.pdf>--- and <http://cs.brynmawr.edu/~rae/papers/2014/promotion/promotion.pdf>.+-- <https://richarde.dev/papers/2012/singletons/paper.pdf>+-- and <https://richarde.dev/papers/2014/promotion/promotion.pdf>. -- ---------------------------------------------------------------------------- @@ -121,6 +121,10 @@ import GHC.Exts (Proxy#) import Unsafe.Coerce (unsafeCoerce) +#if MIN_VERSION_base(4,17,0)+import GHC.Exts (withDict)+#endif+ -- | Convenient synonym to refer to the kind of a type variable: -- @type KindOf (a :: k) = k@ #if __GLASGOW_HASKELL__ >= 810@@ -406,18 +410,22 @@ data SingInstance (a :: k) where   SingInstance :: SingI a => SingInstance a --- dirty implementation of explicit-to-implicit conversion-#if __GLASGOW_HASKELL__ >= 810-type DI :: k -> Type-#endif-newtype DI a = Don'tInstantiate (SingI a => SingInstance a)- -- | Get an implicit singleton (a 'SingI' instance) from an explicit one. singInstance :: forall k (a :: k). Sing a -> SingInstance a singInstance s = with_sing_i SingInstance   where     with_sing_i :: (SingI a => SingInstance a) -> SingInstance a+#if MIN_VERSION_base(4,17,0)+    with_sing_i = withDict @(SingI a) @(Sing a) s+#else     with_sing_i si = unsafeCoerce (Don'tInstantiate si) s++-- dirty implementation of explicit-to-implicit conversion+#if __GLASGOW_HASKELL__ >= 810+type DI :: k -> Type+#endif+newtype DI a = Don'tInstantiate (SingI a => SingInstance a)+#endif  ---------------------------------------------------------------------- ---- Defunctionalization ---------------------------------------------
src/Data/Singletons/ShowSing.hs view
@@ -10,6 +10,7 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -Wno-orphans #-}