[Haskell-cafe] Arrow instance of function type [a] -> [b]

Markus Läll markus.l2ll at gmail.com
Wed Jul 6 15:04:49 CEST 2011


Is it possible to define an Arrow instance of list to list functions?
Something like

import Control.Arrow
import Control.Category

type X a b = [a] -> [b]

instance Category X where
   id = map Prelude.id
   g . f = g Prelude.. f

instance Arrow X where
   arr f = map f
   first f = unzip >>> first f >>> uncurry zip

The problem is that it's not allowed to use partially applied type
synonyms. It is however possible to define a type synonym which value
is a partially applied type, but I haven't been able to figure out if
I could somehow use that fact in defining the X... Is it at all
possible, or is a newtype the only way to do it?

Markus Läll

More information about the Haskell-Cafe mailing list