Logs: liberachat/#haskell
| 2021-07-03 21:48:38 | × | neo1 quits (~neo3@cpe-292712.ip.primehome.com) (Ping timeout: 272 seconds) |
| 2021-07-03 21:48:50 | × | cheater quits (~Username@user/cheater) (Ping timeout: 258 seconds) |
| 2021-07-03 21:48:53 | cheater1__ | is now known as cheater |
| 2021-07-03 21:49:36 | × | Gurkenglas quits (~Gurkengla@dslb-002-203-144-156.002.203.pools.vodafone-ip.de) (Ping timeout: 258 seconds) |
| 2021-07-03 21:51:10 | × | nate1 quits (~nate@108-233-125-227.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 272 seconds) |
| 2021-07-03 21:56:48 | × | azeem quits (~azeem@176.200.221.91) (Ping timeout: 256 seconds) |
| 2021-07-03 21:57:09 | → | beka joins (~beka@104-244-27-23.static.monkeybrains.net) |
| 2021-07-03 21:57:53 | → | azeem joins (~azeem@176.200.221.91) |
| 2021-07-03 21:58:46 | × | fengctor quits (~fengctor@bras-base-ngflon0508w-grc-11-76-68-2-143.dsl.bell.ca) (Ping timeout: 272 seconds) |
| 2021-07-03 22:00:02 | × | MQ-17J quits (~MQ-17J@d14-69-206-129.try.wideopenwest.com) (Ping timeout: 272 seconds) |
| 2021-07-03 22:00:20 | × | amahl quits (~amahl@dsl-jklbng12-54fbca-64.dhcp.inet.fi) (Ping timeout: 258 seconds) |
| 2021-07-03 22:02:39 | → | MQ-17J joins (~MQ-17J@d14-69-206-129.try.wideopenwest.com) |
| 2021-07-03 22:03:12 | × | cheater quits (~Username@user/cheater) (Ping timeout: 252 seconds) |
| 2021-07-03 22:03:47 | → | cheater joins (~Username@user/cheater) |
| 2021-07-03 22:04:42 | × | favonia quits (~favonia@user/favonia) (Ping timeout: 240 seconds) |
| 2021-07-03 22:06:23 | → | lavaman joins (~lavaman@98.38.249.169) |
| 2021-07-03 22:07:13 | → | favonia joins (~favonia@user/favonia) |
| 2021-07-03 22:07:38 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 272 seconds) |
| 2021-07-03 22:08:34 | × | lavaman quits (~lavaman@98.38.249.169) (Remote host closed the connection) |
| 2021-07-03 22:08:47 | → | lavaman joins (~lavaman@98.38.249.169) |
| 2021-07-03 22:12:09 | → | stevenxl joins (~stevenlei@68.235.43.93) |
| 2021-07-03 22:16:42 | × | akhileshs quits (~user@c-73-63-166-39.hsd1.ca.comcast.net) (Ping timeout: 240 seconds) |
| 2021-07-03 22:16:56 | × | azeem quits (~azeem@176.200.221.91) (Ping timeout: 265 seconds) |
| 2021-07-03 22:17:14 | × | __monty__ quits (~toonn@user/toonn) (Quit: leaving) |
| 2021-07-03 22:17:34 | → | azeem joins (~azeem@176.200.221.91) |
| 2021-07-03 22:19:06 | × | neceve quits (~quassel@2a02:c7f:607e:d600:f762:20dd:304e:4b1f) (Ping timeout: 240 seconds) |
| 2021-07-03 22:19:37 | × | lavaman quits (~lavaman@98.38.249.169) (Remote host closed the connection) |
| 2021-07-03 22:20:45 | → | sayola joins (~vekto@dslb-088-078-152-192.088.078.pools.vodafone-ip.de) |
| 2021-07-03 22:24:58 | × | eggplantade quits (~Eggplanta@2600:1700:bef1:5e10:5061:15ea:118b:e58d) (Remote host closed the connection) |
| 2021-07-03 22:29:17 | → | nattiestnate joins (~nate@180.243.15.91) |
| 2021-07-03 22:29:24 | × | pera quits (~pera@user/pera) (Ping timeout: 268 seconds) |
| 2021-07-03 22:30:54 | → | pera joins (~pera@user/pera) |
| 2021-07-03 22:34:35 | <xacktm> | what pattern should I use if I want to convert between a sum type and a Char? Enum is my first thought, but are those restricted to mapping between Ints only? |
| 2021-07-03 22:35:10 | <xacktm> | e.g. TypeA is 'A'; TypeB is 'B', etc |
| 2021-07-03 22:35:34 | → | fengctor joins (~fengctor@bras-base-ngflon0508w-grc-11-76-68-2-143.dsl.bell.ca) |
| 2021-07-03 22:37:21 | <geekosaur> | Enum only works with Int, yes |
| 2021-07-03 22:38:08 | × | nattiestnate quits (~nate@180.243.15.91) (Quit: WeeChat 3.2) |
| 2021-07-03 22:39:41 | <xacktm> | hmm, I guess a naive approach should work: fromMyType and toMyType functions and pattern matching |
| 2021-07-03 22:40:31 | <geekosaur> | there's also toConstr and using the resulting Constr value (https://hackage.haskell.org/package/base-4.15.0.0/docs/Data-Data.html#t:Constr) |
| 2021-07-03 22:42:09 | <geekosaur> | (you can't use the Constr directly but one of its fiellds will lead you to a value which starts counting at 1 for each field of an algebraic datatype) |
| 2021-07-03 22:42:41 | × | zeenk quits (~zeenk@2a02:2f04:a106:9600:82fb:aed9:ca9:38d3) (Quit: Konversation terminated!) |
| 2021-07-03 22:44:21 | <geekosaur> | and use the same mechanism in the opposite direction to reconstruct an algebraic constructor, since this is part of generics |
| 2021-07-03 22:45:46 | <xacktm> | nice, I found this blog post: does this explain everything you're referring to? https://chrisdone.com/posts/data-typeable/ |
| 2021-07-03 22:46:45 | <xacktm> | most of it is going over my head, need to go slow and unpack :P |
| 2021-07-03 22:47:13 | <geekosaur> | seems to, perhaps not in as full detail (they show the Show instance for an AlgRep but not the stuff underneath that you'll want to use to map between numbers and eventually Chars) |
| 2021-07-03 22:48:11 | <geekosaur> | oh, actually it does seem to get at least close to that detail |
| 2021-07-03 22:48:27 | <geekosaur> | so you should be set between that page and the haddock to see further detail based on that page |
| 2021-07-03 22:48:44 | <xacktm> | all right, thanks for the pointer! |
| 2021-07-03 22:49:04 | → | cheater1__ joins (~Username@user/cheater) |
| 2021-07-03 22:49:08 | × | cheater quits (~Username@user/cheater) (Ping timeout: 268 seconds) |
| 2021-07-03 22:49:16 | cheater1__ | is now known as cheater |
| 2021-07-03 22:50:18 | → | lavaman joins (~lavaman@98.38.249.169) |
| 2021-07-03 22:50:33 | <ephemient> | if your data type itself is enum, a quick hack like this might be sufficient. data MyType = MyTypeA | MyTypeB deriving Enum; myTypeToChar :: MyType -> Char; myTypeToChar = chr . (ord 'A' +) . fromEnum -- and vice-versa |
| 2021-07-03 22:51:23 | <geekosaur> | true, but that means (for example) no fields, just constructors |
| 2021-07-03 22:51:43 | <ephemient> | yep, for anything else typeable seems like the only generic solution |
| 2021-07-03 22:53:28 | × | acidjnk_new quits (~acidjnk@p200300d0c72b953339f341015709cf67.dip0.t-ipconnect.de) (Ping timeout: 256 seconds) |
| 2021-07-03 22:54:46 | × | lavaman quits (~lavaman@98.38.249.169) (Ping timeout: 258 seconds) |
| 2021-07-03 22:56:19 | → | fizbin joins (~fizbin@c-73-33-197-160.hsd1.nj.comcast.net) |
| 2021-07-03 22:59:08 | × | hrnz quits (~ulli@irc.plumbing) (Quit: das ist mir zu bld hier; bb) |
| 2021-07-03 22:59:28 | → | hrnz joins (~ulli@irc.plumbing) |
| 2021-07-03 23:00:15 | → | falafel joins (~falafel@pool-96-255-70-50.washdc.fios.verizon.net) |
| 2021-07-03 23:00:54 | × | fizbin quits (~fizbin@c-73-33-197-160.hsd1.nj.comcast.net) (Ping timeout: 258 seconds) |
| 2021-07-03 23:04:20 | → | eggplantade joins (~Eggplanta@2600:1700:bef1:5e10:5061:15ea:118b:e58d) |
| 2021-07-03 23:09:20 | × | falafel quits (~falafel@pool-96-255-70-50.washdc.fios.verizon.net) (Ping timeout: 258 seconds) |
| 2021-07-03 23:09:24 | × | tabemann quits (~tabemann@172-13-49-137.lightspeed.milwwi.sbcglobal.net) (Remote host closed the connection) |
| 2021-07-03 23:10:16 | → | tabemann joins (~tabemann@172-13-49-137.lightspeed.milwwi.sbcglobal.net) |
| 2021-07-03 23:10:33 | × | dsf quits (~dsf@cpe-66-75-56-205.san.res.rr.com) (Quit: Konversation terminated!) |
| 2021-07-03 23:10:39 | → | dsf_ joins (~dsf@cpe-66-75-56-205.san.res.rr.com) |
| 2021-07-03 23:11:36 | × | favonia quits (~favonia@user/favonia) (Ping timeout: 256 seconds) |
| 2021-07-03 23:12:03 | → | favonia joins (~favonia@user/favonia) |
| 2021-07-03 23:12:59 | × | mc47 quits (~mc47@xmonad/TheMC47) (Quit: Leaving) |
| 2021-07-03 23:15:28 | × | norias quits (~jaredm@c-98-219-195-163.hsd1.pa.comcast.net) (Ping timeout: 258 seconds) |
| 2021-07-03 23:16:53 | × | justsomeguy quits (~justsomeg@user/justsomeguy) (Ping timeout: 268 seconds) |
| 2021-07-03 23:17:56 | × | azeem quits (~azeem@176.200.221.91) (Ping timeout: 272 seconds) |
| 2021-07-03 23:18:36 | → | justsomeguy joins (~justsomeg@user/justsomeguy) |
| 2021-07-03 23:20:42 | × | laguneucl quits (~Pitsikoko@athedsl-16082.home.otenet.gr) (Ping timeout: 240 seconds) |
| 2021-07-03 23:21:01 | → | azeem joins (~azeem@176.200.221.91) |
| 2021-07-03 23:21:11 | → | v01d4lph4 joins (~v01d4lph4@user/v01d4lph4) |
| 2021-07-03 23:21:40 | × | mikoto-chan quits (~mikoto-ch@ip-213-49-189-31.dsl.scarlet.be) (Ping timeout: 252 seconds) |
| 2021-07-03 23:22:09 | → | bitdex joins (~bitdex@gateway/tor-sasl/bitdex) |
| 2021-07-03 23:26:10 | × | v01d4lph4 quits (~v01d4lph4@user/v01d4lph4) (Ping timeout: 272 seconds) |
| 2021-07-03 23:31:26 | × | favonia quits (~favonia@user/favonia) (Ping timeout: 256 seconds) |
| 2021-07-03 23:31:51 | → | favonia joins (~favonia@user/favonia) |
| 2021-07-03 23:33:52 | × | cheater quits (~Username@user/cheater) (Ping timeout: 258 seconds) |
| 2021-07-03 23:34:19 | → | cheater joins (~Username@user/cheater) |
| 2021-07-03 23:34:27 | → | sciencentistguy joins (~sciencent@hacksoc/ordinary-member) |
| 2021-07-03 23:35:57 | <sciencentistguy> | Is there a way i can have a function parameter that could take either `(+) :: Num a => a -> a -> a` or `(/) :: Fractional a => a -> a -> a` (note the different typeclass constraints) |
| 2021-07-03 23:36:17 | <sciencentistguy> | i tried `forall c. forall a. c a => a -> a -> a` but that didn't work |
| 2021-07-03 23:37:00 | <geekosaur> | I think there's a way to do that but it requires extensions? |
| 2021-07-03 23:37:07 | <sciencentistguy> | i'm fine with using extensions |
| 2021-07-03 23:37:49 | <sciencentistguy> | i already need RankNTypes for the `forall` clauses |
| 2021-07-03 23:38:38 | <geekosaur> | it will indeed be a rank-2 type. I just don't recall whatyou need to be able to talk about the constraint, aside from ConstraintKinds |
| 2021-07-03 23:38:46 | <hpc> | what's wrong with something like f (*) = 1 * 2, or whatever? |
| 2021-07-03 23:39:11 | <hpc> | :t let f (*) = 1 * 2 in f |
| 2021-07-03 23:39:12 | <lambdabot> | (Num t1, Num t2) => (t1 -> t2 -> t3) -> t3 |
| 2021-07-03 23:39:22 | × | waleee quits (~waleee@2001:9b0:216:8200:d457:9189:7843:1dbd) (Ping timeout: 256 seconds) |
| 2021-07-03 23:39:26 | <hpc> | > let f (*) = 1 * 2 in (f (/), f (+)) |
| 2021-07-03 23:39:27 | <lambdabot> | (0.5,3) |
| 2021-07-03 23:39:57 | × | Deide quits (~Deide@user/deide) (Quit: Seeee yaaaa) |
| 2021-07-03 23:41:11 | <sciencentistguy> | i'm not sure how that helps |
All times are in UTC.