Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→
Page 1 .. 75 76 77 78 79 80 81 82 83 84 85 .. 17901
1,790,036 events total
2021-05-25 15:08:45 <raehik> But being in a Monad means we can use Applicatives. I tripped up in my head a bit
2021-05-25 15:08:54 <boxscape> yeah since Applicative is a superclass of Monad, you can always tell ghc that something has a Monad constraint instead of Applicative
2021-05-25 15:08:58 <raehik> boxscape: thanks for writing it out like that lol
2021-05-25 15:09:04 <boxscape> % :t pure :: Monad f => a -> f a
2021-05-25 15:09:04 <yahb> boxscape: Monad f => a -> f a
2021-05-25 15:09:07 <boxscape> np
2021-05-25 15:09:11 <raehik> right right right
2021-05-25 15:11:27 ddellacosta joins (~ddellacos@86.106.121.79)
2021-05-25 15:14:21 <boxscape> So, I have a Map with Text keys, and I want the lookup to match whenever I pass in something of which the key is a suffix. I think I can make this work with a custom Ord instance, but since Eq is commutative, that means it must also match if the passed in value is a suffix of the key. I don't think that should be a problem for my use case, but is
2021-05-25 15:14:21 <boxscape> there a neat way to get around this? I'm not going to be able to use packages here that ghc doesn't ship with.
2021-05-25 15:14:34 × ddellaco_ quits (~ddellacos@89.46.62.22) (Ping timeout: 264 seconds)
2021-05-25 15:14:35 <boxscape> s/Eq/(==)
2021-05-25 15:14:50 <boxscape> s/commutative/symmetric, I guess
2021-05-25 15:15:59 <boxscape> feels Trie-y but not sure it's worth implementing that when a Map is likely to do the job
2021-05-25 15:16:50 <c_wraith> Map is really weird there. Like, it works, but it sure isn't what someone would expect it to do
2021-05-25 15:17:00 <boxscape> hmm
2021-05-25 15:17:06 <boxscape> that is true
2021-05-25 15:18:00 <opqdonut> boxscape: one "neat" way is to reverse the strings, and then use Data.Map.split
2021-05-25 15:18:38 × horex539 quits (~horex539@2a02:a03f:6aa5:a00:3c1a:90fc:fb6d:766e) (Remote host closed the connection)
2021-05-25 15:19:01 <opqdonut> > Data.Map.split "ab" (Data.Map.fromList [("aa",1),("aaa",2),("aba",3),("abc",4)])
2021-05-25 15:19:02 <lambdabot> (fromList [("aa",1),("aaa",2)],fromList [("aba",3),("abc",4)])
2021-05-25 15:19:10 <c_wraith> couldn't you use lookupLE or lookupGE instead of split?
2021-05-25 15:19:58 × nan` quits (~nan`@rrcs-70-60-83-42.central.biz.rr.com) (Ping timeout: 264 seconds)
2021-05-25 15:20:09 <boxscape> % Data.Map.lookupGE "ab" (Data.Map.fromList [("aa",1),("aaa",2),("aba",3),("abc",4)])
2021-05-25 15:20:09 <yahb> boxscape: Just ("aba",3)
2021-05-25 15:20:11 <opqdonut> c_wraith: those don't exist in my Data.Map, but sure
2021-05-25 15:20:23 <geekosaur> ?
2021-05-25 15:20:28 <opqdonut> oh I was browsing ancient docs
2021-05-25 15:20:28 <boxscape> that seems like a good idea, thanks
2021-05-25 15:20:44 <c_wraith> Yeah, I was sure those functions had been around for a while
2021-05-25 15:21:10 <boxscape> I guess I'm going to need to make sure afterwards that it actually is a suffix
2021-05-25 15:21:14 <opqdonut> yeah
2021-05-25 15:24:53 × WikiLycurgus quits (~juan@cpe-45-46-140-49.buffalo.res.rr.com) (Quit: Exeunt)
2021-05-25 15:28:43 learner-monad joins (~ehanneken@cpe-174-105-47-100.columbus.res.rr.com)
2021-05-25 15:29:39 <boxscape> hm, actually it's not quite that because this checks if the lookup key is a suffix of the Map key, rather than vice versa. But it should lead me towards the right solution, anyway
2021-05-25 15:30:00 Hobbyboy joins (Hobbyboy@hobbyboy.co.uk)
2021-05-25 15:33:01 × lortabac quits (~lortabac@2a01:e0a:541:b8f0:d4bd:911b:bb62:6168) (Quit: WeeChat 2.8)
2021-05-25 15:34:07 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-05-25 15:39:13 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 265 seconds)
2021-05-25 15:39:26 × Franciman quits (~francesco@host-80-180-196-134.pool80180.interbusiness.it) (Quit: Leaving)
2021-05-25 15:42:13 × qbt quits (~edun@user/edun) (Quit: WeeChat 3.1)
2021-05-25 15:44:58 nan` joins (~nan`@rrcs-70-60-83-42.central.biz.rr.com)
2021-05-25 15:45:20 eggplantade joins (~Eggplanta@2600:1700:bef1:5e10:c032:b754:d42c:78b5)
2021-05-25 15:46:05 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-05-25 15:50:01 <xerox> anybody knows what "Paths_strip" is here? https://github.com/hspec/hspec-example/blob/master/strip.cabal#L40 can't find it in the cabal docs directly, only a sideways mention pops up in direct search https://cabal.readthedocs.io/en/3.4/search.html?q=Paths_&check_keywords=yes&area=default
2021-05-25 15:50:47 <c_wraith> that's.. weird. why is it in other-modules?
2021-05-25 15:51:10 <xerox> both in the test-suite and the library to boot
2021-05-25 15:51:15 × chddr quits (~Thunderbi@91.226.34.182) (Ping timeout: 272 seconds)
2021-05-25 15:51:26 <c_wraith> the Paths_* modules are created by cabal to include installation locations of data files
2021-05-25 15:51:41 <c_wraith> Paths_strip is going to have locations for the strip package
2021-05-25 15:51:51 × nan` quits (~nan`@rrcs-70-60-83-42.central.biz.rr.com) (Ping timeout: 264 seconds)
2021-05-25 15:52:27 <c_wraith> but... including it in the cabal file makes no sense because it should be generated on installation, not packaged up as part of the source
2021-05-25 15:53:03 <xerox> I think it's a way to fix the problem of the spec files importing the relative files they are the spec for in an automated fashion, except it doesn't quite work for me so I wanted to dig a bit, coming up empty tho
2021-05-25 15:53:20 <c_wraith> Oh, maybe putting it in other-modules is a weird attempt to prevent people from using it?
2021-05-25 15:53:41 <c_wraith> I don't know *why* you would do that, but it probably would prevent people from using it
2021-05-25 15:53:43 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 265 seconds)
2021-05-25 15:54:26 <c_wraith> oh, that file is generated by hpack, so hpack is going to do that with everything it touches. lovely.
2021-05-25 15:54:55 <c_wraith> summary: don't use hpack
2021-05-25 15:55:05 <xerox> ah that's different
2021-05-25 15:55:07 <monochrom> :)
2021-05-25 15:55:21 <xerox> good catch I thought it was a hand written cabal file like mine
2021-05-25 15:56:21 notzmv is now known as loskami
2021-05-25 15:56:30 <c_wraith> maybe hpack is doing that because there are no other-files included, so the Paths module should be empty anyway?
2021-05-25 15:56:34 <c_wraith> It's just bizarre
2021-05-25 15:56:43 loskami is now known as notzmv
2021-05-25 15:56:53 <Clint> i'm pretty sure cabal yelled at me to put a Paths_ module in autogen-modules before
2021-05-25 15:58:23 <c_wraith> see, that's a place that makes sense. other-modules does not.
2021-05-25 15:58:43 <c_wraith> other-modules just exists to prevent modules from being imported
2021-05-25 15:59:12 <monochrom> xerox: https://cabal.readthedocs.io/en/3.4/cabal-package.html?highlight=getsysconfdir#accessing-data-files-from-package-code explains Paths_*
2021-05-25 16:00:20 × Tomurb quits (~tom@158.194.92.121) (Ping timeout: 244 seconds)
2021-05-25 16:00:28 <c_wraith> Except within the package itself, I suppose. Ok, I understand what hpack was trying to do, but it did it weirdly.
2021-05-25 16:00:36 <monochrom> Ah, it is also supposed to be listed under other-modules and autogen-modules
2021-05-25 16:00:51 × lbseale__ quits (~lbseale@ip72-194-54-201.sb.sd.cox.net) (Ping timeout: 264 seconds)
2021-05-25 16:01:27 × Aran quits (~Aran@port-92-194-80-170.dynamic.as20676.net) (Ping timeout: 264 seconds)
2021-05-25 16:01:35 <c_wraith> yeah, looks like autogen-modules prevents it from being included in the sdist
2021-05-25 16:01:35 <monochrom> Actually I don't know why it "must" be in other-modules. Then again in most use cases it is an implementation detail you don't normally export.
2021-05-25 16:01:50 × nerdy quits (znc@152.67.162.71) (Changing host)
2021-05-25 16:01:50 nerdy joins (znc@user/nerdypepper)
2021-05-25 16:01:55 <trueboxguy> I use paths a lot, but I always get haddock complaining about Paths_* not being documented
2021-05-25 16:02:06 × brandonh quits (~brandonh@mi-18-24-205.service.infuturo.it) (Read error: Connection reset by peer)
2021-05-25 16:02:18 lbseale joins (~lbseale@ip72-194-54-201.sb.sd.cox.net)
2021-05-25 16:02:28 <monochrom> It is not supposed to be included in sdist though. Its content is supposed to change at build time.
2021-05-25 16:02:29 <xerox> so the Paths_<name> under library is instructing cabal to generate / expose that particular module, whereas the one under test-suite is making it possible for the test suite to access it?
2021-05-25 16:02:32 × eggplantade quits (~Eggplanta@2600:1700:bef1:5e10:c032:b754:d42c:78b5) (Remote host closed the connection)
2021-05-25 16:03:21 <c_wraith> I don't understand why it would be in other-modules if you expect it to be used. other-modules is for things other packages can't import.
2021-05-25 16:03:47 <c_wraith> I guess the idea is you don't expect any other package to use your data files
2021-05-25 16:03:49 ddellaco_ joins (~ddellacos@89.46.62.112)
2021-05-25 16:04:00 eggplantade joins (~Eggplanta@2600:1700:bef1:5e10:c032:b754:d42c:78b5)
2021-05-25 16:04:53 <c_wraith> but once again, the strip package has no data-files section, so it's a lot of dubious ceremony for nothing
2021-05-25 16:06:05 <xerox> oh it's *just* data files, it has nothing to do with modules
2021-05-25 16:06:23 × unyu quits (~pyon@user/pyon) (Quit: WeeChat 3.1)
2021-05-25 16:06:39 brandonh joins (~brandonh@2a04:3542:1000:910:905f:f9ff:fe67:4d32)
2021-05-25 16:06:50 × ddellacosta quits (~ddellacos@86.106.121.79) (Ping timeout: 252 seconds)
2021-05-25 16:07:17 nan` joins (~nan`@rrcs-70-60-83-42.central.biz.rr.com)
2021-05-25 16:07:24 nschoe joins (~quassel@178.251.84.79)
2021-05-25 16:09:11 × cdsmithus quits (~cdsmithus@c-73-184-127-183.hsd1.ga.comcast.net) (Ping timeout: 265 seconds)
2021-05-25 16:09:17 cheater1__ joins (~Username@user/cheater)
2021-05-25 16:09:25 × cheater quits (~Username@user/cheater) (Ping timeout: 272 seconds)
2021-05-25 16:09:28 cheater1__ is now known as cheater
2021-05-25 16:11:24 × coot quits (~coot@37.30.49.19.nat.umts.dynamic.t-mobile.pl) (Quit: coot)
←Prev  Next→
Page 1 .. 75 76 77 78 79 80 81 82 83 84 85 .. 17901

All times are in UTC.