3 ms·
What about: import Prelude hiding ((.)) import Control.Category import Control.Arrow half' = Kleisli half ... runKleisli (half' . ha
by dllthomas 13y ago
What about:
import Prelude hiding ((.))
import Control.Category
import Control.Arrow
half' = Kleisli half
...
runKleisli (half' . half') 8
- tome 13y agoVery nice.
- prof_hobart 13y agoInteresting. Does point to another reason why I've struggled with Haskell so far though - not having done university-level maths, I regularly hit terms (such as Kleisli categories) that mean absolutely nothing to me, and looking it up on Wikipedia makes my brain bleed. I appreciate this is my problem rather than the language's, but I've worked in a huge array of different languages in the past 30 years and it's only ever functional ones where I hit the "what the hell does this even mean?" wall whilst trying to learn them...
- tome 13y agoTrying to understand monads and the Kleisli newtype by looking at the Wikipedia pages on monads and Kleisli categories is probably going to do more harm than good. Trying to understand what a monad "is" is probably not worthwhile. It's actually quite easy to work out how to use them just by playing around with them.
- dllthomas 13y agoYeah, I don't think I've actually used Kleisli in production code. Learning what a monad "is" is very worthwhile, but it's not where you start, because it's only tangentially related to how a monad is used.