[GHC] #13026: RFC functions for sums and products
GHC
ghc-devs at haskell.org
Thu Dec 22 01:33:42 UTC 2016
#13026: RFC functions for sums and products
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: libraries/base | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Iceland_jack):
Some other
{{{#!hs
type f ~> g = forall x. f x -> g x
(****) :: f ~> f' -> g ~> g' -> Product f g ~> Product f' g'
(f **** g) (fa `Pair` ga) = f fa `Pair` g ga
first' :: f ~> f' -> Product f g ~> Product f' g
first' = (**** id)
second' :: g ~> g' -> Product f g ~> Product f g'
second' = (id ****)
(++++) :: f ~> f' -> g ~> g' -> Sum f g ~> Sum f' g'
f ++++ g = \case
InL fa -> InL (f fa)
InR ga -> InR (g ga)
left' :: f ~> f' -> Sum f g ~> Sum f' g
left' = (++++ id)
right' :: g ~> g' -> Sum f g ~> Sum f g'
right' = (id ++++)
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13026#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list