[Haskell-beginners] does this function exist already? (a -> b -> c) -> (d -> b) -> (( a -> d -> c ))

Silent Leaf silent.leaf0 at gmail.com
Fri Apr 8 22:48:38 UTC 2016


Ok thanks! By the way, I didn't know the formatting (especially,
code/noncode distinction) was erased in the process of archiving my mail,
sorry for the unfortunate, probable, unreadability of my first message.

Actually, I have another question that somewhat is in continuity, as
regards one definition I found for after2 (with another name of course,
though here it's irrelevant):
> after2 :: (c -> d) -> (a -> b -> c) -> a -> b -> d
> after2 f = ((f .) .)

I checked by recursion, mostly to actually understand why/how it works, and
it's pretty cool, if I may.
> f :: c -> d
> (f .) :: (b -> c) -> (b -> d)
> ((f .) .) :: (a -> (b -> c)) -> (a -> (b -> d)) == (a -> b -> c) -> (a ->
b -> d)

Or seen from another angle:
> f (g a b) :: d
> (f .) (g a) :: b -> d
> ((f .) .) g :: (a -> b -> d)

>From there, I had the idea and desire to check if we could build a
generalization of this operation, in this fashion:
> testOp :: Int -> (c -> d) -> ? --Here i'm stuck since it looks like it
should basically be a sort of recursive type of function, or something??
> testOp 0 f = f
> testOp n f = ((testOp (n-1) f) .)

hence with this definition, (testOp 2) == after2 and (testOp 1) == (.)
Is this "testOp" writable? If so, what would it need?
Thanks in advance! :)

2016-04-09 0:09 GMT+02:00 Sumit Sahrawat, Maths & Computing, IIT (BHU) <
sumit.sahrawat.apm13 at iitbhu.ac.in>:

> No need to do anything. On the list you can only send and receive emails.
>

2016-04-09 0:04 GMT+02:00 Silent Leaf <silent.leaf0 at gmail.com>:

> Hoogle was my first stop, didn't find anything, but Hayoo is much more
> complete, found all of it!
>
> "My" after2 has no less than 4 different synonymous: (oo), (.:), (comp2),
> (dot). and i checked my curry theory as correct.
> I found "point2" too right beside (.:), dubbed (.^).
> Those two inside a "pointlessfun" package (?) ^^
>
> Hence, thanks, I found what I needed. :)
> Do I need to close or mark the discussion as "solved" or something,
> somehow?
>
>
> Le vendredi 8 avril 2016, Sumit Sahrawat, Maths & Computing, IIT (BHU) <
> sumit.sahrawat.apm13 at iitbhu.ac.in> a écrit :
> > Hi, you might wanna take a look at Hoogle and Hayoo. They allow you to
> search for functions using names or type signatures.
> >
> > Hope this helps.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160409/d0922b80/attachment-0001.html>


More information about the Beginners mailing list