Newest at the top
2024-11-19 14:37:15 +0100 | <dminuoso> | bwe: For extra points parameterize by `proxy Foo` rather than `Proxy `Foo` |
2024-11-19 14:37:07 +0100 | <hellwolf> | is Const a r Coercible with a? |
2024-11-19 14:36:45 +0100 | <dminuoso> | bwe: Yeah, just use Proxy. |
2024-11-19 14:36:24 +0100 | <dminuoso> | Leary: That `find (const True)` is cunning. :-) |
2024-11-19 14:36:20 +0100 | <bwe> | dminuoso: that's exactly where I am stuck right now: applying a function wrapped in a Const to values wrapped in Const |
2024-11-19 14:36:09 +0100 | <hellwolf> | Leary: I could balance between readability (which is subjective, up to the code reader's knowledge about all these instances) and performance; so what about any performance consideration? |
2024-11-19 14:35:48 +0100 | rvalue | (~rvalue@user/rvalue) (Ping timeout: 265 seconds) |
2024-11-19 14:35:23 +0100 | <dminuoso> | And it will probably require using ScopedTypeVariables and some annoyances. |
2024-11-19 14:35:11 +0100 | <dminuoso> | Const will constantly (the pun!) be in the way because you need to wrap/unwrap potentially many times |
2024-11-19 14:34:51 +0100 | <dminuoso> | bwe: Id say Proxy is the least akward and most common way. |
2024-11-19 14:34:21 +0100 | <Leary> | Personally, I would go with `asum`. Either way, get them from `Data.Foldable`; a `Data.List` import suggests list specialisation (which could actually happen at some point). |
2024-11-19 14:31:48 +0100 | <hellwolf> | import Data.List (find) is required though |
2024-11-19 14:31:38 +0100 | <hellwolf> | hard to choose :) |
2024-11-19 14:31:00 +0100 | <hellwolf> | either (const Nothing) (Just . ADDR) (S.decode b) |
2024-11-19 14:30:59 +0100 | <hellwolf> | or |
2024-11-19 14:30:53 +0100 | <hellwolf> | fmap ADDR . find (const True) $ S.decode b |
2024-11-19 14:28:28 +0100 | <hellwolf> | Left elements are mempty, right elements are actually "foldable" |
2024-11-19 14:28:05 +0100 | <hellwolf> | it all hinges all the fact of the Foldable Either instance. |
2024-11-19 14:27:46 +0100 | <hellwolf> | that's very cute, indeed |
2024-11-19 14:19:34 +0100 | housemate | (~housemate@2a04:9dc0:0:162::5d91:d7ed) housemate |
2024-11-19 14:10:18 +0100 | housemate | (~housemate@2a04:9dc0:0:162::5d91:d7ed) (Ping timeout: 244 seconds) |
2024-11-19 14:07:17 +0100 | <Leary> | hellwolf: ^ |
2024-11-19 14:07:14 +0100 | <yahb2> | find \_ -> True :: Foldable t => t a -> Maybe a |
2024-11-19 14:07:14 +0100 | <Leary> | % :t find \_ -> True |
2024-11-19 14:07:08 +0100 | <Leary> | Oh, bit late, but I thought of something cute and silly! |
2024-11-19 14:05:37 +0100 | sand-witch | (~m-mzmz6l@vmi833741.contaboserver.net) |
2024-11-19 14:01:28 +0100 | ash3en | (~Thunderbi@2a03:7846:b6eb:101:93ac:a90a:da67:f207) (Remote host closed the connection) |
2024-11-19 14:01:21 +0100 | ash3en | (~Thunderbi@2a03:7846:b6eb:101:93ac:a90a:da67:f207) ash3en |
2024-11-19 14:01:13 +0100 | acidjnk_new | (~acidjnk@p200300d6e7283f33f1310e0154b357f3.dip0.t-ipconnect.de) acidjnk |
2024-11-19 14:01:03 +0100 | ash3en | (~Thunderbi@2a03:7846:b6eb:101:93ac:a90a:da67:f207) (Quit: ash3en) |
2024-11-19 14:00:27 +0100 | Digit | (~user@user/digit) Digit |
2024-11-19 13:56:49 +0100 | acidjnk_new | (~acidjnk@p200300d6e7283f33f1310e0154b357f3.dip0.t-ipconnect.de) (Ping timeout: 248 seconds) |
2024-11-19 13:56:10 +0100 | tromp | (~textual@92-110-219-57.cable.dynamic.v4.ziggo.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
2024-11-19 13:56:06 +0100 | lxsameer | (~lxsameer@Serene/lxsameer) (Ping timeout: 252 seconds) |
2024-11-19 13:52:13 +0100 | <hellwolf> | right. I also misread the original question, in the first place. |
2024-11-19 13:50:56 +0100 | carbolymer | (~carbolyme@dropacid.net) carbolymer |
2024-11-19 13:50:09 +0100 | <mauke> | that's just Proxy |
2024-11-19 13:49:49 +0100 | <hellwolf> | Const () a probably could work too |
2024-11-19 13:49:37 +0100 | <hellwolf> | interesting :) |
2024-11-19 13:47:11 +0100 | <bwe> | mauke: Excellent. Does my job. |
2024-11-19 13:44:39 +0100 | alexherbo2 | (~alexherbo@2a02-8440-3201-1725-d030-8edc-2b2b-9bf9.rev.sfr.net) alexherbo2 |
2024-11-19 13:41:48 +0100 | notzmv | (~daniel@user/notzmv) notzmv |
2024-11-19 13:40:23 +0100 | sawilagar | (~sawilagar@user/sawilagar) sawilagar |
2024-11-19 13:40:05 +0100 | sawilagar | (~sawilagar@user/sawilagar) (Remote host closed the connection) |
2024-11-19 13:36:30 +0100 | <mauke> | f :: Const Int a |
2024-11-19 13:34:55 +0100 | <Leary> | bwe: Proxies and TypeApplications are the usual options. If you're fine with being limited to GHC 9.10 or newer you can use RequiredTypeArguments instead. |
2024-11-19 13:34:47 +0100 | <haskellbridge> | or AmbiguousTypes |
2024-11-19 13:34:47 +0100 | <haskellbridge> | <hellwolf> Proxy |
2024-11-19 13:31:26 +0100 | <bwe> | I'd like to define some instances for a type class without the member of the class as argument, like `f :: Int` instead of `f :: a -> Int`. Reason: Before `a` gets constructed, I need some functions that are specific to the variant of `a`. Which approaches do you recommend? |
2024-11-19 13:31:18 +0100 | JuanDaugherty | (~juan@user/JuanDaugherty) JuanDaugherty |