[Haskell-cafe] arr considered harmful

Serguey Zefirov sergueyz at gmail.com
Tue Nov 1 11:36:55 CET 2011


2011/11/1 Ryan Ingram <ryani.spam at gmail.com>:
> For example, I would love to be able to use the arrow syntax to define
> objects of this type:
>
> data Circuit a b where
>     Const :: Bool -> Circuit () Bool
>     Wire :: Circuit a a
>     Delay :: Circuit a a
>     And :: Circuit (Bool,Bool) Bool
>     Or :: Circuit (Bool,Bool) Bool
>     Not :: Circuit Bool Bool
>     Then :: Circuit a b -> Circuit b c -> Circuit a c
>     Pair :: Circuit a c -> Circuit b d -> Circuit (a,b) (c,d)
>     First :: Circuit a b -> Circuit (a,c) (b,c)
>     Swap :: Circuit (a,b) (b,a)
>     AssocL :: Circuit ((a,b),c) (a,(b,c))
>     AssocR :: Circuit (a,(b,c)) ((a,b),c)
>     Loop :: Circuit (a,b) (a,c) -> Circuit b c
> etc.
>

Would you mind give me some examples on how you desribe real circuits
with that abstraction and, especially, an Arrow instance (even
imaginary one)?

I am interested because I thought about an approach like that and
found it not easy to use one. So I stuck with monadic netlists.



More information about the Haskell-Cafe mailing list