Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,804,177 events total
2021-08-21 07:11:18 <arahael> Weird day of dev. Clean kitchen. Research headsets (as a deaf dude, that's... Not common). Tiny bit of haskell research. Carry wood downstairs. Tiny bit of haskell research. Make lunch. Walk to shops. Headphones research. Tiny bit of headphone research. Tiny bit of *actual haskell dev* - allow-newer fiddling. ETc. :)
2021-08-21 07:11:48 × Guest|58 quits (~Guest|58@131.226.66.188) (Client Quit)
2021-08-21 07:13:10 × o1lo01ol1o quits (~o1lo01ol1@5.181.115.89.rev.vodafone.pt) (Ping timeout: 240 seconds)
2021-08-21 07:13:15 <arahael> Nice. allow-newer works nicely. Now I should probably restrict it to the one package that actually needs the hack.
2021-08-21 07:15:04 × Erutuon quits (~Erutuon@user/erutuon) (Ping timeout: 250 seconds)
2021-08-21 07:20:31 burnsidesLlama joins (~burnsides@dhcp168-023.wadham.ox.ac.uk)
2021-08-21 07:23:04 × burnsidesLlama quits (~burnsides@dhcp168-023.wadham.ox.ac.uk) (Remote host closed the connection)
2021-08-21 07:30:38 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-08-21 07:32:38 mastarija joins (~mastarija@78-3-210-70.adsl.net.t-com.hr)
2021-08-21 07:34:37 <mastarija> Is there a way to create a constraint that "excludes" a certain type class? e.g. `instance ( Not ( Monoid a ) ) => SomeClass ( MyType a ) where ...`
2021-08-21 07:35:25 <mastarija> So basically, my function / instance is valid for everything that isn't a `Monoid`
2021-08-21 07:36:07 <maerwald> what is "everything"?
2021-08-21 07:36:34 <mastarija> Any 'a'
2021-08-21 07:36:40 <maerwald> you've defined instances for all classes from all of hackage?
2021-08-21 07:37:15 <mastarija> Not sure what you are asking. I'm talking about types, not classes
2021-08-21 07:37:18 <int-e> This is incompatible with the open nature of type classes; adding a Monoid instance could invalidate type inference decisions that were made in a different module when that instance wasn't yet visible.
2021-08-21 07:37:35 <tomsmeding> mastarija: impossible, but you _can_ get a constraint that says "a is match one any of this list of types"
2021-08-21 07:37:38 <maerwald> mastarija: you're talking about classes
2021-08-21 07:37:58 <mastarija> So I want to make an instance for any "type" that doesn't have this particular instance
2021-08-21 07:38:01 <tomsmeding> s/a is/a doesn't/
2021-08-21 07:38:23 <maerwald> you make instances of classes, not types
2021-08-21 07:38:26 <tomsmeding> _why_ do you want this constraint? so that you can have a different one that only works for Monoid?
2021-08-21 07:38:34 <mastarija> maerwald, true
2021-08-21 07:38:41 <int-e> There are closed type families though, which trade openness for the power of negation (among other things).
2021-08-21 07:38:51 <maerwald> so you don't know what classes you have, how are you gonna make instances?
2021-08-21 07:39:41 <tomsmeding> if so, class C a where yourfunction :: ... ; instance {-# OVERLAPPABLE #-} C a where yourfunction = yourdefinition ; instance {-# OVERLAPPING #-} Monoid a => C a where yourfunction = error "no"
2021-08-21 07:39:51 <tomsmeding> maerwald: any _type_ that doesn't implement Monoid
2021-08-21 07:39:55 <mastarija> maerwald, I have a class I want to make an instance of, but I can make it only if the type I'm working with isn't a Monoid.
2021-08-21 07:40:14 <int-e> as far as existing mechanisms for type classes go... this sounds like incoherent instances territory, which is the scary kind of overloaded instances.
2021-08-21 07:40:17 <tomsmeding> note that overlapping instances do work, kind of, but they're finicky I believe
2021-08-21 07:40:20 <arahael> I'm way out of my depth here, but why not... Ignore the Monoid instance?
2021-08-21 07:40:25 <mastarija> This is just an example. But as int-e said, open world comes into play
2021-08-21 07:41:09 <mastarija> Dunno, I had a thought, so I asked :D
2021-08-21 07:41:35 <maerwald> tomsmeding: ah, I think they wanted to make instances for every non-Monoid class :D
2021-08-21 07:41:38 <tomsmeding> mastarija: please don't do this unless you know exactly what you want and it's this :p
2021-08-21 07:41:59 <mastarija> I kind of do
2021-08-21 07:42:20 <mastarija> But it wasn't well formed yet
2021-08-21 07:43:04 <tomsmeding> oh right, this kind of overlapping instances (like I gave in my C example) can give rise to incoherence (different typeclass dictionaries being used for the same type in the same program)
2021-08-21 07:43:34 <tomsmeding> if you use the class C in a polymorphic context where it isn't known yet whether there will be a Monoid instance available for the concrete type in the end
2021-08-21 07:43:41 <mastarija> yes I guessed this would happen
2021-08-21 07:43:55 <mastarija> but you know, if I'm careful maybe it'll work :D
2021-08-21 07:44:05 <tomsmeding> mastarija: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/exts/instances.html#extension-OverlappingInstances
2021-08-21 07:44:29 × tzh quits (~tzh@c-24-21-73-154.hsd1.or.comcast.net) (Quit: zzz)
2021-08-21 07:44:34 <mastarija> Oh.. that's deprecated now
2021-08-21 07:44:55 <tomsmeding> I believe you can use the pragmas without enabling the extension
2021-08-21 07:45:14 <mastarija> yes, just noticed that in the docs :D
2021-08-21 07:45:18 <mastarija> good to know
2021-08-21 07:46:32 <tomsmeding> oh my instances are _too_ overlapping :p
2021-08-21 07:46:43 <tomsmeding> of course this will not work
2021-08-21 07:47:11 <tomsmeding> ghc decides which instance to use without looking at the constraints of instances; then after it has chosen one, it looks at the constraints and adds them to the set of things it needs to solve
2021-08-21 07:47:36 <tomsmeding> since these two instances will have the same "right-hand side" (namely C a), ghc can never choose
2021-08-21 07:48:07 <mastarija> can't it just pick the first one :P
2021-08-21 07:48:13 <tomsmeding> then it would always pick the first one
2021-08-21 07:48:20 <tomsmeding> which would defeat the point of having the second one :p
2021-08-21 07:51:48 _ht joins (~quassel@82-169-194-8.biz.kpn.net)
2021-08-21 07:54:42 cawfee joins (~root@2406:3003:2077:2758::babe)
2021-08-21 07:55:34 acidjnk_new joins (~acidjnk@p200300d0c72b9557dc14868c6ad3e278.dip0.t-ipconnect.de)
2021-08-21 07:56:08 Erutuon joins (~Erutuon@user/erutuon)
2021-08-21 07:56:33 burnsidesLlama joins (~burnsides@dhcp168-023.wadham.ox.ac.uk)
2021-08-21 07:57:38 reumeth joins (~reumeth@user/reumeth)
2021-08-21 08:00:25 Gurkenglas joins (~Gurkengla@dslb-002-203-144-156.002.203.pools.vodafone-ip.de)
2021-08-21 08:01:52 × burnsidesLlama quits (~burnsides@dhcp168-023.wadham.ox.ac.uk) (Ping timeout: 250 seconds)
2021-08-21 08:04:54 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 250 seconds)
2021-08-21 08:06:05 hendursa1 joins (~weechat@user/hendursaga)
2021-08-21 08:07:08 kenran joins (~kenran@200116b82bfa730075b97161738401b4.dip.versatel-1u1.de)
2021-08-21 08:08:00 × hendursaga quits (~weechat@user/hendursaga) (Ping timeout: 244 seconds)
2021-08-21 08:17:16 × geekosaur quits (~geekosaur@xmonad/geekosaur) (Remote host closed the connection)
2021-08-21 08:17:30 × Megant quits (megant@user/megant) (Ping timeout: 268 seconds)
2021-08-21 08:17:39 geekosaur joins (~geekosaur@xmonad/geekosaur)
2021-08-21 08:21:13 Tuplanolla joins (~Tuplanoll@91-159-69-50.elisa-laajakaista.fi)
2021-08-21 08:32:56 × econo quits (uid147250@user/econo) (Quit: Connection closed for inactivity)
2021-08-21 08:33:12 burnsidesLlama joins (~burnsides@dhcp168-023.wadham.ox.ac.uk)
2021-08-21 08:36:31 × eggplantade quits (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection)
2021-08-21 08:36:48 enoq joins (~enoq@2a05:1141:1f5:5600:eb83:919c:c248:eabe)
2021-08-21 08:37:34 × kenran quits (~kenran@200116b82bfa730075b97161738401b4.dip.versatel-1u1.de) (Quit: WeeChat info:version)
2021-08-21 08:37:40 × burnsidesLlama quits (~burnsides@dhcp168-023.wadham.ox.ac.uk) (Ping timeout: 252 seconds)
2021-08-21 08:40:10 × favonia quits (~favonia@user/favonia) (Ping timeout: 240 seconds)
2021-08-21 08:40:58 × mastarija quits (~mastarija@78-3-210-70.adsl.net.t-com.hr) (Ping timeout: 252 seconds)
2021-08-21 08:44:09 arahael likes Haskell. :)
2021-08-21 08:46:55 MoC joins (~moc@user/moc)
2021-08-21 08:47:09 tomsmeding too :)
2021-08-21 08:47:44 <arahael> The community here is awesome, the language is awesome, and there's lots of good stuff, even if the learning curve for those of us who usually develop in non-haskell projects is initially high. :)
2021-08-21 08:48:03 <arahael> And it's _great_ for refactorability. Never found another language that lets you fearlessly refactor quite so well.
2021-08-21 08:49:17 <tomsmeding> rust - fearless concurrency; haskell - fearless refactoring
2021-08-21 08:50:46 <arahael> Heh, actually isn't Haskell good for fearless concurrency, too?
2021-08-21 08:51:21 <arahael> Rust is on my list of langugages to really learn - already done the rustlings course which is pretty awesome, and I like the language, but ultimately still prefer Haskell for various reasons.
2021-08-21 08:51:42 × dsrt^ quits (~dsrt@209.65.131.194) (Ping timeout: 250 seconds)
2021-08-21 08:52:26 <arahael> (Though that might depend on what I'm doing with it. Just right now, I'm doing a web service with haskell)
2021-08-21 08:53:26 <tomsmeding> indeed haskell is also very good at fearless concurrency :)
2021-08-21 08:58:33 dsrt^ joins (~dsrt@209.65.131.194)
2021-08-21 09:00:08 <arahael> Main thing I might pick Rust for is perhaps simpler build tooling, eg, to build a library where I know I can pretty easily produce something for windows, linux, ios, etc, without needing a 16-GB docker image just to build (as is the case for iOS with haskell today, iirc
2021-08-21 09:00:10 <arahael> )
2021-08-21 09:01:19 <int-e> . o O ( rust = cargo cult )
2021-08-21 09:01:27 <tomsmeding> heh
2021-08-21 09:01:28 <arahael> (Eg, with reflex-frp, their docker image needs 16 GB of RAM for doing haskell stuff for iOS, which, incidentially, is the maximum memory you can get on any apple laptop)
2021-08-21 09:01:31 <arahael> int-e: ha.
2021-08-21 09:02:10 <tomsmeding> just use swap ;)
2021-08-21 09:02:23 <arahael> At work I use Swift. Not a /bad/ language - it's actually much better than most other options used in enterprise projects. But blegh, there's so much I wish was better.
2021-08-21 09:02:34 <arahael> tomsmeding: Ha. Swap.
2021-08-21 09:03:23 <tomsmeding> but yeah the cross-compilation story of haskell is suboptimal still

All times are in UTC.