Skip to content

@spockz /error-7.4.2.txt secret
Last active

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
[1 of 1] Compiling Main ( from.hs, interpreted )
from.hs:36:8:
No instances for (Typeable c, Typeable b)
arising from a use of `arr'
In the expression: arr
When checking that `arr' (needed by a syntactic construct)
has the required type: forall b c. (b -> c) -> R b c
arising from a proc expression at from.hs:(36,8)-(43,30)
In the expression:
proc n -> case n of {
0 -> returnA -< 0
1 -> returnA -< 1
n'
-> do { l <- ...;
.... } }
from.hs:36:8:
No instances for (Typeable c, Typeable b, Typeable a)
arising from a use of `>>>'
In the expression: (>>>)
When checking that `(>>>)' (needed by a syntactic construct)
has the required type: forall a b c. R a b -> R b c -> R a c
arising from a proc expression at from.hs:(36,8)-(43,30)
In the expression:
proc n -> case n of {
0 -> returnA -< 0
1 -> returnA -< 1
n'
-> do { l <- ...;
.... } }
from.hs:36:8:
No instances for (Typeable d, Typeable c, Typeable b)
arising from a use of `first'
In the expression: first
When checking that `first' (needed by a syntactic construct)
has the required type: forall b c d. R b c -> R (b, d) (c, d)
arising from a proc expression at from.hs:(36,8)-(43,30)
In the expression:
proc n -> case n of {
0 -> returnA -< 0
1 -> returnA -< 1
n'
-> do { l <- ...;
.... } }
from.hs:36:8:
No instances for (Typeable d, Typeable c, Typeable b)
arising from a use of `|||'
In the expression: (|||)
When checking that `(|||)' (needed by a syntactic construct)
has the required type: forall b d c.
R b d -> R c d -> R (Either b c) d
arising from a proc expression at from.hs:(36,8)-(43,30)
In the expression:
proc n -> case n of {
0 -> returnA -< 0
1 -> returnA -< 1
n'
-> do { l <- ...;
.... } }
Failed, modules loaded: none.
[1 of 1] Compiling Main ( from.hs, interpreted )
from.hs:36:8:
No instance for (Typeable c) arising from a use of `arr'
Possible fix:
add (Typeable c) to the context of
a type expected by the context: (b -> c) -> R b c
In the expression: arr
When checking that `arr' (needed by a syntactic construct)
has the required type: forall b1 c1. (b1 -> c1) -> R b1 c1
arising from a proc expression at from.hs:(36,8)-(43,30)
In the expression:
proc n -> case n of {
0 -> returnA -< 0
1 -> returnA -< 1
n'
-> do { l <- ...;
.... } }
from.hs:36:8:
No instance for (Typeable c) arising from a use of `>>>'
Possible fix:
add (Typeable c) to the context of
a type expected by the context: R a b -> R b c -> R a c
In the expression: (>>>)
When checking that `(>>>)' (needed by a syntactic construct)
has the required type: forall a1 b1 c1.
R a1 b1 -> R b1 c1 -> R a1 c1
arising from a proc expression at from.hs:(36,8)-(43,30)
In the expression:
proc n -> case n of {
0 -> returnA -< 0
1 -> returnA -< 1
n'
-> do { l <- ...;
.... } }
from.hs:36:8:
No instance for (Typeable d) arising from a use of `first'
Possible fix:
add (Typeable d) to the context of
a type expected by the context: R b c -> R (b, d) (c, d)
In the expression: first
When checking that `first' (needed by a syntactic construct)
has the required type: forall b1 c1 d1.
R b1 c1 -> R (b1, d1) (c1, d1)
arising from a proc expression at from.hs:(36,8)-(43,30)
In the expression:
proc n -> case n of {
0 -> returnA -< 0
1 -> returnA -< 1
n'
-> do { l <- ...;
.... } }
from.hs:36:8:
No instance for (Typeable d) arising from a use of `|||'
Possible fix:
add (Typeable d) to the context of
a type expected by the context: R b d -> R c d -> R (Either b c) d
In the expression: (|||)
When checking that `(|||)' (needed by a syntactic construct)
has the required type: forall b1 d1 c1.
R b1 d1 -> R c1 d1 -> R (Either b1 c1) d1
arising from a proc expression at from.hs:(36,8)-(43,30)
In the expression:
proc n -> case n of {
0 -> returnA -< 0
1 -> returnA -< 1
n'
-> do { l <- ...;
.... } }
Failed, modules loaded: none.
{-# LANGUAGE GADTs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RebindableSyntax #-}
{-# LANGUAGE Arrows #-}
{-# LANGUAGE RankNTypes #-}
module Main where
import Data.Typeable
import Prelude (Int, Bool, Either(..), fromInteger, (==), (-), (+), flip)
data R a b where
Id :: (Typeable a, Typeable b)
=> R a b
Comp :: (Typeable a, Typeable b, Typeable c)
=> R b c -> R a b -> R a c
Arr :: (Typeable a, Typeable b)
=> (a -> b) -> R a b
Split :: (Typeable b, Typeable b', Typeable c, Typeable c')
=> R b c -> R b' c' -> R (b,b') (c,c')
Cache :: Typeable a
=> (a -> a -> Bool) -> R a a
-- ArrowChoice
Choice :: (Typeable b, Typeable b', Typeable c, Typeable c')
=> R b c -> R b' c' -> R (Either b b') (Either c c')
-- ArrowLoop
Loop :: (Typeable b, Typeable c, Typeable d)
=> R (b, d) (c, d) -> R b c
-- ArrowApply
Apply :: (Typeable b, Typeable c)
=> R (R b c, b) c
fib :: R Int Int
fib = proc n ->
case n of
0 -> returnA -< 0
1 -> returnA -< 1
n' ->
do l <- fib -< (n'-2)
r <- fib -< (n'-1)
returnA -< (l+r)
-- Arrow stuff
arr :: (Typeable a, Typeable b) => (a -> b) -> R a b
arr = Arr
first :: (Typeable b, Typeable c, Typeable d)
=> R b c -> R (b, d) (c, d)
first = (*** id)
second :: (Typeable b, Typeable c, Typeable d)
=> R b c -> R (d, b) (d, c)
second = (id ***)
(***) :: (Typeable b, Typeable b', Typeable c, Typeable c')
=> R b c -> R b' c' -> R (b,b') (c,c')
(***) = Split
left :: (Typeable b, Typeable c, Typeable d)
=> R b c -> R (Either b d) (Either c d)
left = (+++ id)
right :: (Typeable b, Typeable c, Typeable d)
=> R b c -> R (Either d b) (Either d c)
right = (id +++)
(+++) :: (Typeable b, Typeable b', Typeable c, Typeable c')
=> R b c -> R b' c' -> R (Either b b') (Either c c')
(+++) = Choice
(>>>) :: (Typeable a, Typeable b, Typeable c)
=> R a b -> R b c -> R a c
(>>>) = flip Comp
id :: Typeable a => R a a
id = Id
returnA :: Typeable a => R a a
returnA = Id
(|||) :: (Typeable b, Typeable c, Typeable d)
=> R b d -> R c d -> R (Either b c) d
f ||| g = f +++ g >>> arr untag
where
untag (Left x) = x
untag (Right y) = y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.