
16 Mar
2010
16 Mar
'10
12:39 a.m.
Hello. TupleInstances It's a really small library that provides instances for Functor, Applicative, Foldable and Traversable for tuples of the form (a,a...a). It uses newtypes to wrap the tuples and Template Haskell to generate the code. Here's an example of these instances in action: example6 :: (Int, Int) -> [(Int, Int)] example6 p = map unT $ liftA2 (+) (T2 p) <$> moves where moves = tail $ traverse (\x -> [0,x+1,x-1]) (pure 0 :: T2 Int) -- > Result with (1,1): [(1,2),(1,0),(2,1),(2,2),(2,0),(0,1),(0,2),(0,0)] More examples here: http://github.com/diegoeche/tupleinstances/raw/master/README PS: This is also my first package uploaded to Hackage. I would appreciate any feedback. Best Regards, Diego Echeverri
5548
Age (days ago)
5548
Last active (days ago)
0 comments
1 participants
participants (1)
-
Diego Echeverri