Newest at the top
2025-02-28 08:38:34 +0100 | <kqr> | Ah what the heck, I'll just pop `isJust` in front of each element of the list. It is perfectly readable still. |
2025-02-28 08:38:17 +0100 | <[exa]> | :( |
2025-02-28 08:38:16 +0100 | <kqr> | Yeah, I just realised |
2025-02-28 08:38:15 +0100 | j1n37 | (~j1n37@user/j1n37) j1n37 |
2025-02-28 08:38:12 +0100 | <[exa]> | ah wait no not really because the types again |
2025-02-28 08:38:12 +0100 | <lambdabot> | Alternative f => f a -> f a -> f a |
2025-02-28 08:38:10 +0100 | <kqr> | :t (<|>) |
2025-02-28 08:38:08 +0100 | <kqr> | The <|> is not good because |
2025-02-28 08:37:53 +0100 | Square2 | (~Square4@user/square) (Ping timeout: 252 seconds) |
2025-02-28 08:37:41 +0100 | <[exa]> | the <|> is probably good there, it's going to give you the first "valid" choice if you're after it |
2025-02-28 08:37:28 +0100 | alfiee | (~alfiee@user/alfiee) alfiee |
2025-02-28 08:37:22 +0100 | <kqr> | Well actually the original code had only the first two terms, and when I added the third it became more difficult to read |
2025-02-28 08:36:57 +0100 | <kqr> | I'm just aiming for conciseness and readability here. The original code said isJust a || isJust b || isJust c but the expressions a, b, and c are in reality longer and made the logic of the whole line difficult to overview |
2025-02-28 08:36:34 +0100 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 272 seconds) |
2025-02-28 08:35:49 +0100 | <[exa]> | On the very other side of the problem, you could do existential-style polymorphic lists to contain all possible justs in there. But don't if you don't have to. |
2025-02-28 08:35:04 +0100 | <[exa]> | yes. |
2025-02-28 08:34:59 +0100 | <[exa]> | for "or" you want to di as Keart says, with something like the < |
2025-02-28 08:34:58 +0100 | <kqr> | But <|> maybe? |
2025-02-28 08:34:49 +0100 | <kqr> | Oh, true. |
2025-02-28 08:34:39 +0100 | <[exa]> | mine does "and" |
2025-02-28 08:34:34 +0100 | <lambdabot> | Maybe a1 -> Maybe a2 -> Maybe a3 -> Bool |
2025-02-28 08:34:33 +0100 | <[exa]> | you have "or" there |
2025-02-28 08:34:33 +0100 | <Leary> | :t let { x ~|~ y = void x <|> void y; infixr 2 ~|~ } in \a b c -> isJust $ a ~|~ b ~|~ c |
2025-02-28 08:34:30 +0100 | <[exa]> | ah wayit actually |
2025-02-28 08:34:24 +0100 | <kqr> | Oh. Yeah, that definitely works. I just have to wrap my head around how the heck it works! |
2025-02-28 08:33:48 +0100 | <[exa]> | (you can also do like isJust (a>>b>>c) or so, to have it inline. But you can't really put the abc into a single container. |
2025-02-28 08:33:05 +0100 | j1n37 | (~j1n37@user/j1n37) (Read error: Connection reset by peer) |
2025-02-28 08:33:05 +0100 | <[exa]> | https://play.haskell.org/saved/atW1eEnR <- kqr does this work for you? |
2025-02-28 08:31:47 +0100 | <[exa]> | kqr: putting a,b,c into the same list is gonna be an issue. if you just want simpler code, you could abuse the monads a bit |
2025-02-28 08:31:33 +0100 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn |
2025-02-28 08:27:47 +0100 | <kqr> | Noob Haskell question: I have this expression: `or [isJust a, isJust b, isJust c]` and I'd like to translate it into `any isJust [a, b, c]` but this does not work because none of a, b, or c are of the same type. At first I thought I would be able to do something like `any isJust (map ($> ()) [a, b, c])` but of course this runs into the same problem! What are my alternatives here? |
2025-02-28 08:27:38 +0100 | florida | (~florida@2a02:ab88:7200:6a00:762b:62ff:fe83:1a1b) (Quit: Leaving) |
2025-02-28 08:21:25 +0100 | bilegeek_ | (~bilegeek@2600:1008:b014:2c7:531b:7b59:1891:ee3a) (Ping timeout: 248 seconds) |
2025-02-28 08:20:53 +0100 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 248 seconds) |
2025-02-28 08:19:29 +0100 | bilegeek | (~bilegeek@2600:1008:b01f:5f7b:5bb4:d486:4e63:9b64) (Ping timeout: 260 seconds) |
2025-02-28 08:18:49 +0100 | bilegeek__ | (~bilegeek@2600:1008:b061:9e8:b6a7:1e21:b590:dc2) bilegeek |
2025-02-28 08:16:49 +0100 | bilegeek_ | (~bilegeek@2600:1008:b014:2c7:531b:7b59:1891:ee3a) bilegeek |
2025-02-28 08:16:12 +0100 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn |
2025-02-28 08:11:16 +0100 | Lord_of_Life_ | Lord_of_Life |
2025-02-28 08:11:15 +0100 | euleritian | (~euleritia@dynamic-176-006-140-035.176.6.pool.telefonica.de) |
2025-02-28 08:10:45 +0100 | Lord_of_Life | (~Lord@user/lord-of-life/x-2819915) (Ping timeout: 248 seconds) |
2025-02-28 08:10:17 +0100 | euleritian | (~euleritia@dynamic-176-006-140-040.176.6.pool.telefonica.de) (Ping timeout: 268 seconds) |
2025-02-28 08:09:55 +0100 | Lord_of_Life_ | (~Lord@user/lord-of-life/x-2819915) Lord_of_Life |
2025-02-28 08:08:07 +0100 | ft | (~ft@p3e9bc68d.dip0.t-ipconnect.de) (Quit: leaving) |
2025-02-28 08:05:23 +0100 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 245 seconds) |
2025-02-28 08:04:47 +0100 | bitdex | (~bitdex@gateway/tor-sasl/bitdex) bitdex |
2025-02-28 08:00:48 +0100 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn |
2025-02-28 07:56:52 +0100 | acidjnk_new | (~acidjnk@p200300d6e7283f90a88c11223635ddf2.dip0.t-ipconnect.de) acidjnk |
2025-02-28 07:56:43 +0100 | alfiee | (~alfiee@user/alfiee) (Ping timeout: 268 seconds) |
2025-02-28 07:56:12 +0100 | peterbecich | (~Thunderbi@syn-047-229-123-186.res.spectrum.com) peterbecich |