Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→
Page 1 .. 662 663 664 665 666 667 668 669 670 671 672 .. 18013
1,801,292 events total
2021-06-26 16:48:23 peterhil joins (~peterhil@dsl-hkibng32-54f849-252.dhcp.inet.fi)
2021-06-26 16:48:47 tzh joins (~tzh@c-24-21-73-154.hsd1.wa.comcast.net)
2021-06-26 16:49:03 falafel joins (~falafel@pool-96-255-70-50.washdc.fios.verizon.net)
2021-06-26 16:49:32 yauhsien joins (~yauhsien@61-231-57-141.dynamic-ip.hinet.net)
2021-06-26 16:53:55 × MorrowM quits (~MorrowM_@147.161.9.7) (Ping timeout: 258 seconds)
2021-06-26 16:55:27 × tromp quits (~textual@dhcp-077-249-230-040.chello.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
2021-06-26 16:56:28 × charukiewicz quits (~quassel@irouteince04.i.subnet.rcn.com) (Remote host closed the connection)
2021-06-26 16:57:20 dhil joins (~dhil@80.208.56.181)
2021-06-26 16:57:48 charukiewicz joins (~quassel@irouteince04.i.subnet.rcn.com)
2021-06-26 16:57:56 <dminuoso> TheCommieDuck: If this was recurring, you could write generic code to do this for you.
2021-06-26 16:58:05 <dminuoso> Or perhaps better yet TH code
2021-06-26 17:01:08 motte_ joins (~weechat@82.131.74.160.cable.starman.ee)
2021-06-26 17:02:31 × alex3 quits (~alex3@BSN-77-82-41.static.siol.net) (Ping timeout: 250 seconds)
2021-06-26 17:03:53 × pretty_dumm_guy quits (trottel@gateway/vpn/protonvpn/prettydummguy/x-88029655) (Ping timeout: 258 seconds)
2021-06-26 17:05:32 × charukiewicz quits (~quassel@irouteince04.i.subnet.rcn.com) (Quit: No Ping reply in 180 seconds.)
2021-06-26 17:06:22 Codaraxis joins (~Codaraxis@user/codaraxis)
2021-06-26 17:06:42 charukiewicz joins (~quassel@irouteince04.i.subnet.rcn.com)
2021-06-26 17:09:17 × Codaraxis__ quits (~Codaraxis@193.32.126.154) (Ping timeout: 268 seconds)
2021-06-26 17:13:18 <TheCommieDuck> I've gotten FooStore done in TH
2021-06-26 17:13:32 <TheCommieDuck> but it still feels like someone's probably done it properly before me
2021-06-26 17:14:13 × MQ-17J quits (~MQ-17J@8.21.10.15) (Ping timeout: 268 seconds)
2021-06-26 17:15:05 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-06-26 17:15:12 × charukiewicz quits (~quassel@irouteince04.i.subnet.rcn.com) (Quit: No Ping reply in 180 seconds.)
2021-06-26 17:16:27 charukiewicz joins (~quassel@irouteince04.i.subnet.rcn.com)
2021-06-26 17:16:41 × alx741 quits (~alx741@181.196.69.199) (Ping timeout: 268 seconds)
2021-06-26 17:17:05 <dminuoso> Mmm, this usage seems exotic to me.
2021-06-26 17:17:40 alex3 joins (~alex3@BSN-77-82-41.static.siol.net)
2021-06-26 17:18:51 <dminuoso> TheCommieDuck: How did you implement it? Turn each IntMap into a list of pairs, and then scan all intmaps in parallel?
2021-06-26 17:19:02 <dminuoso> (or rather, scan all lists)
2021-06-26 17:19:07 teaSlurper joins (~chris@81.96.113.213)
2021-06-26 17:19:30 dunkeln joins (~dunkeln@188.71.193.140)
2021-06-26 17:20:11 MQ-17J joins (~MQ-17J@d14-69-206-129.try.wideopenwest.com)
2021-06-26 17:20:19 × mc47 quits (~mc47@xmonad/TheMC47) (Read error: Connection reset by peer)
2021-06-26 17:20:23 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 268 seconds)
2021-06-26 17:20:48 <TheCommieDuck> the TH generated has each intMap field as typenameStore, and when defining a new Foo I can make a lens with functors and intmap.union
2021-06-26 17:22:32 eggplantade joins (~Eggplanta@2600:1700:bef1:5e10:c4e3:f231:bc2a:37da)
2021-06-26 17:23:38 × teaSlurper quits (~chris@81.96.113.213) (Ping timeout: 265 seconds)
2021-06-26 17:23:53 × gehmehgeh quits (~user@user/gehmehgeh) (Quit: Leaving)
2021-06-26 17:25:48 <motte_> hi, i'm having trouble writing a function that takes a string and a type and checks whether the string can be parsed to that type. this is what i've got so far: https://paste.tomsmeding.com/cBYkcZkH
2021-06-26 17:26:46 × spicyrice quits (~ubuntu@2600:1f11:52a:4400:ccbc:2b96:cabe:414b) (Quit: WeeChat 2.8)
2021-06-26 17:27:13 <int-e> there's no types at runtime, so you can't pattern match on types. you can use Data.Typeable to have an explicit runtime type representation, but usually there's a better way...
2021-06-26 17:27:14 × eggplantade quits (~Eggplanta@2600:1700:bef1:5e10:c4e3:f231:bc2a:37da) (Ping timeout: 252 seconds)
2021-06-26 17:27:34 <dminuoso> motte_: heh, I think what you are looking for already is readMaybe
2021-06-26 17:27:38 <dminuoso> % :t readMaybe
2021-06-26 17:27:39 <yahb> dminuoso: ; <interactive>:1:1: error: Variable not in scope: readMaybe
2021-06-26 17:27:46 × talismanick quits (~user@2601:644:8502:d700::f19d) (Ping timeout: 256 seconds)
2021-06-26 17:27:49 <dminuoso> % import Text.Read (readMaybe)
2021-06-26 17:27:50 <yahb> dminuoso:
2021-06-26 17:27:51 <dminuoso> % :t readMaybe
2021-06-26 17:27:51 <yahb> dminuoso: forall {a}. Read a => String -> Maybe a
2021-06-26 17:28:43 <motte_> well, i have the possible types in a sum type (data Type in the example)
2021-06-26 17:28:57 <dminuoso> motte_: We can think of both the type variable `a` and the dictionary `Read a` as being term-level arguments to the function. In GHC Haskell this is really the case, except GHC will automatically fill in those arguments using inference.
2021-06-26 17:29:22 alx741 joins (~alx741@181.196.69.41)
2021-06-26 17:29:22 <dminuoso> So:
2021-06-26 17:29:27 <dminuoso> % :t isJust . readMaybe
2021-06-26 17:29:27 <yahb> dminuoso: ; <interactive>:1:10: error:; * Ambiguous type variable `a0' arising from a use of `readMaybe'; prevents the constraint `(Read a0)' from being solved.; Probable fix: use a type annotation to specify what `a0' should be.; These potential instances exist:; instance forall a. Read a => Read (ZipList a) -- Defined in `Control.Applicative'; instance forall a. Read a => Re
2021-06-26 17:29:28 <int-e> ah, sorry, I missed the Type type
2021-06-26 17:29:35 <int-e> or rather, its significance
2021-06-26 17:29:50 <dmj`> motte_: it can work if you use Proxy as a witness to the type at runtime
2021-06-26 17:30:01 <dminuoso> % :t canParse :: Read a => (Proxy a) -> String -> Bool; canParse _ = isJust . readMaybe
2021-06-26 17:30:01 <yahb> dminuoso: ; <interactive>:1:50: error: parse error on input `;'
2021-06-26 17:30:04 <dminuoso> dmj`: Ah you beat me
2021-06-26 17:30:15 <dminuoso> % canParse :: Read a => (Proxy a) -> String -> Bool; canParse _ = isJust . readMaybe
2021-06-26 17:30:15 <yahb> dminuoso: ; <interactive>:104:74: error:; * Could not deduce (Read a0) arising from a use of `readMaybe'; from the context: Read a; bound by the type signature for:; canParse :: forall a. Read a => Proxy a -> String -> Bool; at <interactive>:104:1-49; The type variable `a0' is ambiguous; These potential instances exist:; instance forall a. Read a => Re
2021-06-26 17:30:19 <int-e> motte_: but there's nothing connecting the data constructor named Int to the type named Int, you have to make the connection yourself
2021-06-26 17:30:25 <dmj`> dminuoso: ¯\_(ツ)_/¯
2021-06-26 17:30:38 <dminuoso> % canParse :: forall a. Read a => (Proxy a) -> String -> Bool; canParse _ = isJust . readMaybe @a
2021-06-26 17:30:39 <yahb> dminuoso:
2021-06-26 17:30:41 <dminuoso> motte_: ^-
2021-06-26 17:32:12 × ChaiTRex quits (~ChaiTRex@user/chaitrex) (Quit: ChaiTRex)
2021-06-26 17:35:13 <motte_> hmm, which extensions does this need?
2021-06-26 17:35:27 <motte_> RankNTypes, TypeApplications, what else?
2021-06-26 17:35:53 Schrostfutz joins (~Schrostfu@p5de88aa6.dip0.t-ipconnect.de)
2021-06-26 17:36:46 <geekosaur> ScopedTypeVariables?
2021-06-26 17:38:21 <motte_> ah, yes, got it
2021-06-26 17:39:08 <dmj`> motte_: no rank n types needed
2021-06-26 17:39:15 <dmj`> motte_: just STV and TA
2021-06-26 17:39:22 <dminuoso> motte_: You can avoid the usage of TypeApplications with a type ascriptions instead. You just need ScopedTypevariables
2021-06-26 17:40:35 <dminuoso> % canParse :: forall proxy a. Read a => proxy a -> String -> Bool; canParse _ = isJust . (readMaybe :: String -> Maybe a) -- motte_
2021-06-26 17:40:35 <yahb> dminuoso:
2021-06-26 17:41:12 × fef quits (~thedawn@user/thedawn) (Ping timeout: 244 seconds)
2021-06-26 17:44:16 chexum joins (~chexum@gateway/tor-sasl/chexum)
2021-06-26 17:44:55 <motte_> so using this function would like: canParse (Proxy :: Proxy Int) "5"
2021-06-26 17:46:43 × falafel quits (~falafel@pool-96-255-70-50.washdc.fios.verizon.net) (Ping timeout: 250 seconds)
2021-06-26 17:49:25 <motte_> what if the Int is a member of a sum type and also comes from a variable?
2021-06-26 17:49:42 × Lycurgus quits (~juan@cpe-45-46-140-49.buffalo.res.rr.com) (Quit: Exeunt)
2021-06-26 17:50:37 × cheater quits (~Username@user/cheater) (Ping timeout: 250 seconds)
2021-06-26 17:53:16 <dsal> What is the use case for `canParse`? Normally you'd just parse and if you can't, you'd know because it didn't work. If you can, you'd have the value you get from parsing.
2021-06-26 17:53:28 <dmj`> motte_: you'll probably need an instance of Read
2021-06-26 17:54:12 tromp joins (~textual@dhcp-077-249-230-040.chello.nl)
2021-06-26 17:54:15 cheater joins (~Username@user/cheater)
2021-06-26 17:54:22 × egoist quits (~egoist@186.235.82.7) (Ping timeout: 268 seconds)
2021-06-26 17:54:54 × Hanicef quits (~gustaf@78-71-43-30-no260.tbcn.telia.com) (Quit: leaving)
2021-06-26 17:58:01 <euandreh> I see Real World Haskell has a chapter on parsec. Are there other books that cover it?
2021-06-26 17:58:11 <euandreh> (other than online articles, blog posts, etc.)
2021-06-26 18:00:35 <dsal> The biggest bit of the learning curve I found for *parsec is that it's not actually that complicated and barely does anything at all... but it seems like it should be complicated and do a lot, so I also got frustrated when I couldn't find great material that explained it all.
2021-06-26 18:00:52 egoist joins (~egoist@186.235.82.105)
2021-06-26 18:00:55 <dsal> Then I just started reading and writing parsers.
2021-06-26 18:01:05 × myShoggoth quits (~myShoggot@75.164.29.44) (Ping timeout: 268 seconds)
2021-06-26 18:01:22 lavaman joins (~lavaman@98.38.249.169)

All times are in UTC.