data Proxy : Type -> Type -> Type -> Type -> (Type -> Type) -> Type -> Type where
Request : a' -> (a -> Proxy a' a b' b m r ) -> Proxy a' a b' b m r
Respond : b -> (b' -> Proxy a' a b' b m r ) -> Proxy a' a b' b m r
M : m (Proxy a' a b' b m r) -> Proxy a' a b' b m r
Pure : r -> Proxy a' a b' b m r
instance (Monad m) => Functor (Proxy a' a b' b m) where
map f p = case p of
Request a' fa => Request a' (\a => map f (fa a ))
Respond b fb' => Respond b (\b' => map f (fb' b'))
M m => M (m >>= \p' => return (map f p'))
Pure r => Pure (f r)
{- The follow erro is caused by using the Functor instance below.
ExampleProblems.idr:24:53:
When elaborating right hand side of ExampleProblems.case block in Prelude.Functor.Proxy a' a b' b m instance of Prelude.Functor.Functor, method map, go:
When elaborating argument p1 to Prelude.Functor.Proxy a' a b' b m instance of Prelude.Functor.Functor, method map, go:
Can't unify
Proxy a'1 a b' b m a1
with
Proxy a' a b' b m a1
Specifically:
Can't unify
a'1
with
a'
instance Monad m => Functor (Proxy a' a b' b m) where
map f p0 = go p0 where
go p = case p of
Request a' fa => Request a' (\a => go (fa a ))
Respond b fb' => Respond b (\b' => go (fb' b'))
M m => M (m >>= \p' => return (go p'))
Pure r => Pure (f r)
-}
> runEffect $ for (each [1..1]) (lift . print) -- does not report type error
io_bind (io_bind (io_bind (MkIO (\{w0} =>
mkForeignPrim (FFun "putStr" [FString] FUnit)
(prim__concat (show 1) "\n")
w))
(\{r0} => io_return (Pure r)))
(\p' =>
io_return (case block in bbind IO
X
()
()
X
()
()
(constructor of Prelude.Monad.Monad (\{meth0} =>
\{meth1} =>
\{meth2} =>
\{meth3} =>
io_bind meth
meth))
p'
(\{b'0} => Pure ())
p')))
(Pipes.Core.runEffect, go IO
()
(constructor of Prelude.Monad.Monad (\{meth0} =>
\{meth1} =>
\{meth2} =>
\{meth3} =>
io_bind meth
meth))) : IO ()
module Main
import Pipes.Prelude
main : IO ()
main = runEffect $ for (each [1..3]) (lift . print)
Command line:
$ ~/.cabal/bin/idris Main.idr -o Main
./Pipes/Internal.idr:77:6:Prelude.Functor.Proxy a' a b' b m instance of Prelude.Functor.Functor, method map is possibly not total due to: Prelude.Functor.case block in Proxy a' a b' b m instance of Prelude.Functor.Functor, method map
./Pipes/Internal.idr:103:5:Prelude.Applicative.Proxy a' a b' b m instance of Prelude.Applicative.Applicative, method <$> is possibly not total due to: Prelude.Applicative.case block in Proxy a' a b' b m instance of Prelude.Applicative.Applicative, method <$>
./Pipes/Internal.idr:119:5:Prelude.Monad.Proxy a' a b' b m instance of Prelude.Monad.Monad, method >>= is possibly not total due to: Pipes.Internal.bbind
./Pipes/Internal.idr:185:5:Control.Monad.Reader.r, Proxy a' a b' b m instance of Control.Monad.Reader.MonadReader, method local is possibly not total due to: Control.Monad.Reader.case block in r, Proxy a' a b' b m instance of Control.Monad.Reader.MonadReader, method local
./Pipes/Internal.idr:77:6:Cannot compile:
Prelude.Functor.Proxy a' a b' b m instance of Prelude.Functor.Functor, method map is possibly not total due to: Prelude.Functor.case block in Proxy a' a b' b m instance of Prelude.Functor.Functor, method map
Producer' : {x' : Type} -> {x : Type} -> Type -> (Type -> Type) -> Type -> TypeProducer' {x'} {x} a = Proxy x' x () a
yield : Monad m => a -> Producer' {x'} {x} a m ()yield = respond
--
You received this message because you are subscribed to the Google Groups "Idris Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to idris-lang+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
3) Running code like:runEffect $ stdinLn >-> take 3 >-> stdoutLnIn the repl seems to be non-terminating. In particular anything that uses fromHandler:https://github.com/Davorak/Haskell-Pipes-Library/blob/89ca53) Running code like:runEffect $ stdinLn >-> take 3 >-> stdoutLnIn the repl seems to be non-terminating. In particular anything that uses fromHandler:
4) The forth issue I am having is recreating Haskell type synonym functionality. What I am using right now:Producer' : {x' : Type} -> {x : Type} -> Type -> (Type -> Type) -> Type -> TypeProducer' {x'} {x} a = Proxy x' x () aBut the when I use it in a function like `yield`:yield : Monad m => a -> Producer' {x'} {x} a m ()yield = respondI end up having to supply all 6 type parameters anyway, which is normally avoid in Haskell with type synonym. So it seems like I might as well use `Proxy` directly.It does allow for yield to be used as a `Producer` or a `Pipe` which is the intended purpose of the `Producer'` type synonym.
--Patrick Wheeler
--
You received this message because you are subscribed to the Google Groups "Idris Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to idris-lang+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.