Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 6 additions & 36 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#
# For more information, see https://github.com/haskell-CI/haskell-ci
#
# version: 0.19.20260209
# version: 0.19.20260331
#
# REGENDATA ("0.19.20260209",["github","cabal.project"])
# REGENDATA ("0.19.20260331",["github","cabal.project"])
#
name: Haskell-CI
on:
Expand Down Expand Up @@ -62,36 +62,6 @@ jobs:
compilerVersion: 9.6.7
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.4.8
compilerKind: ghc
compilerVersion: 9.4.8
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.2.8
compilerKind: ghc
compilerVersion: 9.2.8
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.0.2
compilerKind: ghc
compilerVersion: 9.0.2
setup-method: ghcup
allow-failure: false
- compiler: ghc-8.10.4
compilerKind: ghc
compilerVersion: 8.10.4
setup-method: ghcup
allow-failure: false
- compiler: ghc-8.8.4
compilerKind: ghc
compilerVersion: 8.8.4
setup-method: ghcup
allow-failure: false
- compiler: ghc-8.6.5
compilerKind: ghc
compilerVersion: 8.6.5
setup-method: ghcup
allow-failure: false
fail-fast: false
steps:
- name: apt-get install
Expand Down Expand Up @@ -217,10 +187,10 @@ jobs:
echo "packages: ${PKGDIR_some}" >> cabal.project
echo "package some" >> cabal.project
echo " ghc-options: -Werror=missing-methods -Werror=missing-fields" >> cabal.project
if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo "package some" >> cabal.project ; fi
if [ $((HCNUMVER >= 90400)) -ne 0 ] ; then echo " ghc-options: -Werror=unused-packages" >> cabal.project ; fi
if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then echo "package some" >> cabal.project ; fi
if [ $((HCNUMVER >= 90000)) -ne 0 ] ; then echo " ghc-options: -Werror=incomplete-patterns -Werror=incomplete-uni-patterns" >> cabal.project ; fi
echo "package some" >> cabal.project
echo " ghc-options: -Werror=unused-packages" >> cabal.project
echo "package some" >> cabal.project
echo " ghc-options: -Werror=incomplete-patterns -Werror=incomplete-uni-patterns" >> cabal.project
cat >> cabal.project <<EOF
EOF
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(some)$/; }' >> cabal.project.local
Expand Down
5 changes: 5 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 1.1

- Add `EqP` as a superclass of `GEq`, and `OrdP` as a superclass of `GCompare`.
- Relax `Eq` and `Ord` instances of `Some` to require just `EqP` and `OrdP`.

# 1.0.6

- Add instances for `SSymbol`, `SNat` and `SChar` from `base >=4.18.0.0'
Expand Down
30 changes: 9 additions & 21 deletions some.cabal
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
cabal-version: 2.4
name: some
version: 1.0.6
x-revision: 3
cabal-version: >=1.10
version: 1.1
build-type: Simple
author:
James Cook <mokus@deepbondi.net>, Oleg Grenrus <oleg.grenrus@iki.fi>

maintainer: Oleg Grenrus <oleg.grenrus@iki.fi>
license: BSD3
license: BSD-3-Clause
license-file: LICENSE
homepage: https://github.com/haskellari/some
category: Data, Dependent Types
Expand All @@ -25,19 +24,13 @@ description:
If you are unsure which variant to use, use the one in "Data.Some" module.

tested-with:
GHC ==8.6.5
|| ==8.8.4
|| ==8.10.4
|| ==9.0.2
|| ==9.2.8
|| ==9.4.8
|| ==9.6.7
GHC ==9.6.7
|| ==9.8.4
|| ==9.10.2
|| ==9.12.2
|| ==9.14.1

extra-source-files: ChangeLog.md
extra-doc-files: ChangeLog.md

flag newtype-unsafe
description:
Expand Down Expand Up @@ -72,20 +65,15 @@ library

other-modules: Data.GADT.Internal
build-depends:
base >=4.12 && <4.23
, deepseq >=1.4.4.0 && <1.6
base >=4.18 && <4.23
, deepseq >=1.4.8.1 && <1.6

if !impl(ghc >= 9.8)
build-depends:
base-orphans >= 0.9.1 && <0.10

if impl(ghc >=9.0)
-- these flags may abort compilation with GHC-8.10
-- https://gitlab.haskell.org/ghc/ghc/-/merge_requests/3295
ghc-options: -Winferred-safe-imports -Wmissing-safe-haskell-mode

if impl(ghc >=9.1)
ghc-options: -Wmissing-kind-signatures
ghc-options: -Winferred-safe-imports -Wmissing-safe-haskell-mode
ghc-options: -Wmissing-kind-signatures

test-suite hkd-example
default-language: Haskell2010
Expand Down
34 changes: 10 additions & 24 deletions src/Data/EqP.hs
Original file line number Diff line number Diff line change
@@ -1,38 +1,31 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE Safe #-}
{-# LANGUAGE TypeOperators #-}
#if __GLASGOW_HASKELL__ >= 810
{-# LANGUAGE CPP #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE Safe #-}
{-# LANGUAGE StandaloneKindSignatures #-}
#endif
{-# LANGUAGE TypeOperators #-}
module Data.EqP (
EqP (..),
) where

import Control.Applicative (Const (..))
import Data.Kind (Type)
import Data.Kind (Constraint, Type)
import Data.Proxy (Proxy (..))
import Data.Type.Equality ((:~:) (..), (:~~:) (..))
import GHC.Generics ((:*:) (..), (:+:) (..))
import System.Mem.StableName (StableName, eqStableName)
import Data.Functor.Product (Product (..))
import Data.Functor.Sum (Sum (..))

#if MIN_VERSION_base(4,18,0)
import Data.Functor.Product (Product (..))
import Data.Functor.Sum (Sum (..))
import qualified GHC.TypeLits as TL
import qualified GHC.TypeNats as TN
#endif
import qualified GHC.TypeLits as TL
import qualified GHC.TypeNats as TN

#if !MIN_VERSION_base(4,19,0)
import Data.Orphans ()
#endif

import qualified Type.Reflection as TR

#if __GLASGOW_HASKELL__ >= 810
import Data.Kind (Constraint)
#endif

-- | Heterogenous lifted equality.
--
Expand Down Expand Up @@ -60,9 +53,7 @@ import Data.Kind (Constraint)
-- /Note:/ P stands for phantom.
--
-- @since 1.0.5
#if __GLASGOW_HASKELL__ >= 810
type EqP :: (k -> Type) -> Constraint
#endif
class (forall a. Eq (f a)) => EqP (f :: k -> Type) where
eqp :: f a -> f b -> Bool

Expand All @@ -72,16 +63,13 @@ instance EqP ((:~:) a) where
instance EqP ((:~~:) a) where
eqp _ _ = True


#if MIN_VERSION_base(4,18,0)
instance (EqP a, EqP b) => EqP (Sum a b) where
eqp (InL x) (InL y) = eqp x y
eqp (InR x) (InR y) = eqp x y
eqp _ _ = False

instance (EqP a, EqP b) => EqP (Product a b) where
eqp (Pair x y) (Pair x' y') = eqp x x' && eqp y y'
#endif

instance (EqP f, EqP g) => EqP (f :+: g) where
eqp (L1 x) (L1 y) = eqp x y
Expand All @@ -94,7 +82,6 @@ instance (EqP a, EqP b) => EqP (a :*: b) where
instance EqP TR.TypeRep where
eqp x y = TR.SomeTypeRep x == TR.SomeTypeRep y

#if MIN_VERSION_base(4,18,0)
instance EqP TL.SChar where
eqp x y = TL.fromSChar x == TL.fromSChar y

Expand All @@ -103,7 +90,6 @@ instance EqP TL.SSymbol where

instance EqP TN.SNat where
eqp x y = TN.fromSNat x == TN.fromSNat y
#endif

instance EqP Proxy where
eqp _ _ = True
Expand Down
1 change: 0 additions & 1 deletion src/Data/GADT/Compare.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE Safe #-}
module Data.GADT.Compare (
-- * Equality
Expand Down
13 changes: 2 additions & 11 deletions src/Data/GADT/DeepSeq.hs
Original file line number Diff line number Diff line change
@@ -1,30 +1,21 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE Safe #-}
{-# LANGUAGE TypeOperators #-}
#if __GLASGOW_HASKELL__ >= 810
{-# LANGUAGE StandaloneKindSignatures #-}
#endif
{-# LANGUAGE TypeOperators #-}
module Data.GADT.DeepSeq (
GNFData (..),
) where

import Data.Functor.Product (Product (..))
import Data.Functor.Sum (Sum (..))
import Data.Kind (Constraint, Type)
import Data.Type.Equality ((:~:) (..), (:~~:) (..))
import GHC.Generics ((:*:) (..), (:+:) (..))

import qualified Type.Reflection as TR

#if __GLASGOW_HASKELL__ >= 810
import Data.Kind (Constraint, Type)
#endif

#if __GLASGOW_HASKELL__ >= 810
type GNFData :: (k -> Type) -> Constraint
#endif

class GNFData f where
grnf :: f a -> ()

Expand Down
Loading
Loading