Logs: freenode/#haskell
| 2020-11-08 14:37:27 | <__monty__> | Lacking reading comprehension. For some reason I thought [exa] was asking for a lax time parser. |
| 2020-11-08 14:37:49 | [exa] | googinling what's a lax parser |
| 2020-11-08 14:38:17 | <[exa]> | like, ideally I'd love to have the time parser from gnu date |
| 2020-11-08 14:38:32 | × | britva quits (~britva@31-10-157-156.cgn.dynamic.upc.ch) (Quit: This computer has gone to sleep) |
| 2020-11-08 14:39:01 | <__monty__> | [exa]: It's a parser that's not strict about the input format it accepts. Think HTML in browsers, at least older browsers. |
| 2020-11-08 14:40:24 | <[exa]> | oh good, thanks |
| 2020-11-08 14:40:48 | → | tochicool joins (~tochicool@31.124.45.74) |
| 2020-11-08 14:40:48 | × | tochicool quits (~tochicool@31.124.45.74) (Client Quit) |
| 2020-11-08 14:41:08 | → | tochicool joins (~tochicool@188.166.170.246) |
| 2020-11-08 14:41:41 | <maerwald> | yes, see fuzzy-dates |
| 2020-11-08 14:42:33 | → | plutoniix joins (~q@node-ull.pool-125-24.dynamic.totinternet.net) |
| 2020-11-08 14:44:10 | <[exa]> | eyebrow very raised |
| 2020-11-08 14:47:26 | × | ericsagn1 quits (~ericsagne@2405:6580:0:5100:3b3a:dfa6:d69e:5cd8) (Ping timeout: 264 seconds) |
| 2020-11-08 14:48:40 | → | tobiasBora joins (~weechat@176-190-197-81.abo.bbox.fr) |
| 2020-11-08 14:49:31 | <tobiasBora> | Hello, I'd like to know, is there a function like MonadFail m => String -> Maybe a -> m a, that basically fails with String if a is Nothing, else returns a? |
| 2020-11-08 14:51:29 | <maerwald> | :t \x -> maybe (fail x) pure |
| 2020-11-08 14:51:30 | <lambdabot> | MonadFail m => String -> Maybe a -> m a |
| 2020-11-08 14:51:42 | <[exa]> | tobiasBora: `fromMaybe . fail` could work |
| 2020-11-08 14:52:08 | <[exa]> | (modulo some operand grouping) |
| 2020-11-08 14:52:51 | <[exa]> | oh ofc I'm missing return, maerwald has it right. :] |
| 2020-11-08 14:53:36 | → | berberman_ joins (~berberman@unaffiliated/berberman) |
| 2020-11-08 14:53:43 | <maerwald> | :t flip maybe pure . fail |
| 2020-11-08 14:53:45 | <lambdabot> | MonadFail f => String -> Maybe a -> f a |
| 2020-11-08 14:54:00 | <tobiasBora> | Cool, thanks a lot! |
| 2020-11-08 14:54:02 | × | berberman quits (~berberman@unaffiliated/berberman) (Ping timeout: 264 seconds) |
| 2020-11-08 14:54:25 | <tobiasBora> | I have so much trouble to parse stuff like flip maybe pure . fail |
| 2020-11-08 14:54:39 | <maerwald> | stick to the lambda thing then |
| 2020-11-08 14:54:53 | <maerwald> | this is just eta reduction, which is good for top level functions |
| 2020-11-08 14:56:42 | × | Techcable quits (znc@irc.techcable.net) (Quit: ZNC - http://znc.in) |
| 2020-11-08 14:56:43 | <tochicool> | does anyone know why this will not type check? let g f = bimap f f in g id ((),False) |
| 2020-11-08 14:57:21 | → | carlomagno joins (~cararell@148.87.23.13) |
| 2020-11-08 14:58:06 | → | Techcable joins (znc@irc.techcable.net) |
| 2020-11-08 14:58:46 | <fendor> | oh, isn't that because of Monomophism Restriction? |
| 2020-11-08 14:58:57 | <tobiasBora> | You parent it like "((flip maybe) pure) . fail" = "\x -> ((flip maybe) pure) (fail x)" = "maybe (fail x) pure" I guess. But when you read stuff like "flip maybe pure . fail", is it like trivial for you, or you still have to think about this kind of expressions to understand them? I still miss intuition to parse Haskell code quickly$ |
| 2020-11-08 14:59:12 | → | ericsagn1 joins (~ericsagne@2405:6580:0:5100:96ae:e603:6cd4:c30b) |
| 2020-11-08 14:59:21 | <merijn> | tobiasBora: The solution is to give it a name and dump it in a where block |
| 2020-11-08 14:59:25 | × | Tario quits (~Tario@201.192.165.173) (Read error: Connection reset by peer) |
| 2020-11-08 15:00:01 | <maerwald> | it isn't intuitive, it's just hand-optimisation so it can better inline. I almost always start with lambdas and explicit arguments |
| 2020-11-08 15:00:01 | × | DrGuschtel quits (~DrGuschte@84.39.116.180) () |
| 2020-11-08 15:00:23 | → | benjamingr__ joins (uid23465@gateway/web/irccloud.com/x-ugqvpbihzsnuhnwq) |
| 2020-11-08 15:00:44 | <merijn> | tochicool: Because that requires a RankN type |
| 2020-11-08 15:01:16 | <merijn> | tochicool: A question: What is the type of 'g'? |
| 2020-11-08 15:03:39 | × | hekkaidekapus_ quits (~tchouri@gateway/tor-sasl/hekkaidekapus) (Remote host closed the connection) |
| 2020-11-08 15:04:00 | → | hekkaidekapus_ joins (~tchouri@gateway/tor-sasl/hekkaidekapus) |
| 2020-11-08 15:04:30 | hackage | minizinc-process 0.1.2.1 - A set of helpers to call minizinc models. https://hackage.haskell.org/package/minizinc-process-0.1.2.1 (LucasDiCioccio) |
| 2020-11-08 15:04:43 | × | hekkaidekapus_ quits (~tchouri@gateway/tor-sasl/hekkaidekapus) (Client Quit) |
| 2020-11-08 15:05:06 | → | kritzefitz joins (~kritzefit@212.86.56.80) |
| 2020-11-08 15:06:46 | <tochicool> | merijn: i think ghc is inferring: Bifunctor p => (a -> d) -> p a a -> p d d - but i'm not sure how to type the more general function |
| 2020-11-08 15:07:06 | → | hekkaidekapus joins (~tchouri@gateway/tor-sasl/hekkaidekapus) |
| 2020-11-08 15:07:06 | × | bitmapper quits (uid464869@gateway/web/irccloud.com/x-iuvslqcwjrfktbse) (Quit: Connection closed for inactivity) |
| 2020-11-08 15:07:20 | → | Achylles__ joins (~Achylles@200-100-230-202.dial-up.telesp.net.br) |
| 2020-11-08 15:07:41 | <merijn> | tochicool: Basically, what your example needs is some way of expressing that your input function works "for all possible input types" (as 'id' does), right? |
| 2020-11-08 15:08:22 | → | nbloomf joins (~nbloomf@2600:1700:ad14:3020:d012:b0d5:8436:4dad) |
| 2020-11-08 15:08:26 | → | alp joins (~alp@2a01:e0a:58b:4920:b98d:1d09:bcd0:af63) |
| 2020-11-08 15:09:07 | <merijn> | One way to type your specific example would be "Bifunctor p => (forall a . a -> a) -> p b c -> p b c" (the forall indicating that the function is 'a -> a', for, well, all possible 'a') |
| 2020-11-08 15:09:47 | <merijn> | tochicool: This use of "forall" is a rank 2 type, which requires an extension for GHC to use |
| 2020-11-08 15:10:38 | <merijn> | Additionally, they're no inferrable (well, technically Rank2 is inferrable, but higher ranks aren't. However the inference for rank 2 types is so horrific that GHC does not implement it) |
| 2020-11-08 15:10:48 | × | Achylles_ quits (~Achylles@191.205.18.155) (Ping timeout: 256 seconds) |
| 2020-11-08 15:10:50 | → | urodna joins (~urodna@unaffiliated/urodna) |
| 2020-11-08 15:10:53 | × | hekkaidekapus quits (~tchouri@gateway/tor-sasl/hekkaidekapus) (Remote host closed the connection) |
| 2020-11-08 15:10:56 | <avdb> | I'm confused, is combining functions commutative? For example, if I have f(g(x)), is it the same as g(f(x))? |
| 2020-11-08 15:11:15 | → | hekkaidekapus joins (~tchouri@gateway/tor-sasl/hekkaidekapus) |
| 2020-11-08 15:11:22 | <merijn> | avdb: Not in general, no |
| 2020-11-08 15:11:53 | × | nbloomf quits (~nbloomf@2600:1700:ad14:3020:d012:b0d5:8436:4dad) (Client Quit) |
| 2020-11-08 15:12:04 | → | luke joins (~luke@bitnomial/staff/luke) |
| 2020-11-08 15:12:19 | <avdb> | https://imgur.com/PCYZBJy.png |
| 2020-11-08 15:12:21 | <__monty__> | avdb: A simple example would be incrementing and doubling. |
| 2020-11-08 15:12:32 | × | gproto23 quits (~gproto23@unaffiliated/gproto23) (Ping timeout: 260 seconds) |
| 2020-11-08 15:12:44 | <avdb> | I just tried, it is indeed not the same, seems like I found misinformation in a video on YouTube! |
| 2020-11-08 15:12:57 | <avdb> | Or maybe it only applies to non-numerical functions or something |
| 2020-11-08 15:13:05 | <__monty__> | Nope. |
| 2020-11-08 15:13:07 | <merijn> | avdb: nope |
| 2020-11-08 15:13:21 | <merijn> | avdb: Consider 'f :: Int -> Bool' and 'g :: Char -> Int' |
| 2020-11-08 15:13:30 | <merijn> | Those can only go one way around :) |
| 2020-11-08 15:13:54 | <avdb> | https://imgur.com/PCYZBJy.png |
| 2020-11-08 15:14:06 | <merijn> | avdb: There are classes of functions that are commutative, but you'd have to specify you're only talking about that specific class of functions |
| 2020-11-08 15:14:25 | <avdb> | Oops wrong screenshot, do you need the video? |
| 2020-11-08 15:14:26 | <tochicool> | merijn: ok thanks, what i have in mind is something like g :: Bifunctor f => (f :: forall a b . a -> b) -> p a a -> p (f a) (f a) |
| 2020-11-08 15:14:39 | <avdb> | https://www.youtube.com/watch?v=ZhuHCtR3xq8 |
| 2020-11-08 15:14:41 | <avdb> | 11:50 |
| 2020-11-08 15:14:57 | <merijn> | tochicool: You can't write a sensible "forall a b . a -> b" |
| 2020-11-08 15:14:59 | <avdb> | Sorry for being a little spammy, I need to make sure that I understand it |
| 2020-11-08 15:15:13 | <merijn> | tochicool: The only possible ones are "undefined" and "unsafeCoerce" |
| 2020-11-08 15:16:19 | <merijn> | tochicool: Note that something like "(Bifunctor f, Applicative g) => (forall . a -> g a) -> p b c -> p (g b) (g c)" can work |
| 2020-11-08 15:16:28 | <merijn> | tochicool: But "insufficient info" :) |
| 2020-11-08 15:16:40 | <__monty__> | avdb: I doubt he's making a mistake. He may be relying on the fact that the type "a -> a" only has a single possible implementation (disregarding errors and undefined etc.). |
| 2020-11-08 15:17:23 | <avdb> | __monty__: Thanks for the correction, I knew something was off! |
| 2020-11-08 15:18:40 | × | mputz quits (~Thunderbi@dslb-084-058-211-084.084.058.pools.vodafone-ip.de) (Ping timeout: 256 seconds) |
| 2020-11-08 15:20:00 | hackage | ihaskell-hvega 0.3.2.0 - IHaskell display instance for hvega types. https://hackage.haskell.org/package/ihaskell-hvega-0.3.2.0 (DouglasBurke) |
| 2020-11-08 15:21:00 | hackage | hvega 0.11.0.0 - Create Vega-Lite visualizations (version 4) in Haskell. https://hackage.haskell.org/package/hvega-0.11.0.0 (DouglasBurke) |
| 2020-11-08 15:21:33 | × | luke quits (~luke@bitnomial/staff/luke) (Quit: sleep) |
| 2020-11-08 15:22:04 | → | nbloomf joins (~nbloomf@76.217.43.73) |
| 2020-11-08 15:24:35 | <hekkaidekapus> | merijn: The Rank-N topic apart, it seems this would suffice for tochicool’s immediate question: `f ∷ a → b; bimap f f`. |
| 2020-11-08 15:24:40 | → | nut joins (~user@roc37-h01-176-170-197-243.dsl.sta.abo.bbox.fr) |
| 2020-11-08 15:26:08 | <merijn> | hekkaidekapus: Not in his ((), False) example |
| 2020-11-08 15:26:42 | → | gproto23 joins (~gproto23@unaffiliated/gproto23) |
| 2020-11-08 15:27:08 | <hekkaidekapus> | merijn: Right, didn’t scroll back enough. |
| 2020-11-08 15:30:18 | × | acidjnk_new2 quits (~acidjnk@p200300d0c718f691fdd3038ca44bce6e.dip0.t-ipconnect.de) (Ping timeout: 244 seconds) |
| 2020-11-08 15:32:18 | <tochicool> | merjin: ok thanks :) so there really is no way to get that to work.. |
| 2020-11-08 15:33:36 | <tochicool> | merijn++ |
All times are in UTC.