Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,803,442 events total
2025-10-18 18:13:32 × Inline quits (~inlinE@ip-178-202-059-161.um47.pools.vodafone-ip.de) (Ping timeout: 260 seconds)
2025-10-18 18:13:55 Inline joins (~inlinE@ip-178-202-059-161.um47.pools.vodafone-ip.de)
2025-10-18 18:18:38 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
2025-10-18 18:24:59 dtman34 joins (~dtman34@c-73-242-68-179.hsd1.mn.comcast.net)
2025-10-18 18:25:24 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 252 seconds)
2025-10-18 18:25:59 × hseg_ quits (~hseg_@46.120.21.40) (Remote host closed the connection)
2025-10-18 18:26:01 × Square2 quits (~Square@user/square) (Ping timeout: 256 seconds)
2025-10-18 18:31:18 tabaqui joins (~tabaqui@167.71.80.236)
2025-10-18 18:33:30 × jmcantrell quits (~weechat@user/jmcantrell) (Ping timeout: 248 seconds)
2025-10-18 18:36:07 <mreh> can you not use a type family from a superclass in a typeclass definition?
2025-10-18 18:36:34 <mreh> class ColourSampleable a => ColourRenderable a where
2025-10-18 18:36:41 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
2025-10-18 18:36:49 <mreh> colourToGlsl :: Colour a (ColourComponent a) -> ByteString
2025-10-18 18:37:08 <mreh> Colour and ColourComponent are associated types from ColourSampleable
2025-10-18 18:38:08 <mreh> oh, you have to do `colourToGlsl :: a -> Colour a (ColourComponent a) -> ByteString`
2025-10-18 18:41:30 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 248 seconds)
2025-10-18 18:41:43 × Inline quits (~inlinE@ip-178-202-059-161.um47.pools.vodafone-ip.de) (Ping timeout: 240 seconds)
2025-10-18 18:42:38 <dcpagan> The time package does not account for the Gregorian shift.
2025-10-18 18:44:01 <dcpagan> The British empire and its contemporary colonies, including America, adopted the Gregorian calendar in September 1752. If you live in a former British colony, like the United States, running in Linux the command "cal 9 1752" will show that 11 days are missing.
2025-10-18 18:44:55 <dcpagan> However, with the time package in Haskell, the following code is wrong:
2025-10-18 18:44:59 <dcpagan> import Data.Time.Calendar
2025-10-18 18:45:03 <dcpagan> dayOfWeek $ fromGregorian 1752 9 2
2025-10-18 18:45:57 Inline joins (~inlinE@ip-178-202-059-161.um47.pools.vodafone-ip.de)
2025-10-18 18:47:38 × poxel quits (~poxel@user/poxel) (Quit: WeeChat 4.6.3)
2025-10-18 18:47:46 <dcpagan> mreh: With the language feature "TypeSynonymInstances", you can define type class instances for type synonyms.
2025-10-18 18:47:48 <dcpagan> https://downloads.haskell.org/ghc/latest/docs/users_guide/exts/instances.html#extension-TypeSynonymInstances
2025-10-18 18:52:28 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
2025-10-18 18:53:53 <mreh> dcpagan, does that apply to associated types?
2025-10-18 18:53:54 <int-e> This is by design; the package supports ISO 8601 dates which apply the Gregorian calendar "backwards" https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar#Usage
2025-10-18 18:53:56 Inline parts (~inlinE@ip-178-202-059-161.um47.pools.vodafone-ip.de) (Leaving)
2025-10-18 18:54:49 <int-e> It's also a bunch of pure functions so there isn't much room for localization support
2025-10-18 18:55:14 <int-e> which otherwise you'd have to apply to account for all the different adaptation dates around the world
2025-10-18 18:56:13 <dcpagan> :mreh I'm pretty sure; an associated type is just a type family with its members declared in other type class instances.
2025-10-18 18:56:33 <dcpagan> Try enabling "FlexibleInstances".
2025-10-18 18:57:45 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 256 seconds)
2025-10-18 18:57:45 × machinedgod quits (~machinedg@d75-159-126-101.abhsia.telus.net) (Ping timeout: 256 seconds)
2025-10-18 19:00:01 × wbrawner quits (~wbrawner@static.56.224.132.142.clients.your-server.de) (Ping timeout: 264 seconds)
2025-10-18 19:00:07 × caconym7478798 quits (~caconym@user/caconym) (Quit: bye)
2025-10-18 19:00:50 <mreh> hmm, I do already
2025-10-18 19:00:51 caconym7478798 joins (~caconym@user/caconym)
2025-10-18 19:01:10 <mreh> I found a fix, anyway
2025-10-18 19:01:55 wbrawner joins (~wbrawner@static.56.224.132.142.clients.your-server.de)
2025-10-18 19:01:56 <mreh> I'm used to class methods always needing a value of the same type from the instance head
2025-10-18 19:05:39 CiaoSen joins (~Jura@2a02:8071:64e1:da0:5a47:caff:fe78:33db)
2025-10-18 19:08:15 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
2025-10-18 19:12:53 peterbecich joins (~Thunderbi@172.222.148.214)
2025-10-18 19:13:02 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 260 seconds)
2025-10-18 19:17:33 <EvanR> dcpagan, proleptic gregorian calendar
2025-10-18 19:17:55 <EvanR> it goes before gregorian calendar was adopted, even into the years less than zero
2025-10-18 19:18:11 <EvanR> which are off by 1 vs years BC
2025-10-18 19:18:22 <EvanR> same days, different calendar
2025-10-18 19:18:42 <dcpagan> I just read the Wikipedia article, thanks for the reference.
2025-10-18 19:18:50 <dcpagan> I did not know that about ISO-8601.
2025-10-18 19:20:22 <monochrom> mreh: You can also consider "p a -> Colour a (ColourComponent a) -> ByteString". The user will usually supply "Proxy :: Proxy MyType", then a = MyType.
2025-10-18 19:21:43 × forell quits (~forell@user/forell) (Ping timeout: 265 seconds)
2025-10-18 19:23:37 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
2025-10-18 19:28:39 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 252 seconds)
2025-10-18 19:30:38 karenw_ joins (~karenw@user/karenw)
2025-10-18 19:36:38 <mreh> monochrom: I usually settle with (undefined :: a)
2025-10-18 19:37:21 <mreh> it's only for internal use
2025-10-18 19:37:34 <mreh> so I feel I can get away with it
2025-10-18 19:38:27 <EvanR> Proxy is pretty easy and doesn't explode in your face
2025-10-18 19:38:27 × ephilalethes quits (~noumenon@113.51-175-156.customer.lyse.net) (Quit: Leaving)
2025-10-18 19:39:25 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
2025-10-18 19:44:08 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 240 seconds)
2025-10-18 19:48:47 × Unicorn_Princess quits (~Unicorn_P@user/Unicorn-Princess/x-3540542) (Quit: Leaving)
2025-10-18 19:50:13 Unicorn_Princes- joins (~Unicorn_P@89.143.18.181)
2025-10-18 19:54:43 <monochrom> If you turn on TypeApplication, then "Proxy :: Proxy MyType" can be compressed to "Proxy @MyType". It's very pleasing if you came from a System-F background. I did that en masse recently. :)
2025-10-18 19:55:13 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
2025-10-18 19:55:18 werneta joins (~werneta@71.83.160.242)
2025-10-18 19:55:42 <monochrom> I write a type sig "foo :: Modulus m => ..." and the the implementation goes like "foo ... = ... method (Proxy @m) ...".
2025-10-18 19:56:05 <monochrom> ("method" is like "method :: p m -> Integer")
2025-10-18 19:56:55 Unicorn_Princes- is now known as Unicorn_Princes
2025-10-18 19:57:09 × werneta quits (~werneta@71.83.160.242) (Remote host closed the connection)
2025-10-18 19:57:12 <monochrom> If you take TypeApplication to the extreme, you can even change "method"'s type to "method :: Integer" and then the use site goes like "method @m". But I am not that extremist yet. :)
2025-10-18 19:57:59 <EvanR> a variable constant
2025-10-18 19:59:59 <EvanR> everything's a function, including Integers
2025-10-18 20:00:31 <monochrom> I recommend Proxy over undefined for these use cases because going Proxy does not take you more time than going undefined. (OK, apart from scrolling to the top to add "import Data.Proxy".)
2025-10-18 20:01:08 <monochrom> But otherwise I am against over-engineering too.
2025-10-18 20:01:47 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 244 seconds)
2025-10-18 20:03:05 × trickard quits (~trickard@cpe-57-98-47-163.wireline.com.au) (Read error: Connection reset by peer)
2025-10-18 20:03:18 trickard_ joins (~trickard@cpe-57-98-47-163.wireline.com.au)
2025-10-18 20:03:32 <monochrom> (Just replied on the discourse why I would use Maybe even though in general there are a million different causes of errors and Maybe doesn't tell you which. Oh because sometimes there is only one cause, and some other times it doesn't matter.)
2025-10-18 20:07:17 × CiaoSen quits (~Jura@2a02:8071:64e1:da0:5a47:caff:fe78:33db) (Ping timeout: 260 seconds)
2025-10-18 20:09:08 forell joins (~forell@user/forell)
2025-10-18 20:11:18 jmcantrell joins (~weechat@user/jmcantrell)
2025-10-18 20:12:07 humasect joins (~humasect@dyn-192-249-132-90.nexicom.net)
2025-10-18 20:13:17 merijn joins (~merijn@host-vr.cgnat-g.v4.dfn.nl)
2025-10-18 20:13:46 <mreh> monochrom: that's a nice use of type applications I hadn't thought of
2025-10-18 20:14:14 morj joins (~morj@user/morj)
2025-10-18 20:14:15 <mreh> I've already got it turned on, so I might start using that instead
2025-10-18 20:14:49 <morj> If you want to be fancy, you can also use an abstract proxy type: class Who a where whodis :: forall (proxy :: Type -> Type). proxy a -> String
2025-10-18 20:15:23 <mreh> don't you also have to turn on AllowAmbiguousTypes?
2025-10-18 20:15:24 <morj> Then this works with Proxy from base, or anything else the user has defined themselves
2025-10-18 20:16:01 <morj> As a fun bonus, you can also do like `whodis ["a string"]`, which gives you the instance for the string
2025-10-18 20:16:20 <EvanR> knock knock
2025-10-18 20:16:28 <EvanR> whodis
2025-10-18 20:16:29 <mreh> morj: that's funny
2025-10-18 20:16:31 <EvanR> ["a string"]
2025-10-18 20:18:13 × merijn quits (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 256 seconds)

All times are in UTC.