Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2020-11-09 11:31:45 jpds joins (~jpds@gateway/tor-sasl/jpds)
2020-11-09 11:31:52 <beleon> right, so i'd simply define that myself and derive everything else?
2020-11-09 11:32:01 gehmehgeh joins (~ircuser1@gateway/tor-sasl/gehmehgeh)
2020-11-09 11:32:04 hekkaidekapus joins (~tchouri@gateway/tor-sasl/hekkaidekapus)
2020-11-09 11:32:19 cosimone_ joins (~cosimone@5.171.26.80)
2020-11-09 11:32:26 tomboy64 joins (~tomboy64@gateway/tor-sasl/tomboy64)
2020-11-09 11:32:32 <dminuoso> Sure
2020-11-09 11:32:54 <dminuoso> beleon: Right now your code is violating an implicit assumption:
2020-11-09 11:33:00 <dminuoso> Coherence between Applicative and Monad
2020-11-09 11:33:12 <dminuoso> (Because `ap` and `<*>` have conflicting definitoins)
2020-11-09 11:33:20 × tsaka__ quits (~torstein@ppp-2-84-29-23.home.otenet.gr) (Read error: Connection reset by peer)
2020-11-09 11:34:00 andreas31 joins (~andreas@gateway/tor-sasl/andreas303)
2020-11-09 11:34:04 <dminuoso> So they implement different effects. That alone is reason enough to bury the "merging" behavior as you call it into Alternative instead (which is where we in fact place this behavior into)
2020-11-09 11:34:07 tsaka__ joins (~torstein@ppp-2-84-29-23.home.otenet.gr)
2020-11-09 11:35:23 <beleon> i see. will the derived monad instance automatically make use of the custom alternative instance?
2020-11-09 11:35:47 drbean joins (~drbean@TC210-63-209-199.static.apol.com.tw)
2020-11-09 11:35:49 <dminuoso> No, the lattice looks a bit differnece
2020-11-09 11:35:51 <dminuoso> Hold on
2020-11-09 11:36:22 <dminuoso> https://wiki.haskell.org/wikiupload/d/df/Typeclassopedia-diagram.png
2020-11-09 11:36:25 <maerwald> how reasonable is it to create a C API for your haskell library?
2020-11-09 11:36:28 × cosimone quits (~cosimone@2001:b07:ae5:db26:d849:743b:370b:b3cd) (Ping timeout: 268 seconds)
2020-11-09 11:36:28 cosimone_ is now known as cosimone
2020-11-09 11:36:33 <idnar> dminuoso: is that like the _dreaded_ monomorphism restriction?
2020-11-09 11:36:41 <dminuoso> idnar: haha, sorta
2020-11-09 11:36:51 <dminuoso> beleon: As you can see, Alternative/MonadPlus are subclasses of Applicative/Monad respectively.
2020-11-09 11:37:05 <merijn> maerwald: It depends
2020-11-09 11:37:21 <maerwald> do we even have means to do so or will I have to write a C wrapper
2020-11-09 11:37:22 <dminuoso> So it's assumed there's coherence all along `Functor>Applicative>Monad` and there's coherence between `Alternative>MonadPlus`
2020-11-09 11:37:24 <merijn> maerwald: You'll have to link the RTS with final executable to
2020-11-09 11:37:32 <dminuoso> (By coherence I mean their implementations must agree)
2020-11-09 11:37:55 <merijn> maerwald: The current FFI can export Haskell symbols as C symbols just fine the same as importing
2020-11-09 11:38:07 <dminuoso> So if you GND only up until Monad, you dont get Alternative/MonadPlus
2020-11-09 11:38:26 <merijn> maerwald: If you wanna include it as standalone library into a C executable you need a bit of boilerplate to setup the RTS, but it's pretty straightforward
2020-11-09 11:39:02 <merijn> maerwald: I made a minimal example of having a C entry point with Haskell code: https://gist.github.com/merijn/4a0fee2b3a5ef3476aa4
2020-11-09 11:39:21 <beleon> what does MonadPlus give me? So I would need custom instances for Alternative and MonadPlus that are coherend?
2020-11-09 11:39:42 <merijn> maerwald: If you wanna compile the C code independently of cabal you need to do a bit more work (figuring out how to link the RTS, for one), but it should be fairly straightforward (if annoying)
2020-11-09 11:40:49 <maerwald> so you can't create a real proper .so lib?
2020-11-09 11:40:54 <dminuoso> beleon: Nobody can really agree on what MonadPlus/Alternative really are in terms of laws..
2020-11-09 11:41:39 <merijn> maerwald: Define "real proper"
2020-11-09 11:41:56 <maerwald> it has all the symbols you need
2020-11-09 11:42:06 <dminuoso> beleon: https://gist.github.com/dminuoso/59aef9dfe15a5e9bed68850ffe6c6641
2020-11-09 11:42:11 <dminuoso> roughly you can imagine this relationship
2020-11-09 11:42:55 <merijn> maerwald: You can make a .so just fine, it just depends on 1) the RTS so you need to link that to I dunno if you can pre-link that into the package .so, but the RTS is just another .so, so... 2) any foreign code calling the lib needs to initialise the RTS + GC roots like the C code in that gist
2020-11-09 11:43:38 <merijn> maerwald: If you get a static copy of the RTS you can, presumably, link it into your .so to get a completely standalone .so, but I haven't tried that
2020-11-09 11:43:59 <beleon> dminuoso: right, i think i got it ... more or less :) thanks for the explanation
2020-11-09 11:44:02 × alp quits (~alp@2a01:e0a:58b:4920:6dd8:8351:ec1a:bc84) (Ping timeout: 246 seconds)
2020-11-09 11:44:12 <merijn> In general, I try to just get GHC to do the final link so I don't have to figure it out
2020-11-09 11:44:36 <merijn> But I don't see any theoretical problems, the only practical problem is "figuring out the exact linker flags"
2020-11-09 11:44:48 <merijn> I vaguely recall monochrom having a post about this
2020-11-09 11:45:34 jonatanb joins (~jonatanb@83.24.9.26.ipv4.supernova.orange.pl)
2020-11-09 11:45:37 <dminuoso> beleon: As a random example about laws, you might think `empty <*> m = empty` holds
2020-11-09 11:45:42 <dminuoso> But Backwards puts a nail into that one
2020-11-09 11:46:14 × Codaraxis quits (~Codaraxis@ip68-5-90-227.oc.oc.cox.net) (Remote host closed the connection)
2020-11-09 11:46:16 <merijn> maerwald: https://www.vex.net/~trebla/haskell/so.xhtml
2020-11-09 11:46:42 Codaraxis joins (~Codaraxis@ip68-5-90-227.oc.oc.cox.net)
2020-11-09 11:46:54 alp joins (~alp@88.126.45.36)
2020-11-09 11:46:57 <merijn> maerwald: oh, looks like cabal 2.0+ have explicit support for it too
2020-11-09 11:47:16 × aarvar quits (~foewfoiew@c.24.56.239.179.static.broadstripe.net) (Ping timeout: 246 seconds)
2020-11-09 11:49:39 × fntastic quits (5f5ac942@ip5f5ac942.dynamic.kabel-deutschland.de) (Ping timeout: 245 seconds)
2020-11-09 11:50:23 × jonatanb quits (~jonatanb@83.24.9.26.ipv4.supernova.orange.pl) (Ping timeout: 260 seconds)
2020-11-09 11:50:30 hackage restartable 0.1.0.0 - Minimal live coding library for model-view-event-update applications. https://hackage.haskell.org/package/restartable-0.1.0.0 (MichalGajda)
2020-11-09 11:50:53 <maerwald> interesting
2020-11-09 11:53:26 <Squarism> tomsmeding, maybe a stupid question, but how would that recursive function look?
2020-11-09 11:53:55 <beleon> dminuoso: hm, the compiler complains: newtype ParserBox a = ParserBox (ParserBoxInfo, (Either String (Parser a))) deriving (Functor, Applicative, Monad): Can't make a derived instance of ‘Functor ParserBox’ (even with cunning GeneralizedNewtypeDeriving), any idea why?
2020-11-09 11:54:18 <dminuoso> beleon: Ah yes.
2020-11-09 11:55:10 <Squarism> tomsmeding, forget it. Its obviously starts with the root.
2020-11-09 11:55:11 <dminuoso> beleon: You could if ParserBoxInfo was a monoid...
2020-11-09 11:55:24 <dminuoso> Though.. its hung on Functor already mmm
2020-11-09 11:56:09 <dminuoso> beleon: Try using `ExceptT String Parser A` instead?
2020-11-09 11:57:23 kish` joins (~oracle@unaffiliated/oracle)
2020-11-09 11:57:31 <dminuoso> beleon: Functor at least can be derived with DeriveFunctor :P
2020-11-09 11:57:32 × unknown quits (~unknown@84.39.117.57) (Remote host closed the connection)
2020-11-09 11:58:15 invaser1 joins (~Thunderbi@31.148.23.125)
2020-11-09 11:58:20 × invaser quits (~Thunderbi@128-124-156-208.mobile.vf-ua.net) (Read error: Connection reset by peer)
2020-11-09 11:58:20 invaser1 is now known as invaser
2020-11-09 11:59:25 × kish quits (~oracle@unaffiliated/oracle) (Ping timeout: 240 seconds)
2020-11-09 12:00:46 <beleon> dminuoso: nah, can't get past functor (using DeriveFunctor) with ExceptT
2020-11-09 12:00:58 × Codaraxis quits (~Codaraxis@ip68-5-90-227.oc.oc.cox.net) (Ping timeout: 265 seconds)
2020-11-09 12:02:23 <beleon> but i could add Monoid instance for ParserBoxInfo. Would that help?
2020-11-09 12:06:45 Codaraxis joins (~Codaraxis@ip68-5-90-227.oc.oc.cox.net)
2020-11-09 12:08:08 Gurkenglas_ joins (~Gurkengla@unaffiliated/gurkenglas)
2020-11-09 12:09:42 Lycurgus joins (~niemand@98.4.97.118)
2020-11-09 12:10:11 <absence> does anyone know what the status of ghc 9 is? the web site suggests release candidate was more than a month ago, but that seems inaccurate as the latest available download is alpha
2020-11-09 12:10:31 <merijn> "the web site" = ?
2020-11-09 12:10:44 <tomsmeding> Squarism: :)
2020-11-09 12:10:52 <absence> merijn: the status page on gitlab
2020-11-09 12:11:04 <absence> https://gitlab.haskell.org/ghc/ghc/-/wikis/status/ghc-9.0.1
2020-11-09 12:11:55 <merijn> absence: Anyhoo, the best way to stay up to date is to just subscribe to the ghc-devs mailing list
2020-11-09 12:12:44 × mmohammadi9812 quits (~mmohammad@5.238.175.25) (Quit: Quit)
2020-11-09 12:13:01 mmohammadi9812 joins (~mmohammad@5.238.175.25)
2020-11-09 12:13:02 × tsaka__ quits (~torstein@ppp-2-84-29-23.home.otenet.gr) (Quit: Konversation terminated!)
2020-11-09 12:13:16 tsaka__ joins (~torstein@ppp-2-84-29-23.home.otenet.gr)
2020-11-09 12:15:01 <absence> merijn: yes, i did check the archive, but only found the alpha announcement
2020-11-09 12:17:07 × Codaraxis quits (~Codaraxis@ip68-5-90-227.oc.oc.cox.net) (Remote host closed the connection)
2020-11-09 12:17:12 cr0ssw1nd joins (~crosswind@78.162.46.6)
2020-11-09 12:17:39 × v_m_v quits (~vm_v@2a02:aa12:3200:6480:fc4f:fb56:796a:9a4a) (Remote host closed the connection)
2020-11-09 12:17:57 v_m_v joins (~vm_v@2a02:aa12:3200:6480:fc4f:fb56:796a:9a4a)
2020-11-09 12:18:08 × Stanley00 quits (~stanley00@unaffiliated/stanley00) (Remote host closed the connection)
2020-11-09 12:18:56 × TMA quits (tma@twin.jikos.cz) (Ping timeout: 256 seconds)
2020-11-09 12:19:42 × olligobber quits (olligobber@gateway/vpn/privateinternetaccess/olligobber) (Remote host closed the connection)

All times are in UTC.