Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,804,057 events total
2021-08-12 14:23:11 × Kirat_ quits (~Gill@157.39.46.3) (Client Quit)
2021-08-12 14:24:09 mattil joins (~mattilinn@87-92-39-170.bb.dnainternet.fi)
2021-08-12 14:24:30 Kirat joins (~Gill@103.217.122.17)
2021-08-12 14:25:14 × mattil quits (~mattilinn@87-92-39-170.bb.dnainternet.fi) (Remote host closed the connection)
2021-08-12 14:25:37 mattil joins (~mattilinn@87-92-39-170.bb.dnainternet.fi)
2021-08-12 14:26:33 × Kirat quits (~Gill@103.217.122.17) (Client Quit)
2021-08-12 14:26:57 jespada joins (~jespada@90.254.247.46)
2021-08-12 14:27:16 × Pickchea quits (~private@user/pickchea) (Quit: Leaving)
2021-08-12 14:28:47 myShoggoth joins (~myShoggot@97-120-70-214.ptld.qwest.net)
2021-08-12 14:30:09 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2021-08-12 14:32:25 <janus> does anyone know any alternatively licensed versions of inverseMap from relude? our library is BSD licensed, and relude is MIT. i feel like it could be age-old folklore, maybe there are other versions
2021-08-12 14:35:47 drownbes joins (~igloo@gprs-inet-183-219.elisa.ee)
2021-08-12 14:36:33 <tomsmeding> :t \f -> let m = M.fromListWith (error "non-injective") [(f x, x) <- [minBound..maxBound]] in \y -> M.lookup y m
2021-08-12 14:36:34 <lambdabot> error:
2021-08-12 14:36:34 <lambdabot> parse error on input ‘<-’
2021-08-12 14:36:34 <lambdabot> Perhaps this statement should be within a 'do' block?
2021-08-12 14:36:46 Sgeo joins (~Sgeo@user/sgeo)
2021-08-12 14:36:56 <tomsmeding> :t \f -> let m = M.fromListWith (error "non-injective") [(f x, x) | x <- [minBound..maxBound]] in \y -> M.lookup y m
2021-08-12 14:36:58 <lambdabot> (Ord k, Bounded a, Enum a) => (a -> k) -> k -> Maybe a
2021-08-12 14:37:07 × drownbes quits (~igloo@gprs-inet-183-219.elisa.ee) (Client Quit)
2021-08-12 14:37:39 <janus> tomsmeding: thanks, what's the license ? ;)
2021-08-12 14:37:43 <tomsmeding> janus: wrote this without looking at relude sources; I publish it in the public domain :p
2021-08-12 14:38:04 <janus> amazing, thanks :D
2021-08-12 14:38:08 <tomsmeding> Check that it has the right behaviour though
2021-08-12 14:38:26 <tomsmeding> Like, check that from the second call onward it's fast
2021-08-12 14:39:18 wallymathieu joins (~wallymath@81-234-151-21-no94.tbcn.telia.com)
2021-08-12 14:39:23 <janus> well if it has a map on the scope immediatly inside the function. surely it can't be different than relude's if also use INLINE
2021-08-12 14:39:34 <janus> but better crack open core, i guess
2021-08-12 14:39:49 <tomsmeding> Just test it :p
2021-08-12 14:40:14 <boxscape> (I usually do [minBound..] instead of [minBound..maxBound])
2021-08-12 14:40:59 <tomsmeding> Right, because enumFrom can potentially be faster than enumFromTo
2021-08-12 14:41:01 <tomsmeding> Good call
2021-08-12 14:41:15 <boxscape> I mostly do it because It's shorter but I guess that's not a bad reason either :P
2021-08-12 14:41:33 <boxscape> though I'm not sure if it really is faster
2021-08-12 14:42:46 wonko joins (~wjc@62.115.229.50)
2021-08-12 14:44:37 <tomsmeding> Lol the enumFrom of Word32 is (indirectly) defined as the same as enumFromTo with maxBound
2021-08-12 14:44:56 <boxscape> yeah I was looking at -ddump-deriv, it's much the same
2021-08-12 14:45:05 <tomsmeding> They use these functions at the bottom of the file https://hackage.haskell.org/package/base-4.15.0.0/docs/src/GHC-Real.html#integralEnumFrom
2021-08-12 14:45:14 <boxscape> even if you don't have a Bounded instance it calls enumFromTo $maxtag
2021-08-12 14:47:55 <tomsmeding> boxscape: that would depend on how the instance in question implements enumFrom, right?
2021-08-12 14:48:05 <tomsmeding> The default implementation is bonkers for bounded types
2021-08-12 14:48:27 <boxscape> right, what I mean is that's the enumFrom instance if you write deriving Enum
2021-08-12 14:48:32 <merijn> Enum is a bonkers and bad class anyway
2021-08-12 14:48:36 × wallymathieu quits (~wallymath@81-234-151-21-no94.tbcn.telia.com) (Quit: My MacBook has gone to sleep. ZZZzzz…)
2021-08-12 14:48:41 <boxscape> s/instance/implementation
2021-08-12 14:48:42 <merijn> Fire into the sun, plx
2021-08-12 14:48:53 <tomsmeding> boxscape: the default implementation of enumFrom is enumFrom x = map toEnum [fromEnum x ..]
2021-08-12 14:49:03 <tomsmeding> Which is going to beautifully error out for bounded types
2021-08-12 14:49:25 <tomsmeding> (which the docs also say)
2021-08-12 14:49:26 <boxscape> yep though luckily it's not used if you derive Enum
2021-08-12 14:49:43 <tomsmeding> Ooh _deriving_ Enum, I see
2021-08-12 14:50:43 <tomsmeding> merijn: what's your suggestion for a replacement? Split off fromEnum/toEnum into a separate class?
2021-08-12 14:51:13 × Boomerang quits (~Boomerang@xd520f68c.cust.hiper.dk) (Ping timeout: 248 seconds)
2021-08-12 14:51:38 tchakka_ is now known as tchakka
2021-08-12 14:52:01 <merijn> tomsmeding: 1) get rid of the mapping to ints, it leads to all sorts of bad code, 2) have separate classes for bounded and unbounded types
2021-08-12 14:52:16 <merijn> 3) nuke "instance Enum Double" from orbit
2021-08-12 14:52:29 <tomsmeding> Lol can back 3
2021-08-12 14:52:34 <merijn> tomsmeding: Why do we have/need fromEnum/toEnum to begin with?
2021-08-12 14:52:51 <tomsmeding> Although... It's terribly convenient for one-off oneliners
2021-08-12 14:52:58 × waleee quits (~waleee@2001:9b0:216:8200:d457:9189:7843:1dbd) (Ping timeout: 240 seconds)
2021-08-12 14:53:24 <tomsmeding> But I agree
2021-08-12 14:53:41 nvmd joins (~nvmd@user/nvmd)
2021-08-12 14:54:01 <tomsmeding> Eh, map fromIntegral [a..b] is fine as a replacement of Enum Double for oneliners
2021-08-12 14:54:26 × curiousgay quits (~curiousga@77-120-186-48.kha.volia.net) (Ping timeout: 272 seconds)
2021-08-12 14:55:00 waleee joins (~waleee@h-98-128-228-119.NA.cust.bahnhof.se)
2021-08-12 14:56:14 <tomsmeding> Unrelated, why does this exist: instance a ~ b => Bounded (a :~: b)
2021-08-12 14:56:30 <tomsmeding> I can't imagine a usecase
2021-08-12 14:58:38 × ldlework quits (~hexeme@user/hexeme) (Quit: co'o ro do)
2021-08-12 14:59:06 ec joins (~ec@gateway/tor-sasl/ec)
2021-08-12 14:59:38 <boxscape> I imagine the it's there for lack of a reason not to provide it
2021-08-12 14:59:50 <kuribas> > [minbound..] :: Bool
2021-08-12 14:59:51 <lambdabot> error:
2021-08-12 14:59:51 <lambdabot> • Variable not in scope: minbound
2021-08-12 14:59:51 <lambdabot> • Perhaps you meant ‘minBound’ (imported from Prelude)
2021-08-12 14:59:55 <kuribas> > [minBound..] :: Bool
2021-08-12 14:59:57 <lambdabot> error:
2021-08-12 14:59:57 <lambdabot> • Couldn't match expected type ‘Bool’ with actual type ‘[a0]’
2021-08-12 14:59:57 <lambdabot> • In the expression: [minBound .. ] :: Bool
2021-08-12 15:00:00 <kuribas> > [minBound..] :: [Bool]
2021-08-12 15:00:02 <lambdabot> [False,True]
2021-08-12 15:00:03 Tuplanolla joins (~Tuplanoll@91-159-69-50.elisa-laajakaista.fi)
2021-08-12 15:02:12 hexeme joins (~hexeme@user/hexeme)
2021-08-12 15:03:23 × Vq quits (~vq@90-227-195-41-no77.tbcn.telia.com) (Ping timeout: 268 seconds)
2021-08-12 15:03:44 Vq joins (~vq@90-227-195-41-no77.tbcn.telia.com)
2021-08-12 15:06:34 × theproffesor quits (~theproffe@user/theproffesor) (Ping timeout: 240 seconds)
2021-08-12 15:08:10 <boxscape> % type (:) = Either
2021-08-12 15:08:10 <yahb> boxscape: ; <interactive>:3:6: error: Malformed head of type or class declaration: (:)
2021-08-12 15:08:19 <boxscape> hm I don't really see why this is not allowed
2021-08-12 15:09:18 chomwitt joins (~chomwitt@athedsl-32301.home.otenet.gr)
2021-08-12 15:10:10 × infinity0 quits (~infinity0@occupy.ecodis.net) (Ping timeout: 268 seconds)
2021-08-12 15:10:21 × alx741 quits (~alx741@181.196.68.193) (Quit: alx741)
2021-08-12 15:11:29 × Guest8182 quits (~chris@81.96.113.213) (Remote host closed the connection)
2021-08-12 15:12:38 × lortabac quits (~lortabac@2a01:e0a:541:b8f0:b0bf:dbe4:8f07:fd4e) (Quit: WeeChat 2.8)
2021-08-12 15:12:43 jumper149 joins (~jumper149@80.240.31.34)
2021-08-12 15:13:00 <tomsmeding> % type (::) = Either
2021-08-12 15:13:00 <yahb> tomsmeding: ; <interactive>:5:7: error: parse error on input `::'
2021-08-12 15:13:20 <tomsmeding> % typw (:!!) = Either
2021-08-12 15:13:20 <yahb> tomsmeding: ; <interactive>:6:6: error:; Not in scope: data constructor `:!!'; Perhaps you meant variable `!!' (imported from Prelude)
2021-08-12 15:13:32 <tomsmeding> % type (:!!) = Either
2021-08-12 15:13:32 <yahb> tomsmeding:

All times are in UTC.