Logs: freenode/#haskell
| 2020-09-26 23:49:12 | <todaysTomorrow> | javran you sound like you are punding |
| 2020-09-26 23:49:23 | <todaysTomorrow> | why do verbosity matter? |
| 2020-09-26 23:49:29 | × | remexre quits (~nathan@207-153-38-50.fttp.usinternet.com) (Read error: Connection reset by peer) |
| 2020-09-26 23:49:47 | <javran> | when you want to do lots of Maybes inside a ExceptT |
| 2020-09-26 23:50:02 | → | rprije joins (~rprije@27.143.220.203.dial.dynamic.acc01-myal-dub.comindico.com.au) |
| 2020-09-26 23:50:28 | <todaysTomorrow> | oh I see, could you teach me what ExceptT is? I haven't worked with it. Maybe then I can help you |
| 2020-09-26 23:50:34 | → | ech joins (~user@gateway/tor-sasl/ech) |
| 2020-09-26 23:50:49 | → | adam_wespiser joins (~adam_wesp@209.6.42.110) |
| 2020-09-26 23:51:01 | <javran> | it's just Either in disguist |
| 2020-09-26 23:51:13 | <javran> | http://hackage.haskell.org/package/mtl-2.2.2/docs/Control-Monad-Except.html |
| 2020-09-26 23:51:37 | <todaysTomorrow> | I don't remember ever using Either in my life but I have probably used it extensively before suffering from brain damage |
| 2020-09-26 23:51:54 | <todaysTomorrow> | reading your link now |
| 2020-09-26 23:53:04 | <todaysTomorrow> | "Please do not confuse ExceptT and throwError with Exception / SomeException and catch, respectively. The latter are for exceptions built into GHC, by default, and are mostly used from within the IO monad. They do not interact with the "exceptions" in this package at all. This package allows you to define a new kind of exception control mechanism |
| 2020-09-26 23:53:04 | <todaysTomorrow> | which does not necessarily need your code to be placed in the IO monad." |
| 2020-09-26 23:53:10 | <todaysTomorrow> | from javran's link |
| 2020-09-26 23:55:07 | × | adam_wespiser quits (~adam_wesp@209.6.42.110) (Ping timeout: 240 seconds) |
| 2020-09-26 23:56:00 | → | acidjnk_new joins (~acidjnk@p200300d0c723788981cc0ce7da3b2720.dip0.t-ipconnect.de) |
| 2020-09-26 23:56:23 | × | xelxebar quits (~xelxebar@gateway/tor-sasl/xelxebar) (Ping timeout: 240 seconds) |
| 2020-09-26 23:56:42 | <javran> | I'm basically just enhancing a Maybe with a bit more error message for debugging. so instead of do { a <- actionA; b <- actionB; ... }, I can do { a <- m2e "actionA failed bcs..."; b <- m2e "actionB failed bcs.."; ... }, where m2e stands for maybeToExcept |
| 2020-09-26 23:56:53 | → | sand_dull joins (~theuser@185.217.69.182) |
| 2020-09-26 23:57:10 | → | xelxebar joins (~xelxebar@gateway/tor-sasl/xelxebar) |
| 2020-09-26 23:57:10 | → | zbioe joins (b3bb5fea@179.187.95.234.dynamic.adsl.gvt.net.br) |
| 2020-09-26 23:57:18 | <javran> | opss, `m2e "..." actionA` I meant |
| 2020-09-26 23:57:30 | <todaysTomorrow> | javran I have mostly used haskell as a crude alternative to octave I don't have much experience with the IO monad, would you like to teach me how to do IO in haskell with the IO monad? |
| 2020-09-26 23:57:55 | <javran> | um, ExceptT actually has nothing to do with IO |
| 2020-09-26 23:58:31 | <todaysTomorrow> | okay I see |
| 2020-09-26 23:58:39 | <todaysTomorrow> | could you give me real world examples? |
| 2020-09-26 23:58:51 | <javran> | for using ExceptT? |
| 2020-09-26 23:58:53 | <todaysTomorrow> | yes |
| 2020-09-26 23:58:58 | <todaysTomorrow> | I've never used it before |
| 2020-09-26 23:59:12 | <koz_> | todaysTomorrow: Do you understand the purpose monad transformers serve in general? |
| 2020-09-26 23:59:41 | <xsperry> | he asked this 2 minutes ago.. "would you like to teach me how to do IO in haskell with the IO monad?" |
| 2020-09-26 23:59:45 | <xsperry> | so I would guess, no |
| 2020-09-26 23:59:47 | <todaysTomorrow> | well that's actually a very complicated problem I suffer from brain damage and I may have used it in the past |
| 2020-09-26 23:59:59 | <koz_> | xsperry: I prefer to be clear. |
| 2020-09-27 00:00:01 | × | kaimi1 quits (~kaimi@178.239.168.171) () |
| 2020-09-27 00:00:12 | <javran> | I actually haven't been in this channel for a while so my lambdabot knowledge is rotten. |
| 2020-09-27 00:00:28 | <xsperry> | I can't imagine someone not knowing how to use IO monad but knowing the purpose of monad transformers |
| 2020-09-27 00:00:36 | <todaysTomorrow> | xsperry like many people I have been using the IO monad without knowing |
| 2020-09-27 00:00:51 | <todaysTomorrow> | xsperry for two reasons that doesn't apply to me |
| 2020-09-27 00:01:32 | → | cr3 joins (~cr3@192-222-143-195.qc.cable.ebox.net) |
| 2020-09-27 00:01:32 | <todaysTomorrow> | I suffer from brain damage I may suddenly remember the IO monad and monad transformers and be able to teach you a thing or two ;-) |
| 2020-09-27 00:03:33 | <javran> | well it's hard to come up with examples that can fit into a single line, let's see.. do you know Either? |
| 2020-09-27 00:04:27 | <todaysTomorrow> | I remember from a few years ago using it. Let's all pretend I don't know anything about it |
| 2020-09-27 00:05:13 | <todaysTomorrow> | how do I use hoogle? |
| 2020-09-27 00:05:32 | × | ChaiTRex quits (~ChaiTRex@gateway/tor-sasl/chaitrex) (Remote host closed the connection) |
| 2020-09-27 00:05:58 | <javran> | @let notPositive x = if x <= 0 then Right x else Left "not positive" |
| 2020-09-27 00:06:00 | <lambdabot> | Defined. |
| 2020-09-27 00:06:28 | <javran> | @let notNegative x = if x >= 0 then Right x else Left "not negative" |
| 2020-09-27 00:06:29 | <lambdabot> | Defined. |
| 2020-09-27 00:06:38 | <javran> | > notPositive 1 |
| 2020-09-27 00:06:41 | <lambdabot> | Left "not positive" |
| 2020-09-27 00:06:47 | <javran> | > notPositive (-2) |
| 2020-09-27 00:06:49 | <lambdabot> | Right (-2) |
| 2020-09-27 00:06:56 | → | ChaiTRex joins (~ChaiTRex@gateway/tor-sasl/chaitrex) |
| 2020-09-27 00:07:03 | <todaysTomorrow> | Oh yes! I remember using this. I made a tree with either a long time ago |
| 2020-09-27 00:07:20 | <javran> | just like that, it's Maybe but you can give a bit more information about what was wrong as Left |
| 2020-09-27 00:07:24 | → | remexre joins (~nathan@207-153-38-50.fttp.usinternet.com) |
| 2020-09-27 00:08:35 | <todaysTomorrow> | seems very useful for defining you're own data type |
| 2020-09-27 00:08:42 | <javran> | now say you want to put those two computations together to stop at first error and report what was wrong, that's Except |
| 2020-09-27 00:08:52 | <todaysTomorrow> | ! |
| 2020-09-27 00:08:56 | → | falafel_ joins (~falafel@2605:e000:1527:d491:f090:20fe:cddf:2a1a) |
| 2020-09-27 00:09:15 | <javran> | :t liftEither |
| 2020-09-27 00:09:16 | <lambdabot> | MonadError e m => Either e a -> m a |
| 2020-09-27 00:10:20 | <javran> | @let onlyZero x = liftEither (notPositive x) >>= (liftEither . notNegative) |
| 2020-09-27 00:10:22 | <lambdabot> | Defined. |
| 2020-09-27 00:10:29 | <javran> | > onlyZero (-1) |
| 2020-09-27 00:10:31 | <lambdabot> | error: |
| 2020-09-27 00:10:31 | <lambdabot> | • Ambiguous type variable ‘m0’ arising from a use of ‘show_M877596031243... |
| 2020-09-27 00:10:31 | <lambdabot> | prevents the constraint ‘(Show (m0 Integer))’ from being solved. |
| 2020-09-27 00:10:45 | <javran> | > onlyZero (-1) :: Except String Int |
| 2020-09-27 00:10:48 | <lambdabot> | ExceptT (Identity (Left "not negative")) |
| 2020-09-27 00:10:56 | <javran> | > onlyZero 3 :: Except String Int |
| 2020-09-27 00:10:58 | <lambdabot> | ExceptT (Identity (Left "not positive")) |
| 2020-09-27 00:11:04 | <todaysTomorrow> | "is there a function directly from Maybe to Except? I know I can do it with maybeToEither and liftEither, it's too verbose to my liking." |
| 2020-09-27 00:11:05 | <javran> | > onlyZero 0 :: Except String Int |
| 2020-09-27 00:11:07 | <lambdabot> | ExceptT (Identity (Right 0)) |
| 2020-09-27 00:12:08 | <javran> | if you totally ignore ExceptT and Identity, it's simple. |
| 2020-09-27 00:12:58 | <javran> | those are monad transformer machinery |
| 2020-09-27 00:13:39 | <todaysTomorrow> | http://book.realworldhaskell.org/read/monad-transformers.html |
| 2020-09-27 00:14:08 | → | adam_wespiser joins (~adam_wesp@209.6.42.110) |
| 2020-09-27 00:16:05 | → | justanotheruser joins (~justanoth@unaffiliated/justanotheruser) |
| 2020-09-27 00:17:09 | <todaysTomorrow> | Excuse me, it seems like we're abdononing a problem that needs to be solved |
| 2020-09-27 00:17:49 | <javran> | like what |
| 2020-09-27 00:19:24 | <javran> | if you meant my original question, I ended up just defining my own m2e function, it just bothers me a bit that there isn't an utility function for doing exactly that with fewer typing. |
| 2020-09-27 00:20:19 | <todaysTomorrow> | Yes javran is your problem resolved? |
| 2020-09-27 00:20:38 | × | mnrmnaugh quits (~mnrmnaugh@unaffiliated/mnrmnaugh) (Ping timeout: 260 seconds) |
| 2020-09-27 00:20:45 | × | Rudd0 quits (~Rudd0@185.189.115.103) (Ping timeout: 240 seconds) |
| 2020-09-27 00:21:14 | → | Orbstheorem joins (~roosember@hellendaal.orbstheorem.ch) |
| 2020-09-27 00:21:20 | <javran> | technically it's already solved, I'm only wondering if there is a better way |
| 2020-09-27 00:21:52 | <todaysTomorrow> | How are you trying to influence the world? |
| 2020-09-27 00:22:10 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2020-09-27 00:23:40 | <javran> | oh actually, I'm wondering if I can just coerce that |
| 2020-09-27 00:24:38 | <todaysTomorrow> | I don't understand what you mean |
| 2020-09-27 00:25:37 | <javran> | well.. coercion is kinda advanced topic i guess |
| 2020-09-27 00:26:18 | <todaysTomorrow> | Want to know what I've been working on? javran? |
| 2020-09-27 00:26:33 | <int-e> | . o O ( unsafeBlackmail ) |
| 2020-09-27 00:27:38 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 260 seconds) |
| 2020-09-27 00:28:11 | javran | was just wondering, if ExceptT is just newtype Either, that should allow me to do some safe coercion as they are representationally identical |
| 2020-09-27 00:30:34 | <todaysTomorrow> | I've been working on making a very specific form of programming using haskell elm seL4 emacs and coq to produce formally verified code |
All times are in UTC.