Skip to content

Commit 8737382

Browse files
authored
Merge pull request #9 from purescript/bump
Prepare for 2.0 release
2 parents 454fc4d + 662c75d commit 8737382

File tree

2 files changed

+19
-54
lines changed

2 files changed

+19
-54
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
"package.json"
2222
],
2323
"dependencies": {
24-
"purescript-foldable-traversable": "^1.0.0"
24+
"purescript-foldable-traversable": "^2.0.0"
2525
}
2626
}

src/Data/Identity.purs

Lines changed: 18 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,44 @@
11
module Data.Identity where
22

3+
import Prelude
4+
35
import Control.Alt (class Alt)
4-
import Control.Applicative (class Applicative)
5-
import Control.Apply (class Apply)
6-
import Control.Bind (class Bind)
76
import Control.Comonad (class Comonad)
87
import Control.Extend (class Extend)
9-
import Control.Monad (class Monad)
10-
11-
import Data.BooleanAlgebra (class BooleanAlgebra)
12-
import Data.Bounded (class Bounded, bottom, top)
13-
import Data.CommutativeRing (class CommutativeRing)
14-
import Data.Eq (class Eq, (==))
15-
import Data.EuclideanRing (class EuclideanRing, degree, mod, (/))
16-
import Data.Field (class Field)
8+
179
import Data.Foldable (class Foldable)
18-
import Data.Functor (class Functor, (<$>))
1910
import Data.Functor.Invariant (class Invariant, imapF)
20-
import Data.HeytingAlgebra (class HeytingAlgebra, not, implies, ff, tt, (||), (&&))
21-
import Data.Monoid (class Monoid, mempty)
22-
import Data.Ord (class Ord, compare)
23-
import Data.Ring (class Ring, (-))
24-
import Data.Semigroup (class Semigroup, (<>))
25-
import Data.Semiring (class Semiring, one, zero, (+), (*))
26-
import Data.Show (class Show, show)
11+
import Data.Monoid (class Monoid)
12+
import Data.Newtype (class Newtype)
2713
import Data.Traversable (class Traversable)
2814

2915
newtype Identity a = Identity a
3016

31-
runIdentity :: forall a. Identity a -> a
32-
runIdentity (Identity x) = x
17+
derive instance newtypeIdentity :: Newtype (Identity a) _
3318

34-
instance eqIdentity :: Eq a => Eq (Identity a) where
35-
eq (Identity x) (Identity y) = x == y
19+
derive newtype instance eqIdentity :: Eq a => Eq (Identity a)
3620

37-
instance ordIdentity :: Ord a => Ord (Identity a) where
38-
compare (Identity x) (Identity y) = compare x y
21+
derive newtype instance ordIdentity :: Ord a => Ord (Identity a)
3922

40-
instance boundedIdentity :: Bounded a => Bounded (Identity a) where
41-
top = Identity top
42-
bottom = Identity bottom
23+
derive newtype instance boundedIdentity :: Bounded a => Bounded (Identity a)
4324

44-
instance heytingAlgebraIdentity :: HeytingAlgebra a => HeytingAlgebra (Identity a) where
45-
ff = Identity ff
46-
tt = Identity tt
47-
implies (Identity x) (Identity y) = Identity (x `implies` y)
48-
conj (Identity x) (Identity y) = Identity (x && y)
49-
disj (Identity x) (Identity y) = Identity (x || y)
50-
not (Identity x) = Identity (not x)
25+
derive newtype instance heytingAlgebraIdentity :: HeytingAlgebra a => HeytingAlgebra (Identity a)
5126

52-
instance booleanAlgebraIdentity :: BooleanAlgebra a => BooleanAlgebra (Identity a) where
27+
derive newtype instance booleanAlgebraIdentity :: BooleanAlgebra a => BooleanAlgebra (Identity a)
5328

54-
instance semigroupIdenity :: Semigroup a => Semigroup (Identity a) where
55-
append (Identity x) (Identity y) = Identity (x <> y)
29+
derive newtype instance semigroupIdenity :: Semigroup a => Semigroup (Identity a)
5630

57-
instance monoidIdentity :: Monoid a => Monoid (Identity a) where
58-
mempty = Identity mempty
31+
derive newtype instance monoidIdentity :: Monoid a => Monoid (Identity a)
5932

60-
instance semiringIdentity :: Semiring a => Semiring (Identity a) where
61-
add (Identity x) (Identity y) = Identity (x + y)
62-
zero = Identity zero
63-
mul (Identity x) (Identity y) = Identity (x * y)
64-
one = Identity one
33+
derive newtype instance semiringIdentity :: Semiring a => Semiring (Identity a)
6534

66-
instance euclideanRingIdentity :: EuclideanRing a => EuclideanRing (Identity a) where
67-
degree (Identity x) = degree x
68-
mod (Identity x) (Identity y) = Identity (x `mod` y)
69-
div (Identity x) (Identity y) = Identity (x / y)
35+
derive newtype instance euclideanRingIdentity :: EuclideanRing a => EuclideanRing (Identity a)
7036

71-
instance ringIdentity :: Ring a => Ring (Identity a) where
72-
sub (Identity x) (Identity y) = Identity (x - y)
37+
derive newtype instance ringIdentity :: Ring a => Ring (Identity a)
7338

74-
instance commutativeRingIdentity :: CommutativeRing a => CommutativeRing (Identity a)
39+
derive newtype instance commutativeRingIdentity :: CommutativeRing a => CommutativeRing (Identity a)
7540

76-
instance fieldIdentity :: Field a => Field (Identity a)
41+
derive newtype instance fieldIdentity :: Field a => Field (Identity a)
7742

7843
instance showIdentity :: Show a => Show (Identity a) where
7944
show (Identity x) = "(Identity " <> show x <> ")"

0 commit comments

Comments
 (0)