Logs: freenode/#haskell
| 2020-11-26 14:13:00 | hackage | lsp 1.0.0.1 - Haskell library for the Microsoft Language Server Protocol https://hackage.haskell.org/package/lsp-1.0.0.1 (luke_) |
| 2020-11-26 14:13:53 | → | acarrico joins (~acarrico@dhcp-68-142-39-249.greenmountainaccess.net) |
| 2020-11-26 14:14:40 | → | sondr3 joins (~sondr3@cm-84.211.56.132.getinternet.no) |
| 2020-11-26 14:19:02 | × | hekkaidekapus_ quits (~tchouri@gateway/tor-sasl/hekkaidekapus) (Quit: hekkaidekapus_) |
| 2020-11-26 14:21:06 | → | hekkaidekapus joins (~tchouri@gateway/tor-sasl/hekkaidekapus) |
| 2020-11-26 14:21:44 | <dminuoso> | maerwald: Anyway, interesting. If I dont case-of, I usually have some `note` function instead. |
| 2020-11-26 14:22:25 | <dminuoso> | Or I move it into pattern matching on separate functions, where I might have `fooEither (Left ...) = ...; fooEither (Right ...) = ...'` and use that as a continuation |
| 2020-11-26 14:22:38 | <dminuoso> | But either/maybe seems just strange to me for some reason I cant explain |
| 2020-11-26 14:22:58 | <boxscape> | do you use foldr? |
| 2020-11-26 14:23:57 | <dminuoso> | sure |
| 2020-11-26 14:24:02 | <boxscape> | hm |
| 2020-11-26 14:24:44 | <boxscape> | So an aversion to Church encodings of non-recursive types but not to those of recursive types, to overly extrapolate |
| 2020-11-26 14:24:56 | <dminuoso> | Yes, very much. |
| 2020-11-26 14:26:51 | × | jonatanb_ quits (~jonatanb@83.24.220.252.ipv4.supernova.orange.pl) (Remote host closed the connection) |
| 2020-11-26 14:27:14 | <dminuoso> | The non-recursive types encode a choice, list does not |
| 2020-11-26 14:27:34 | <dminuoso> | Or I guess that depends on the perspective |
| 2020-11-26 14:28:10 | <dminuoso> | since a list could be `n + (n^2) + (n^3) + (n^4) + ....` |
| 2020-11-26 14:28:36 | <dminuoso> | Maybe it's just that to me it's not clear which side of `maybe` does what |
| 2020-11-26 14:28:51 | <dminuoso> | Perhaps I also just lack the intuition because I dont use it |
| 2020-11-26 14:28:58 | <c_wraith> | doesn't the type tell you? |
| 2020-11-26 14:29:08 | <maerwald> | dminuoso: if I convert a maybe to some other type (e.g. Either), I find maybe to be quite idiomatic... but I can't stand fromMaybe |
| 2020-11-26 14:29:11 | <c_wraith> | :t maybe |
| 2020-11-26 14:29:12 | <lambdabot> | b -> (a -> b) -> Maybe a -> b |
| 2020-11-26 14:29:31 | <c_wraith> | there's only one case either of those arguments can apply in. |
| 2020-11-26 14:29:49 | <dminuoso> | c_wraith: Sure, but when you look at `maybe foo bar h`, then it's just not obvious to me |
| 2020-11-26 14:29:57 | <c_wraith> | Now, I understand that complaint about bool.... |
| 2020-11-26 14:30:05 | <dminuoso> | Mmm |
| 2020-11-26 14:30:25 | <maerwald> | I always mix up second and third parameter of foldr/foldl :p |
| 2020-11-26 14:30:30 | <hpc> | dminuoso: there's a way to remember it as a specific instance of a more general thing |
| 2020-11-26 14:30:38 | <hpc> | data Maybe a = Nothing | Just a |
| 2020-11-26 14:30:46 | <hpc> | the parameters for maybe go in the same order as the data definition |
| 2020-11-26 14:30:53 | <dminuoso> | hpc: Sure, the first constructor comes first. But that requires memorizing the data definition |
| 2020-11-26 14:30:54 | <hpc> | same for foldr, they go in the same order |
| 2020-11-26 14:31:11 | <hpc> | dminuoso: the smallest constructor is first |
| 2020-11-26 14:31:30 | <hpc> | (for deriving Ord and such) |
| 2020-11-26 14:31:32 | <dminuoso> | hpc: so what about These? |
| 2020-11-26 14:31:39 | → | fendor joins (~fendor@77.119.130.234.wireless.dyn.drei.com) |
| 2020-11-26 14:31:40 | <dminuoso> | What type signature would `these` have? |
| 2020-11-26 14:32:10 | × | darjeeling_ quits (~darjeelin@122.245.217.23) (Ping timeout: 256 seconds) |
| 2020-11-26 14:32:17 | <dminuoso> | these :: (a -> d) -> (b -> d) -> (a -> b -> d) -> These a b -> d |
| 2020-11-26 14:32:18 | <c_wraith> | intuition says: (a -> c) -> (b -> c) -> (a -> b -> c) -> These a b -> c |
| 2020-11-26 14:32:21 | <dminuoso> | these :: (b -> d) -> (a -> d) -> (a -> b -> d) -> These a b -> d |
| 2020-11-26 14:32:41 | <dminuoso> | According to your definition, Id have to look up the definition of These, and I couldnt infer it from the size |
| 2020-11-26 14:32:42 | <maerwald> | easy: this, that, these |
| 2020-11-26 14:32:44 | <maerwald> | xD |
| 2020-11-26 14:33:24 | <hpc> | it derives Ord so you can check in ghci |
| 2020-11-26 14:33:44 | <dminuoso> | Well if I have to look it up, I might as well just check hoogle |
| 2020-11-26 14:33:46 | <boxscape> | % :i These |
| 2020-11-26 14:33:47 | <yahb> | boxscape: ; <interactive>:1:1: error: Not in scope: `These' |
| 2020-11-26 14:33:52 | <boxscape> | :/ |
| 2020-11-26 14:34:00 | <dminuoso> | % import Data.Strict.These |
| 2020-11-26 14:34:00 | <yahb> | dminuoso: ; <no location info>: error:; Could not find module `Data.Strict.These'; It is not a module in the current program, or in any known package. |
| 2020-11-26 14:34:08 | <dminuoso> | % import Data.Functor.These |
| 2020-11-26 14:34:08 | <yahb> | dminuoso: ; <no location info>: error:; Could not find module `Data.Functor.These'; Perhaps you meant; Data.Functor.Base (from recursion-schemes-5.1.3); Data.Functor.Const (from base-4.14.0.0); Data.Functor.Plus (from semigroupoids-5.3.4) |
| 2020-11-26 14:34:42 | <dminuoso> | hpc: I get your point, Im not saying its not discoverable, Im just suggesting that from just staring at its usage, it might not be obvious |
| 2020-11-26 14:34:48 | <hpc> | sometimes |
| 2020-11-26 14:34:54 | <dminuoso> | But arguably the same could be said about `foldr` |
| 2020-11-26 14:35:01 | <c_wraith> | and every function |
| 2020-11-26 14:35:01 | <hpc> | but then for example, how would you write a fold over a tree? |
| 2020-11-26 14:35:08 | <dminuoso> | hpc: easy! foldMap! |
| 2020-11-26 14:35:12 | <dminuoso> | ;) |
| 2020-11-26 14:35:15 | <hpc> | heh |
| 2020-11-26 14:36:39 | <hpc> | but yeah, if you know the structure it's pretty easy, foldTree leaf branch Leaf = leaf; foldTree leaf branch (Branch value left right) = branch value (foldTree left) (foldTree right) |
| 2020-11-26 14:36:57 | <hpc> | or something similar depending on what type of tree you're dealing with |
| 2020-11-26 14:38:50 | → | jonatanb joins (~jonatanb@83.24.220.252.ipv4.supernova.orange.pl) |
| 2020-11-26 14:38:51 | <hpc> | i wonder if there's anything that writes these functions automatically |
| 2020-11-26 14:38:54 | → | bitmapper joins (uid464869@gateway/web/irccloud.com/x-ntgjmwmudxzzxssg) |
| 2020-11-26 14:40:11 | <c_wraith> | recursion-schemes? |
| 2020-11-26 14:40:26 | <merijn> | c_wraith: That's not automatic |
| 2020-11-26 14:40:32 | <c_wraith> | it has TH |
| 2020-11-26 14:40:34 | <merijn> | That's just "reusing handwritten ones" |
| 2020-11-26 14:41:06 | <c_wraith> | every library is reusing something someone wrote by hand... |
| 2020-11-26 14:42:19 | <merijn> | c_wraith: Right, but I meant as opposed to DeriveFunctor. I guess TH counts, but I didn't know recursion-schemes had that, because my brain doesn't like recursion schemes :p |
| 2020-11-26 14:42:43 | × | jonatanb quits (~jonatanb@83.24.220.252.ipv4.supernova.orange.pl) (Remote host closed the connection) |
| 2020-11-26 14:42:55 | <c_wraith> | And I don't like using TH. :P |
| 2020-11-26 14:43:01 | dminuoso | likes TH |
| 2020-11-26 14:43:16 | <c_wraith> | I like *writing* it. But I don't like writing code that uses it. |
| 2020-11-26 14:43:24 | <merijn> | I like TH, but they fucked up the specification |
| 2020-11-26 14:43:31 | <dminuoso> | There is a specification? |
| 2020-11-26 14:43:34 | <dminuoso> | :> |
| 2020-11-26 14:43:40 | <merijn> | dminuoso: My point |
| 2020-11-26 14:44:03 | <dminuoso> | My main annoyance with TH is just one: staging restriction |
| 2020-11-26 14:44:06 | <merijn> | TH should've had a clear "target" and "host" distinction for everything |
| 2020-11-26 14:44:09 | <hpc> | hmm, that technically writes it but by way of free shennanigans |
| 2020-11-26 14:44:21 | <dminuoso> | Having to fiddle with extra modules just to satisfy the staging restriction is sometimes frustrating |
| 2020-11-26 14:44:36 | <dminuoso> | Especially because we cant have circular module references |
| 2020-11-26 14:44:38 | <merijn> | dminuoso: Staging is annoying, but you can workaround it |
| 2020-11-26 14:44:57 | <hpc> | like if i was using [] and had to pick between foldr and whatever recursion-schemes gives me, recursion-schemes would be harder to use |
| 2020-11-26 14:45:07 | <merijn> | dminuoso: In contrast to the lack of distinction between target/host which makes cross-compiled TH fundamentally impossible |
| 2020-11-26 14:45:18 | <dminuoso> | merijn: cross compiling is not something I care about |
| 2020-11-26 14:45:27 | <merijn> | (well, the Asterius guys seem to be attempting to fix/work around it via heroic amounts of work) |
| 2020-11-26 14:45:29 | <hpc> | i just want to write data Foo ..., makeFold 'Foo, and get foo :: whatever -> Foo ... -> ... |
| 2020-11-26 14:45:34 | <merijn> | dminuoso: Not *yet* |
| 2020-11-26 14:45:44 | <dminuoso> | Perhaps |
| 2020-11-26 14:45:53 | <merijn> | dminuoso: Compiling windows executables from linux/etc. would've been nice :p |
| 2020-11-26 14:45:58 | <dminuoso> | Is that some reference to the dominion of ARM processors? |
| 2020-11-26 14:46:00 | <dminuoso> | Oh |
| 2020-11-26 14:46:05 | <merijn> | dminuoso: ARM too |
| 2020-11-26 14:46:32 | <merijn> | dminuoso: Everything is just slightly more inconvenient without cross-compilation |
| 2020-11-26 14:47:04 | <merijn> | And proper cross-compilation support isn't even that hard. It's just a herculean task to retrofit cross-compilation support if you didn't engineer it in from the beginning |
All times are in UTC.