| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Iso.Deriving
Synopsis
- type Iso s t a b = forall p f. (Profunctor p, Functor f) => p a (f b) -> p s (f t)
- type Iso' s a = Iso s s a a
- newtype As (a :: Type) b = As b
- newtype As1 (f :: k1 -> Type) (g :: k1 -> Type) (a :: k1) = As1 {
- getAs1 :: g a
- newtype As2 f g a b = As2 (g a b)
- class Inject a b where
- inj :: a -> b
- class Project a b where
- prj :: b -> a
- class (Inject a b, Project a b) => Isomorphic a b where
Documentation
type Iso s t a b = forall p f. (Profunctor p, Functor f) => p a (f b) -> p s (f t) Source #
newtype As (a :: Type) b Source #
As a b is represented at runtime as b, but we know we can in fact
convert it into an a with no loss of information.
We can think of it as
having a dual representation as either a or b.
Constructors
| As b |
Instances
| (Project a b, Eq a) => Eq (As a b) Source # | |
| (Isomorphic a b, Num a) => Num (As a b) Source # | |
| (Project a b, Ord a) => Ord (As a b) Source # | |
| (Isomorphic a b, Real a) => Real (As a b) Source # | |
Defined in Iso.Deriving Methods toRational :: As a b -> Rational # | |
| (Project a b, Show a) => Show (As a b) Source # | |
| (Isomorphic a b, Semigroup a) => Semigroup (As a b) Source # | |
| (Isomorphic a b, Monoid a) => Monoid (As a b) Source # | |
newtype As1 (f :: k1 -> Type) (g :: k1 -> Type) (a :: k1) Source #
Like As for kind k -> Type.
Instances
| (forall x. Isomorphic (f x) (g x), MonadWriter s f) => MonadWriter s (As1 f g) Source # | |
| (forall x. Isomorphic (f x) (g x), MonadState s f) => MonadState s (As1 f g) Source # | |
| (forall x. Isomorphic (f x) (g x), MonadReader s f) => MonadReader s (As1 f g) Source # | |
| (forall x. Isomorphic (f x) (g x), Monad f) => Monad (As1 f g) Source # | |
| (forall x. Isomorphic (f x) (g x), Functor f) => Functor (As1 f g) Source # | |
| (forall x. Isomorphic (f x) (g x), Applicative f) => Applicative (As1 f g) Source # | |
| (forall x. Isomorphic (f x) (g x), Alternative f) => Alternative (As1 f g) Source # | |
Like As for kind k1 -> k2 -> Type.
Constructors
| As2 (g a b) |