Custom Query (7482 matches)

Filters
 
Or
 
  
 
Columns

Show under each result:


Results (7 - 9 of 7482)

1 2 3 4 5 6 7 8 9 10 11 12 13
Ticket Resolution Summary Owner Reporter
#5679 wontfix Provide Arrow lift functions for Control.Arrow A1kmm
Description

It is currently difficult to build complex datastructures by combining arrows, because there are no lift functions defined on Arrow. These can be built easily from the class functions:

liftArrow :: Arrow a => (c -> d) -> a b c -> a b d
liftArrow = (^>>)
liftArrow2 :: Arrow a => (c -> c' -> d) -> a b c -> a b c' -> a b d
liftArrow2 f a1 a2 = arr (\a -> (a, a)) >>> (a1 *** a2) >>> arr (\(a, b) -> f a b)
liftArrow3 :: Arrow a => (c -> c' -> c'' -> d) -> a b c -> a b c' -> a b c'' -> a b d
liftArrow3 f a1 a2 a3 = arr (\a -> (a, (a, a))) >>> (a1 *** a2 *** a3) >>> arr (\(a, (b, c)) -> f a b c)
liftArrow4 :: Arrow a => (c -> c' -> c'' -> c''' -> d) -> a b c -> a b c' -> a b c'' -> a b c''' -> a b d
liftArrow4 f a1 a2 a3 a4 = arr (\a -> (a, (a, (a, a)))) >>> (a1 *** a2 *** a3 *** a4) >>> arr (\(a, (b, (c, d))) -> f a b c d)
liftArrow5 :: Arrow a => (c -> c' -> c'' -> c''' -> c'''' -> d) -> a b c -> a b c' -> a b c'' -> a b c''' -> a b d
liftArrow5 f a1 a2 a3 a4 a5 = arr (\a -> (a, (a, (a, (a, a))))) >>> (a1 *** a2 *** a3 *** a4 *** a5) >>> arr (\(a, (b, (c, (d, e)))) -> f a b c d e)

I suggest these be added to Control.Arrow.

elliott suggested (on #haskell on Freenode) that something like arr2 = arr . uncurry could be defined as a building block, from which the lift functions could be defined.

#5758 wontfix Add a safe index to Data.Foldable A1kmm
Description

Data.Foldable has no easy way to do indexing at all, and the libraries lack an easy way to do safe indexing even on [].

I therefore propose that a safe index operator be added to base; something like the following:

(!!?) :: Data.Foldable.Foldable f => f a -> Int -> Maybe a f !!? i = either Just (const Nothing) $

Data.Foldable.foldl (\a v -> a >>=

\idx -> if idx == 0 then Left v else Right (idx - 1))

(Right i) f

safeIndex = (!!?)

Usage example:

map ([1,2,3]!!?) [0..10]

[Just 1,Just 2,Just 3,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing]

#796 invalid Literate pre-processor fails to see end of code in LaTeX Adam
Description

Using the code environment in a LaTeX document to place Haskell source, if trying to read the file, the Literate pre-processor fails to see the \end{code} tag, as in the following example:

\begin{code}
> module Main where
> main = do
>     someStuff
\end{code}
1 2 3 4 5 6 7 8 9 10 11 12 13
Note: See TracQuery for help on using queries.