Safe Haskell | None |
---|---|
Language | Haskell2010 |
- class Resolvable a r | a -> r where
- resolve :: a -> r
- class Compilable a r b s | a -> r, b -> s, a s -> b, r b -> a where
- ($$$) :: (r -> s) -> a -> b
- ($$) :: Compilable a1 (Wrapped (t -> a) b) t1 (Wrapped a b) => (t -> a1) -> t -> t1
- class FixResolvable a r | a -> r where
- fixResolve :: a -> r
- class FixCompilable a r b s | a -> r, b -> s, a s -> b, r b -> a where
- (###) :: (r -> s) -> a -> b
- (##) :: FixCompilable a (Wrapped (r -> a1) b) (r -> r1) (Wrapped a1 b) => a -> r -> r1
- apInOut :: Compilable a b b c => (b -> c) -> a -> c
- fixApInOut :: FixCompilable a b b c => (b -> c) -> a -> c
- flipC :: Compilable a1 (a -> b -> c) c (b -> a -> c) => (a -> b -> a1) -> b -> a -> c
- fixFlipC :: FixCompilable a (a1 -> b -> c) (a1 -> b -> c) (b -> a1 -> c) => a -> b -> a1 -> c
- replaceFW :: a -> Wrapped a b -> Wrapped a b
- compile :: (Compilable a1 (Wrapped a b) r (Wrapped a b), Resolvable a1 (Wrapped a b1)) => a1 -> r
- fixCompile :: (Compilable a1 (Wrapped a b) r (Wrapped a b), Resolvable a1 (Wrapped a b1)) => a1 -> r
Documentation
class Resolvable a r | a -> r where Source
This class is of functions with type a
and final return type r
.
Additionally, r
should be of the form: Wrapped
a b
resolve
resolves a "Resolvable
a r" to r
Resolvable a r => Resolvable (t -> a) r Source | |
Resolvable (Wrapped a b) (Wrapped a b) Source |
class Compilable a r b s | a -> r, b -> s, a s -> b, r b -> a where Source
($$$) :: (r -> s) -> a -> b infixr 2 Source
`($$$) f wrappedFunction` essentially applies f
directly to the
Wrapped
part of wrappedFunction
.
Compilable a r b s => Compilable (t -> a) r (t -> b) s Source | |
Compilable (Wrapped a b) (Wrapped a b) (Wrapped c d) (Wrapped c d) Source |
($$) :: Compilable a1 (Wrapped (t -> a) b) t1 (Wrapped a b) => (t -> a1) -> t -> t1 infixl 1 Source
Given a simple Compilable
function:
plus :: Int -> Int -> Wrapped (Int -> Int -> Int) Int
You can use `($$)` to apply plus
to both the outer (Int
-> Int
-> ..)
and innner (Wrapped
(Int
-> ..)) functions of plus
. For example:
>>>
plus $$ 1 $$ 2
Wrap 3 3
class FixResolvable a r | a -> r where Source
See Resolvable
fixResolve :: a -> r Source
FixResolvable a r => FixResolvable (Fix t -> a) r Source | |
FixResolvable (Wrapped a b) (Wrapped a b) Source |
class FixCompilable a r b s | a -> r, b -> s, a s -> b, r b -> a where Source
See Compilable
FixCompilable a r b s => FixCompilable (Fix t -> a) r (Fix t -> b) s Source | |
FixCompilable (Wrapped a b) (Wrapped a b) (Wrapped c d) (Wrapped c d) Source |
(##) :: FixCompilable a (Wrapped (r -> a1) b) (r -> r1) (Wrapped a1 b) => a -> r -> r1 Source
See `($$)`
apInOut :: Compilable a b b c => (b -> c) -> a -> c Source
Apply a function to a Compilable
from the outside
(just regular application) and also inside (`($$$)`)
fixApInOut :: FixCompilable a b b c => (b -> c) -> a -> c Source
See apInOut
flipC :: Compilable a1 (a -> b -> c) c (b -> a -> c) => (a -> b -> a1) -> b -> a -> c Source
Flip a compilable function
fixFlipC :: FixCompilable a (a1 -> b -> c) (a1 -> b -> c) (b -> a1 -> c) => a -> b -> a1 -> c Source
See flipC
compile :: (Compilable a1 (Wrapped a b) r (Wrapped a b), Resolvable a1 (Wrapped a b1)) => a1 -> r Source
Compile a compilable function, essentially by resolving to the wrapped function and return value, unwrapping the non-compilable function (i.e. getting the compiled version), and replacing the original non-compilable function.
fixCompile :: (Compilable a1 (Wrapped a b) r (Wrapped a b), Resolvable a1 (Wrapped a b1)) => a1 -> r Source
See compile