Logs: freenode/#haskell
| 2020-10-21 12:20:14 | × | Stanley00 quits (~stanley00@unaffiliated/stanley00) () |
| 2020-10-21 12:20:41 | <[exa]> | ixlun: anyway, your composed function has 2 parameters, which in the type here have types 'a1' and 'a2'. |
| 2020-10-21 12:20:45 | ski | thought that wasn't too bad |
| 2020-10-21 12:20:46 | <geekosaur> | this is a ghc-specific chaneg from standard Haskell, which is why the wikibook doesn't tlk about it |
| 2020-10-21 12:22:02 | → | kyprizel joins (~kyprizel@185.204.1.185) |
| 2020-10-21 12:22:14 | <ski> | iMonad : for the time being, if you don't want to bother with it right now, you could just make empty instances |
| 2020-10-21 12:22:22 | × | coot quits (~coot@37.30.49.141.nat.umts.dynamic.t-mobile.pl) (Ping timeout: 260 seconds) |
| 2020-10-21 12:23:02 | <ski> | instance Monad m => Functor (MaybeT m) |
| 2020-10-21 12:23:04 | <ski> | where |
| 2020-10-21 12:23:11 | <ski> | fmap = liftM |
| 2020-10-21 12:23:23 | <ski> | instance Monad m => Applicative (MaybeT m) |
| 2020-10-21 12:23:25 | <ski> | where |
| 2020-10-21 12:23:29 | <ski> | pure = return |
| 2020-10-21 12:23:34 | <ski> | (<*>) = ap |
| 2020-10-21 12:23:38 | × | heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 265 seconds) |
| 2020-10-21 12:23:49 | <ski> | would also work, as default implementations, in terms of your `Monad' instance |
| 2020-10-21 12:24:36 | × | coot_ quits (~coot@37.30.51.114.nat.umts.dynamic.t-mobile.pl) (Ping timeout: 265 seconds) |
| 2020-10-21 12:24:55 | <ski> | (however, it would be better to have `Functor f => Functor (MaybeT f)' and `Applicative i => Applicative (MaybeT i)'. but that requires you to do the work of actually implementing those instances "properly", rather than just deferring to the `Monad' instance) |
| 2020-10-21 12:24:59 | <ski> | iMonad ^ |
| 2020-10-21 12:25:43 | <ski> | (to clarify, by "empty instances", i mean just skipping the `where', and the method implementation(s) after it) |
| 2020-10-21 12:27:09 | <iMonad> | @ski what is "ap" comes from ? |
| 2020-10-21 12:27:09 | <lambdabot> | Maybe you meant: wiki src ask |
| 2020-10-21 12:27:23 | × | nicknick quits (75d746c7@117.215.70.199) (Remote host closed the connection) |
| 2020-10-21 12:27:30 | <iMonad> | My ghc complain that is not in scope |
| 2020-10-21 12:27:34 | <ski> | @index ap |
| 2020-10-21 12:27:35 | <lambdabot> | Control.Monad |
| 2020-10-21 12:27:56 | <ski> | it (and `liftM') is defined in terms of `return' and `(>>=)' |
| 2020-10-21 12:27:58 | hackage | haskoin-store-data 0.38.0 - Data for Haskoin Store https://hackage.haskell.org/package/haskoin-store-data-0.38.0 (jprupp) |
| 2020-10-21 12:28:09 | → | da39a3ee5e6b4b0d joins (~textual@n11211935170.netvigator.com) |
| 2020-10-21 12:28:28 | <ski> | so, by defining `(<*>)' as `ap', that makes it call your `return' and `(>>=)' implementations, in your `Monad (MaybeT m)' instance |
| 2020-10-21 12:28:37 | <iMonad> | Oh, it works |
| 2020-10-21 12:28:57 | hackage | haskoin-store 0.38.0 - Storage and index for Bitcoin and Bitcoin Cash https://hackage.haskell.org/package/haskoin-store-0.38.0 (jprupp) |
| 2020-10-21 12:29:01 | × | nbloomf quits (~nbloomf@2600:1700:ad14:3020:6cd0:22a:1738:5d24) (Quit: Textual IRC Client: www.textualapp.com) |
| 2020-10-21 12:29:07 | <ski> | iMonad : now for `(>>=)' ? |
| 2020-10-21 12:29:26 | × | taurux quits (~taurux@net-188-216-37-204.cust.vodafonedsl.it) (Ping timeout: 265 seconds) |
| 2020-10-21 12:30:19 | <iMonad> | wiki example works |
| 2020-10-21 12:30:24 | <ixlun> | Out of interest, what's people's opinion on what's better: `foo . bar . baz $ a' or `foo $ bar $ baz a'? |
| 2020-10-21 12:30:51 | → | cods joins (~fred@tuxee.net) |
| 2020-10-21 12:30:57 | <merijn> | ixlun: THe former is better |
| 2020-10-21 12:30:58 | <ski> | ixlun : the former |
| 2020-10-21 12:30:58 | <geekosaur> | the former |
| 2020-10-21 12:31:08 | <merijn> | Because repeated . is more easily refactored |
| 2020-10-21 12:31:12 | × | cods quits (~fred@tuxee.net) (Changing host) |
| 2020-10-21 12:31:12 | → | cods joins (~fred@unaffiliated/cods) |
| 2020-10-21 12:31:16 | <ski> | ixlun : or `(foo . bar . baz) a' or `foo (bar (baz a))' |
| 2020-10-21 12:31:24 | → | taurux joins (~taurux@net-188-218-229-119.cust.vodafonedsl.it) |
| 2020-10-21 12:31:36 | <ski> | (i'd prefer any of those three, to the latter you mentioned) |
| 2020-10-21 12:31:41 | <iMonad> | if i understand correctly, monad transformer is just combine multiple monad into single one |
| 2020-10-21 12:32:15 | <ski> | iMonad : it takes a(ny) monad and adds another (specific) "monad capability" to it |
| 2020-10-21 12:32:40 | <ski> | (it does not combine any two arbitrary monads) |
| 2020-10-21 12:33:03 | <ixlun> | Cool, I'll start to write in that method - coming from an imperative background it takes a while to rewire the brain! |
| 2020-10-21 12:33:19 | <ski> | it does, but it's worth it :) |
| 2020-10-21 12:34:00 | <ski> | it's only to expected that learning a new programming paradigm takes more time than learning yet another language in a paradigm one knows. it's a bit more like learning to program from scratch all over again |
| 2020-10-21 12:35:03 | <iMonad> | @ski thanks for you explanation |
| 2020-10-21 12:35:03 | <lambdabot> | Maybe you meant: wiki src ask |
| 2020-10-21 12:35:03 | <ski> | (imho it helps to set aside what you know abour programming, so far. you can compare later, when you have some more solid foundations under your belt. unlearning old habits and trains of thought can take time / be tricky) |
| 2020-10-21 12:36:15 | <ski> | iMonad : no problem :) |
| 2020-10-21 12:36:19 | <iMonad> | but why we need to instance other types here ? it is not enouth to just instance a monad ? |
| 2020-10-21 12:36:21 | → | Iwawa joins (~mdomin45@cpe-24-211-129-187.nc.res.rr.com) |
| 2020-10-21 12:36:35 | <ixlun> | ski: agreed - that's why I think so far I've enjoyed learning Haskell more than another language. It's a completely new way to think about things |
| 2020-10-21 12:36:58 | <ski> | because the type class `Monad' was changed to have `Applicative' as superclass. so every instance of `Monad' is required to already be an instance of `Applicative' (which in turn requires `Functor') |
| 2020-10-21 12:37:25 | <ski> | however (as you saw), it's possible to use default implementations of `Applicative' (and `Functor') in terms of the `Monad' instance you're writing |
| 2020-10-21 12:38:08 | × | geowiesnot quits (~user@i15-les02-ix2-87-89-181-157.sfr.lns.abo.bbox.fr) (Ping timeout: 265 seconds) |
| 2020-10-21 12:38:16 | <ski> | (if one only wants to write an `Applicative' instance, where `Monad' is undesirable or not sensible, one can use `fmap = liftA' for the `Functor' instance, to make it defer to the `Applicative' instance, instead) |
| 2020-10-21 12:38:28 | → | xerox_ joins (~xerox@unaffiliated/xerox) |
| 2020-10-21 12:39:54 | × | Pitaya quits (~mdomin45@cpe-24-211-129-187.nc.res.rr.com) (Ping timeout: 260 seconds) |
| 2020-10-21 12:40:04 | → | Lowl3v3l joins (~Lowl3v3l@dslb-002-203-195-108.002.203.pools.vodafone-ip.de) |
| 2020-10-21 12:40:31 | <ixlun> | I've always found that the best way to learn something new is to write it too, I'm not one for reading a whole book and then diving in. |
| 2020-10-21 12:40:42 | <ixlun> | I like to learn as I go |
| 2020-10-21 12:40:45 | Guest88073 | is now known as lep-delete |
| 2020-10-21 12:41:18 | <ski> | iMonad : btw, fwiw, it's not IRC convention/custom to adorn nicknames by sigils (like `@'). if you want to refer to, or address, someone, simply mention their nickname. in the latter case, e.g. by starting the message with the nickname, followed by a comma or a colon, and then the bulk of the message |
| 2020-10-21 12:42:18 | <iMonad> | oh, sorry about that |
| 2020-10-21 12:42:24 | <iMonad> | I am every new to irc |
| 2020-10-21 12:42:33 | <iMonad> | *very* |
| 2020-10-21 12:42:54 | → | mirrorbird joins (~psutcliff@2a00:801:42b:7891:16b1:e53f:55b2:15e1) |
| 2020-10-21 12:42:56 | <ski> | many IRC clients will highlight/alert the user, in case their nickname is mentioned, first thing in a message. (not as many will, i think, highlight when it's mentioned anywhere else in a message). so, if you place `@' in front, then the nickname is not the first thing, and highlight might not happen |
| 2020-10-21 12:43:27 | → | nineonin_ joins (~textual@216-19-190-182.dyn.novuscom.net) |
| 2020-10-21 12:43:40 | <ski> | (also, `@' means something else, on IRC, namely that someone is a channel operator. however, i'd not suggest referring to operators by prefixing their names by `@', either) |
| 2020-10-21 12:43:48 | <ski> | iMonad : no worry, just informing you |
| 2020-10-21 12:44:24 | → | heatsink joins (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) |
| 2020-10-21 12:44:32 | × | ericsagnes quits (~ericsagne@2405:6580:0:5100:a175:4dc7:93af:b055) (Ping timeout: 260 seconds) |
| 2020-10-21 12:44:44 | × | nineonin_ quits (~textual@216-19-190-182.dyn.novuscom.net) (Client Quit) |
| 2020-10-21 12:45:19 | <ixlun> | Where would people suggest is the best place to look for critique on a project that I'm writing? |
| 2020-10-21 12:46:41 | <[exa]> | ixlun: users! :D |
| 2020-10-21 12:46:42 | → | cr3 joins (~cr3@192-222-143-195.qc.cable.ebox.net) |
| 2020-10-21 12:47:35 | <[exa]> | ixlun: nevermind users, if you can extract something short enough, kindof self-contained, and pastebin it, you can get a lot of feedback from #haskell |
| 2020-10-21 12:47:36 | → | cristi joins (~cristi@82.76.158.82) |
| 2020-10-21 12:48:30 | × | ski quits (~ski@nc-2504-30.studat.chalmers.se) (Ping timeout: 260 seconds) |
| 2020-10-21 12:48:51 | × | cristi quits (~cristi@82.76.158.82) (Remote host closed the connection) |
| 2020-10-21 12:49:14 | × | heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 260 seconds) |
| 2020-10-21 12:49:43 | × | nlhowell quits (~nlhowell@89.20.140.186) (Ping timeout: 246 seconds) |
| 2020-10-21 12:50:27 | → | ski joins (~ski@nc-2504-30.studat.chalmers.se) |
| 2020-10-21 12:51:00 | × | notnatebtw quits (~nate@110.138.18.157) (Quit: WeeChat 2.9) |
| 2020-10-21 12:51:24 | → | notnatebtw joins (~nate@110.138.18.157) |
| 2020-10-21 12:53:24 | × | notnatebtw quits (~nate@110.138.18.157) (Client Quit) |
| 2020-10-21 12:53:48 | → | notnatebtw joins (~nate@110.138.18.157) |
| 2020-10-21 12:53:48 | × | stefan-__ quits (~cri@42dots.de) (Read error: Connection reset by peer) |
| 2020-10-21 12:54:11 | → | stefan-__ joins (~cri@42dots.de) |
| 2020-10-21 12:56:35 | → | ericsagnes joins (~ericsagne@2405:6580:0:5100:3856:125a:3130:f979) |
| 2020-10-21 12:56:37 | × | GyroW_ quits (~GyroW@unaffiliated/gyrow) (Quit: Someone ate my pie) |
All times are in UTC.