Newest at the top
2025-05-06 23:20:19 +0200 | Moyst | (~moyst@user/moyst) Moyst |
2025-05-06 23:19:04 +0200 | <tomsmeding> | monochrom: if you are already in an M context, then you can convert easily from M (a -> b) to a -> M b; to use your types, you are indeed in an M context |
2025-05-06 23:17:42 +0200 | <tomsmeding> | ... oh, in my local ghci the latter version had differently-named type variables) |
2025-05-06 23:17:28 +0200 | <lambdabot> | [a -> b] -> a -> [b] |
2025-05-06 23:17:27 +0200 | <tomsmeding> | :t \l x -> map ($ x) l |
2025-05-06 23:17:26 +0200 | <tomsmeding> | (clearly this is better than |
2025-05-06 23:17:25 +0200 | <monochrom> | I am now trying to reconcile that with how sometimes we say that Monad is an upgrade of Applicative by upgrading M (a -> b) -> M a -> M b to (a -> M b) -> M a -> M b. |
2025-05-06 23:17:23 +0200 | Moyst | (~moyst@user/moyst) (Ping timeout: 244 seconds) |
2025-05-06 23:17:08 +0200 | <lambdabot> | [a -> b] -> a -> [b] |
2025-05-06 23:17:07 +0200 | <tomsmeding> | :t (.) <$> flip map <*> const (flip id) |
2025-05-06 23:17:04 +0200 | <tomsmeding> | monochrom: actually, your function is quite okay |
2025-05-06 23:15:02 +0200 | __monty__ | (~toonn@user/toonn) (Quit: leaving) |
2025-05-06 23:14:37 +0200 | <tomsmeding> | ("that's not readFile") |
2025-05-06 23:14:30 +0200 | <tomsmeding> | the `IO (FilePath -> String)` example also illustrated it quite well, I think |
2025-05-06 23:14:29 +0200 | amadaluzia | (~amadaluzi@user/amadaluzia) (Ping timeout: 248 seconds) |
2025-05-06 23:13:52 +0200 | <monochrom> | I guess [a->b] -> a->[b] shows the problem, or at least why you must sacrifice something. |
2025-05-06 23:12:20 +0200 | <EvanR> | though what you CAN do ... is kind of hard to determine without defined IO |
2025-05-06 23:12:08 +0200 | <EvanR> | right |
2025-05-06 23:12:00 +0200 | <tomsmeding> | so as was said already, neither direction is something you can always do :p |
2025-05-06 23:11:31 +0200 | <tomsmeding> | or you would duplicate the effects, which is in general not what you want (but it may be acceptable in some specific circumstances) |
2025-05-06 23:11:04 +0200 | j1n37- | (~j1n37@user/j1n37) (Ping timeout: 252 seconds) |
2025-05-06 23:10:58 +0200 | <tomsmeding> | if you're not, then it doesn't work |
2025-05-06 23:10:51 +0200 | <tomsmeding> | if you're in an IO context, you can `\mf -> do f <- mf; return (pure . f)` |
2025-05-06 23:10:40 +0200 | j1n37 | (~j1n37@user/j1n37) j1n37 |
2025-05-06 23:10:35 +0200 | <EvanR> | going the first way you're restricted in the kind of effects you can do |
2025-05-06 23:10:27 +0200 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 244 seconds) |
2025-05-06 23:10:12 +0200 | <EvanR> | yeah |
2025-05-06 23:10:07 +0200 | <tomsmeding> | EvanR: you have an `IO (a -> b)` and you need to shove it into an `a -> IO b`-shaped hole? |
2025-05-06 23:09:53 +0200 | <EvanR> | is it a free forgetful situation xD |
2025-05-06 23:09:38 +0200 | <EvanR> | ok what if you go the other way |
2025-05-06 23:09:16 +0200 | <tomsmeding> | while this was kind of already said by other people above, I just wanted to summarise :p |
2025-05-06 23:08:41 +0200 | <tomsmeding> | hellwolf: if you end up needing to shove an `a -> IO b` in an `IO (a -> b)`-shaped hole, then you either need to make the effects in the function you have in hand independent of its `a` input, or, if that cannot be done, change the type of the hole |
2025-05-06 23:06:12 +0200 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn |
2025-05-06 23:05:17 +0200 | Sorevian | (~Sorevian@2a01:4b00:869f:4100:3142:dca3:9a6b:93c3) (Quit: Client closed) |
2025-05-06 23:05:10 +0200 | takuan | (~takuan@d8D86B601.access.telenet.be) (Remote host closed the connection) |
2025-05-06 23:04:43 +0200 | <geekosaur> | I'm confused. looks to me like you're trying to shove a Monad into an Applicative-shaped hole |
2025-05-06 23:01:53 +0200 | <hellwolf> | As a straw man category theorists would likely to say, it may be an example of some category. |
2025-05-06 23:01:20 +0200 | <hellwolf> | not sure how it's related, but the shape does look the same. |
2025-05-06 23:01:11 +0200 | <hellwolf> | that deontic logic reference is a rabbit hole... |
2025-05-06 22:59:33 +0200 | amadaluzia | (~amadaluzi@user/amadaluzia) amadaluzia |
2025-05-06 22:59:29 +0200 | j1n37 | (~j1n37@user/j1n37) (Ping timeout: 260 seconds) |
2025-05-06 22:59:05 +0200 | amadaluzia | (~amadaluzi@user/amadaluzia) (Ping timeout: 244 seconds) |
2025-05-06 22:58:46 +0200 | krei-se | (~krei-se@p50829f98.dip0.t-ipconnect.de) krei-se |
2025-05-06 22:58:35 +0200 | j1n37- | (~j1n37@user/j1n37) j1n37 |
2025-05-06 22:54:13 +0200 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 248 seconds) |
2025-05-06 22:49:13 +0200 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn |
2025-05-06 22:47:39 +0200 | ljdarj | (~Thunderbi@user/ljdarj) (Quit: ljdarj) |
2025-05-06 22:46:51 +0200 | krei-se | (~krei-se@p200300f1cfff12b8da9ef3fffe7fdac8.dip0.t-ipconnect.de) (Quit: ZNC 1.9.1 - https://znc.in) |
2025-05-06 22:43:35 +0200 | <hellwolf> | I am juggling balls. |
2025-05-06 22:43:20 +0200 | <hellwolf> | I hope I am, I am doing the API. |