Skip to content

Commit

Permalink
Reexport Div/Mod from GHC.TypeLits (introduced in GHC 8.4) (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanGlScott committed Dec 14, 2017
1 parent d1863f5 commit 5602258
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ next
`Class () (Monoid a)` instance to `Class (Semigroup a) (Monoid a)` when
`base` is recent enough
* Add the appropriate `Lifting(2)` instances involving `Semigroup`
* `Data.Constraint.Nat` now reexports the `Div` and `Mod` type families from
`GHC.TypeLits` on `base-4.11` or later
* Fix the type signature of `maxCommutes`
* Add `NFData` instances for `Dict` and `(:-)`

Expand Down
3 changes: 3 additions & 0 deletions src/Data/Constraint/Nat.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
Expand Down Expand Up @@ -49,10 +50,12 @@ type family Min (m::Nat) (n::Nat) :: Nat where
Min m m = m
type family Max (m::Nat) (n::Nat) :: Nat where
Max m m = m
#if !(MIN_VERSION_base(4,11,0))
type family Div (m::Nat) (n::Nat) :: Nat where
Div m 1 = m
type family Mod (m::Nat) (n::Nat) :: Nat where
Mod 0 m = 0
#endif
type family Gcd (m::Nat) (n::Nat) :: Nat where
Gcd m m = m
type family Lcm (m::Nat) (n::Nat) :: Nat where
Expand Down

0 comments on commit 5602258

Please sign in to comment.