Logs: liberachat/#haskell
| 2021-08-11 01:51:27 | <euouae> | But sequence takes a monad |
| 2021-08-11 01:51:30 | <euouae> | Not an applicative |
| 2021-08-11 01:52:10 | <Axman6> | it days that, but almost always it's only using the Applicative instance, since all Monads are Applicatives |
| 2021-08-11 01:52:25 | <Axman6> | and the type is mostly a historical artefact |
| 2021-08-11 01:52:31 | <euouae> | It may be, but why is that important? |
| 2021-08-11 01:52:44 | <euouae> | Why are you protesting about my mention of `>>`? |
| 2021-08-11 01:52:44 | <dsal> | :t sequenceA |
| 2021-08-11 01:52:45 | <lambdabot> | (Traversable t, Applicative f) => t (f a) -> f (t a) |
| 2021-08-11 01:52:51 | <Axman6> | you tell me, I still don't know what your point is |
| 2021-08-11 01:53:04 | <dsal> | I don't understand what >> has to do with traverse. They seem unrelated. |
| 2021-08-11 01:53:15 | <euouae> | Ok look, a while ago you admitted sequence can have many implementations |
| 2021-08-11 01:53:24 | <Axman6> | because you will almost certainly never see any use of >> in any implementation of Traversable |
| 2021-08-11 01:53:24 | <euouae> | I'm saying that the one implementation the sequence has is not well-documented to distinguish it from all others |
| 2021-08-11 01:53:49 | <dsal> | @src sequenceA |
| 2021-08-11 01:53:49 | <lambdabot> | Source not found. :( |
| 2021-08-11 01:53:51 | <dsal> | @src sequence |
| 2021-08-11 01:53:51 | <lambdabot> | sequence [] = return [] |
| 2021-08-11 01:53:51 | <lambdabot> | sequence (x:xs) = do v <- x; vs <- sequence xs; return (v:vs) |
| 2021-08-11 01:53:51 | <lambdabot> | --OR |
| 2021-08-11 01:53:51 | <lambdabot> | sequence xs = foldr (liftM2 (:)) (return []) xs |
| 2021-08-11 01:54:13 | <euouae> | There you go, it uses `do` which uses `>>` right? |
| 2021-08-11 01:54:18 | × | geekosaur quits (~geekosaur@xmonad/geekosaur) (Ping timeout: 258 seconds) |
| 2021-08-11 01:54:24 | <dsal> | @undo do v <- x; vs <- sequence xs; return (v:vs) |
| 2021-08-11 01:54:24 | <lambdabot> | x >>= \ v -> sequence xs >>= \ vs -> return (v : vs) |
| 2021-08-11 01:54:27 | → | geekosaur joins (~geekosaur@xmonad/geekosaur) |
| 2021-08-11 01:54:34 | <Axman6> | I don't think there are many law abiding implementations of sequence which don't do what we've talked about |
| 2021-08-11 01:55:07 | <euouae> | To be law abiding you need laws written down |
| 2021-08-11 01:55:14 | <Axman6> | like, traverse pure = pure ensures the structure is kept intact and the order of elements can't change |
| 2021-08-11 01:55:15 | <euouae> | Where's the laws for sequence documented? |
| 2021-08-11 01:55:27 | × | xff0x quits (~xff0x@2001:1a81:53d2:1c00:df20:e0ed:5860:3ed0) (Ping timeout: 258 seconds) |
| 2021-08-11 01:55:30 | <dsal> | https://en.wikibooks.org/wiki/Haskell/Traversable#The_Traversable_laws |
| 2021-08-11 01:55:54 | <euouae> | but can't sequence have many different implementations? |
| 2021-08-11 01:56:02 | <davean> | also https://hackage.haskell.org/package/base-4.15.0.0/docs/Data-Traversable.html#g:10 |
| 2021-08-11 01:56:12 | <euouae> | couldn't you throw away the result of the action of v <- x; and just collect v instead? |
| 2021-08-11 01:56:16 | <davean> | euouae: all that follow those laws |
| 2021-08-11 01:56:43 | <dsal> | You could try, but if you're implementing Traversable, you should run your implementation against checkers and see if you've made any mistakes. |
| 2021-08-11 01:57:07 | <euouae> | so you're saying that the above example of `evalState (sequence $ repeat $ do { n <- get; put (n*2); return n }) 1` |
| 2021-08-11 01:57:17 | <euouae> | is forced to produce [1,2,4,8,...] because of Traversable? |
| 2021-08-11 01:57:18 | → | xff0x joins (~xff0x@2001:1a81:53fa:2600:8056:588e:c971:d9df) |
| 2021-08-11 01:57:28 | <euouae> | Could it not had been [1,1,1,...] ? |
| 2021-08-11 01:57:57 | <Axman6> | yes |
| 2021-08-11 01:58:06 | <euouae> | got it |
| 2021-08-11 01:58:45 | euouae | needs to think about this more |
| 2021-08-11 02:01:23 | <dsal> | One easy way to think about it is to try to make the thing that you think is bad and then verify it's lawful. |
| 2021-08-11 02:01:55 | <euouae> | unlawful? |
| 2021-08-11 02:03:11 | → | falafel joins (~falafel@pool-96-255-70-50.washdc.fios.verizon.net) |
| 2021-08-11 02:03:25 | <dsal> | Well, if you make a lawful type that does something you think is bad, then it's a concrete discussion point. |
| 2021-08-11 02:03:48 | <euouae> | Ok |
| 2021-08-11 02:05:29 | → | Matthias1 joins (~Matthias1@2603-8001-b545-4900-aca4-b81a-fb11-e9da.res6.spectrum.com) |
| 2021-08-11 02:05:51 | × | jao quits (~jao@cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net) (Ping timeout: 268 seconds) |
| 2021-08-11 02:06:09 | × | Matthias1 quits (~Matthias1@2603-8001-b545-4900-aca4-b81a-fb11-e9da.res6.spectrum.com) (Remote host closed the connection) |
| 2021-08-11 02:07:20 | × | lavaman quits (~lavaman@98.38.249.169) (Remote host closed the connection) |
| 2021-08-11 02:07:35 | → | lavaman joins (~lavaman@98.38.249.169) |
| 2021-08-11 02:07:42 | × | lavaman quits (~lavaman@98.38.249.169) (Remote host closed the connection) |
| 2021-08-11 02:12:23 | → | eggplantade joins (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
| 2021-08-11 02:14:30 | × | machinedgod quits (~machinedg@24.105.81.50) (Ping timeout: 268 seconds) |
| 2021-08-11 02:16:00 | → | zebrag joins (~chris@user/zebrag) |
| 2021-08-11 02:16:58 | × | eggplantade quits (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 268 seconds) |
| 2021-08-11 02:17:17 | <Axman6> | hat's the type whose Applicative instance is something like (Foo mf) <*> (Foo ma) = Foo ((\x f -> f a) <$> ma <*> mf)? |
| 2021-08-11 02:18:06 | <Axman6> | What's* |
| 2021-08-11 02:18:59 | <pavonia> | Is that supposed to be (\a f -> f a)? |
| 2021-08-11 02:19:11 | <Axman6> | uh yes |
| 2021-08-11 02:19:13 | × | td_ quits (~td@muedsl-82-207-238-245.citykom.de) (Ping timeout: 248 seconds) |
| 2021-08-11 02:19:50 | <Axman6> | the Applicative with the order of effects reversed basically |
| 2021-08-11 02:20:16 | <pavonia> | Hhm, no idea |
| 2021-08-11 02:21:06 | → | td_ joins (~td@muedsl-82-207-238-098.citykom.de) |
| 2021-08-11 02:21:51 | <geekosaur> | https://downloads.haskell.org/ghc/latest/docs/html/libraries/transformers-0.5.6.2/Control-Applicative-Backwards.html |
| 2021-08-11 02:22:06 | <Axman6> | <3 |
| 2021-08-11 02:27:41 | → | shailangsa joins (~shailangs@host86-145-14-24.range86-145.btcentralplus.com) |
| 2021-08-11 02:28:02 | → | finn_elija joins (~finn_elij@user/finn-elija/x-0085643) |
| 2021-08-11 02:28:02 | FinnElija | is now known as Guest2839 |
| 2021-08-11 02:28:02 | finn_elija | is now known as FinnElija |
| 2021-08-11 02:31:46 | × | Guest2839 quits (~finn_elij@user/finn-elija/x-0085643) (Ping timeout: 268 seconds) |
| 2021-08-11 02:32:23 | <dibblego> | @type flip (<**>) |
| 2021-08-11 02:32:24 | <lambdabot> | Applicative f => f (a -> b) -> f a -> f b |
| 2021-08-11 02:33:47 | × | shapr quits (~user@pool-100-36-247-68.washdc.fios.verizon.net) (Ping timeout: 258 seconds) |
| 2021-08-11 02:36:54 | × | remexre quits (~nathan@user/remexre) (Ping timeout: 250 seconds) |
| 2021-08-11 02:38:28 | → | lavaman joins (~lavaman@98.38.249.169) |
| 2021-08-11 02:40:56 | → | pe200012_ joins (~pe200012@113.105.10.33) |
| 2021-08-11 02:41:01 | × | pe200012 quits (~pe200012@113.105.10.33) (Ping timeout: 268 seconds) |
| 2021-08-11 02:43:26 | × | lavaman quits (~lavaman@98.38.249.169) (Ping timeout: 272 seconds) |
| 2021-08-11 02:46:47 | × | epolanski quits (uid312403@id-312403.brockwell.irccloud.com) (Quit: Connection closed for inactivity) |
| 2021-08-11 02:49:16 | → | polyphem joins (~polyphem@2a02:810d:640:776c:5d1:5727:1484:7756) |
| 2021-08-11 02:49:53 | × | Guest6722 quits (~chris@81.96.113.213) (Remote host closed the connection) |
| 2021-08-11 02:56:32 | × | zebrag quits (~chris@user/zebrag) (Quit: Konversation terminated!) |
| 2021-08-11 02:59:27 | → | bitdex joins (~bitdex@gateway/tor-sasl/bitdex) |
| 2021-08-11 03:00:04 | → | VoidNoir0 joins (~VoidNoir0@72.80.203.52) |
| 2021-08-11 03:02:25 | → | remexre joins (~nathan@user/remexre) |
| 2021-08-11 03:02:33 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-08-11 03:05:59 | × | hiruji quits (~hiruji@user/hiruji) (Ping timeout: 258 seconds) |
| 2021-08-11 03:06:45 | × | myShoggoth quits (~myShoggot@97-120-70-214.ptld.qwest.net) (Ping timeout: 258 seconds) |
| 2021-08-11 03:06:47 | → | eggplantade joins (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
| 2021-08-11 03:09:06 | × | dermato quits (~dermatobr@154.21.23.75) (Remote host closed the connection) |
| 2021-08-11 03:09:30 | wrengr | is now known as wrengr_away |
| 2021-08-11 03:09:31 | → | MidAutumnHotaru5 joins (~MidAutumn@user/midautumnmoon) |
| 2021-08-11 03:09:48 | × | MidAutumnHotaru quits (~MidAutumn@user/midautumnmoon) (Read error: Connection reset by peer) |
| 2021-08-11 03:09:49 | MidAutumnHotaru5 | is now known as MidAutumnHotaru |
| 2021-08-11 03:11:21 | × | eggplantade quits (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 258 seconds) |
| 2021-08-11 03:18:28 | → | hiruji joins (~hiruji@user/hiruji) |
| 2021-08-11 03:19:57 | × | falafel quits (~falafel@pool-96-255-70-50.washdc.fios.verizon.net) (Read error: Connection reset by peer) |
All times are in UTC.