#4189: (<.>) operator (generalizing (.) to Functor)
---------------------------------+------------------------------------------
Reporter: uzytkownik | Owner:
Type: feature request | Status: new
Priority: normal | Component: libraries/base
Version: 6.12.3 | Keywords:
Os: Unknown/Multiple | Testcase:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
Comment(by uzytkownik):
1. Because it follows simple correspondence:
{{{
(a . b . c) d = a $ b $ c $ d
(a <.> b <.> c) d = a <$> b <$> c <$> d
}}}
2. Because your definition does not allow chaining (well - the whiole
point of such operator is chaining) [I know it is 'for example']:
{{{
\a b c -> a <.> b <.> c :: (Functor f, Functor f1) => (f c1 -> c) -> (b ->
c1) -> (a -> b) -> f1 (f a) -> f1 c
}}}
or
{{{
\a b c -> a <.> b <.> c :: (Functor f, Functor f1) => (b -> c) -> (a -> b)
-> (a1 -> f a) -> f1 a1 -> f1 (f c)
}}}
3. I decided to post it when I found [http://twan.home.fmf.nl/blog/haskell
/more-function-composition.details others find it useful as well] - with
the same definition.
4. It allows to chain even if first function parameter is not functor:
{{{
read <.> readFile :: (Read a) => FilePath -> IO a
print <=< (read :: String -> Int) <.> readFile :: FilePath -> IO ()
const 1 <.> print <=< (read :: String -> Int) <.> readFile :: (Num t) =>
FilePath -> IO t
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4189#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs