| Copyright | (c) Justin Le 2019 |
|---|---|
| License | BSD3 |
| Maintainer | justin@jle.im |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Data.Functor.Combinator.Unsafe
Description
Working with non-standard typeclasses like Plus, Apply, Bind, and
Pointed will sometimes cause problems when using with libraries that
do not provide instances, even though their types already are instances
of Alternative or Applicative or Monad.
This module provides unsafe methods to "promote" Applicative instances
to Apply, Alternative to Plus, etc.
They are unsafe in the sense that if those types already have those
instances, this will cause overlapping instances errors or problems with
coherence. Because of this, you should always use these with specific
fs, and never in a polymorphic way over f.
Synopsis
- unsafePlus :: forall f proxy r. Alternative f => proxy f -> (Plus f => r) -> r
- unsafeApply :: forall f proxy r. Applicative f => proxy f -> (Apply f => r) -> r
- unsafeBind :: forall f proxy r. Monad f => proxy f -> (Bind f => r) -> r
- unsafePointed :: forall f proxy r. Applicative f => proxy f -> (Pointed f => r) -> r
- unsafeConclude :: forall f proxy r. Decidable f => proxy f -> (Conclude f => r) -> r
- unsafeDivise :: forall f proxy r. Divisible f => proxy f -> (Divise f => r) -> r
- unsafeInvariantCo :: forall f proxy r. Functor f => proxy f -> (Invariant f => r) -> r
- unsafeInvariantContra :: forall f proxy r. Contravariant f => proxy f -> (Invariant f => r) -> r
- unsafeInplyCo :: forall f proxy r. Apply f => proxy f -> (Inply f => r) -> r
- unsafeInplyContra :: forall f proxy r. Divise f => proxy f -> (Inply f => r) -> r
- unsafeInplicativeCo :: forall f proxy r. (Applicative f, Invariant f) => proxy f -> (Inplicative f => r) -> r
- unsafeInplicativeContra :: forall f proxy r. (Divisible f, Invariant f) => proxy f -> (Inplicative f => r) -> r
Documentation
unsafePlus :: forall f proxy r. Alternative f => proxy f -> (Plus f => r) -> r Source #
For any , produce a value that would require Alternative f.Plus
f
Always use with concrete and specific f only, and never use with any
f that already has a Plus instance.
The Proxy argument allows you to specify which specific f
you want to enhance. You can pass in something like .Proxy
@MyFunctor
unsafeApply :: forall f proxy r. Applicative f => proxy f -> (Apply f => r) -> r Source #
For any , produce a value that would require Applicative f.Apply
f
Always use with concrete and specific f only, and never use with any
f that already has a Apply instance.
The Proxy argument allows you to specify which specific f
you want to enhance. You can pass in something like .Proxy
@MyFunctor
unsafeBind :: forall f proxy r. Monad f => proxy f -> (Bind f => r) -> r Source #
unsafePointed :: forall f proxy r. Applicative f => proxy f -> (Pointed f => r) -> r Source #
For any , produce a value that would require
Applicative f.Pointed f
Always use with concrete and specific f only, and never use with any
f that already has a Pointed instance.
The Proxy argument allows you to specify which specific f
you want to enhance. You can pass in something like .Proxy
@MyFunctor
unsafeConclude :: forall f proxy r. Decidable f => proxy f -> (Conclude f => r) -> r Source #
For any , produce a value that would require Decidable f.Conclude
f
Always use with concrete and specific f only, and never use with any
f that already has a Conclude instance.
The Proxy argument allows you to specify which specific f
you want to enhance. You can pass in something like .Proxy
@MyFunctor
Since: 0.3.0.0
unsafeDivise :: forall f proxy r. Divisible f => proxy f -> (Divise f => r) -> r Source #
For any , produce a value that would require Divisible f.Divise
f
Always use with concrete and specific f only, and never use with any
f that already has a Divise instance.
The Proxy argument allows you to specify which specific f
you want to enhance. You can pass in something like .Proxy
@MyFunctor
Since: 0.3.0.0
unsafeInvariantCo :: forall f proxy r. Functor f => proxy f -> (Invariant f => r) -> r Source #
For any , produce a value that would require Functor f.Invariant
f
Always use with concrete and specific f only, and never use with any
f that already has an Invariant instance.
The Proxy argument allows you to specify which specific f
you want to enhance. You can pass in something like .Proxy
@MyFunctor
Since: 0.4.1.0
unsafeInvariantContra :: forall f proxy r. Contravariant f => proxy f -> (Invariant f => r) -> r Source #
For any , produce a value that would require Contravariant f.Invariant
f
Always use with concrete and specific f only, and never use with any
f that already has an Invariant instance.
The Proxy argument allows you to specify which specific f
you want to enhance. You can pass in something like .Proxy
@MyFunctor
Since: 0.4.1.0
unsafeInplyCo :: forall f proxy r. Apply f => proxy f -> (Inply f => r) -> r Source #
For any , produce a value that would require Apply f.Inply
f
Always use with concrete and specific f only, and never use with any
f that already has an Inply instance.
The Proxy argument allows you to specify which specific f
you want to enhance. You can pass in something like .Proxy
@MyFunctor
Since: 0.4.1.0
unsafeInplyContra :: forall f proxy r. Divise f => proxy f -> (Inply f => r) -> r Source #
For any , produce a value that would require Divise f.Inply
f
Always use with concrete and specific f only, and never use with any
f that already has an Inply instance.
The Proxy argument allows you to specify which specific f
you want to enhance. You can pass in something like .Proxy
@MyFunctor
Since: 0.4.1.0
unsafeInplicativeCo :: forall f proxy r. (Applicative f, Invariant f) => proxy f -> (Inplicative f => r) -> r Source #
For any , produce a value that would require
Applicative f.Inplicative f
Always use with concrete and specific f only, and never use with any
f that already has an Inplicative instance.
The Proxy argument allows you to specify which specific f
you want to enhance. You can pass in something like .Proxy
@MyFunctor
Since: 0.4.1.0
unsafeInplicativeContra :: forall f proxy r. (Divisible f, Invariant f) => proxy f -> (Inplicative f => r) -> r Source #
For any , produce a value that would require
Divisibl3 f.Inplicative f
Always use with concrete and specific f only, and never use with any
f that already has an Inplicative instance.
The Proxy argument allows you to specify which specific f
you want to enhance. You can pass in something like .Proxy
@MyFunctor
Since: 0.4.1.0