Logs: freenode/#haskell
| 2020-11-23 15:08:21 | <hseg> | thanks! |
| 2020-11-23 15:08:25 | <boxscape> | dminuoso your feelings are lying to you :P |
| 2020-11-23 15:08:29 | → | p-core joins (~Thunderbi@2001:718:1e03:5128:2ab7:7f35:48a1:8515) |
| 2020-11-23 15:09:03 | <boxscape> | I was watching a stephanie werich talk about dependent haskell and somehow ended up using unsafeCoerce on a bunch of values with yahb, but I'm not sure how I got there |
| 2020-11-23 15:09:29 | <boxscape> | s/werich/weirich |
| 2020-11-23 15:09:49 | <hseg> | for some reason i have been avoiding let..in expressions in favor of where clauses recently |
| 2020-11-23 15:10:01 | <dminuoso> | boxscape: Can you provide a link to the talk, perhaps indexed at the right time |
| 2020-11-23 15:10:07 | <merijn> | hseg: I've always done that, let..in is hard to format nicely and almost never necessary |
| 2020-11-23 15:10:29 | <tomsmeding> | hseg: you could even replace the otherwise-line of 'peel' with 'uncurry (:) (peel <$> orbit (IS.findMin remaining) IS.empty)', but that's not making it better :p |
| 2020-11-23 15:10:32 | <boxscape> | dminuoso er, I can, but it won't help much because it has nothing to do with unsafeCoerce |
| 2020-11-23 15:10:33 | <boxscape> | https://youtu.be/n-b1PYbRUOY?t=1878 |
| 2020-11-23 15:10:38 | × | p-core quits (~Thunderbi@2001:718:1e03:5128:2ab7:7f35:48a1:8515) (Remote host closed the connection) |
| 2020-11-23 15:10:58 | <Iceland_jack> | qwfpmluy: you can use :instances to list possible instance to derive for -XDerivingVia |
| 2020-11-23 15:11:14 | <Iceland_jack> | newtype LL a = LL [[a]] deriving (Functor, Applicative) via Compose [] [] |
| 2020-11-23 15:11:28 | <Iceland_jack> | :instances Compose [] [], lists (possible) instances to derive |
| 2020-11-23 15:11:50 | → | cosimone joins (~cosimone@2001:b07:ae5:db26:d849:743b:370b:b3cd) |
| 2020-11-23 15:12:01 | <Iceland_jack> | newtype Age = A Int deriving newtype Num |
| 2020-11-23 15:12:01 | <Iceland_jack> | ={equivalent} |
| 2020-11-23 15:12:02 | <Iceland_jack> | newtype Age = A Int deriving Num via Int |
| 2020-11-23 15:12:16 | <Iceland_jack> | -XDerivingVia generalizes -XGeneralizedNewtypeDeriving |
| 2020-11-23 15:13:01 | × | DataComputist quits (~lumeng@static-50-43-26-251.bvtn.or.frontiernet.net) (Quit: Leaving...) |
| 2020-11-23 15:13:12 | <Iceland_jack> | *generalises?? |
| 2020-11-23 15:13:20 | <Iceland_jack> | I must obey UK |
| 2020-11-23 15:13:25 | × | phaul quits (~phaul@ruby/staff/phaul) (Ping timeout: 264 seconds) |
| 2020-11-23 15:13:31 | <boxscape> | then use -XGeneralisedNewtypeDeriving |
| 2020-11-23 15:13:32 | <hseg> | i think this recursion pattern of :: (s -> (a,s)) -> (s -> Bool) -> s -> [a] should generalize, no? |
| 2020-11-23 15:13:41 | <Iceland_jack> | I think GND somewhat recently added -XGeneralisedNewtypeDeriving, UK spelling |
| 2020-11-23 15:13:59 | <boxscape> | yeah |
| 2020-11-23 15:14:17 | <tomsmeding> | :t unfoldr -- hseg |
| 2020-11-23 15:14:18 | <lambdabot> | (b -> Maybe (a, b)) -> b -> [a] |
| 2020-11-23 15:14:26 | <hseg> | merijn: that must be it |
| 2020-11-23 15:14:47 | <hseg> | ok, so peel can be written as an unfoldr |
| 2020-11-23 15:15:24 | → | phaul joins (~phaul@ruby/staff/phaul) |
| 2020-11-23 15:16:28 | <tomsmeding> | interesting, you're right |
| 2020-11-23 15:17:23 | <hseg> | also, IntSet is missing lookupMin :: IntSet -> Maybe Key |
| 2020-11-23 15:17:32 | <ski> | @where strategic-deriving |
| 2020-11-23 15:17:33 | <lambdabot> | I know nothing about strategic-deriving. |
| 2020-11-23 15:18:39 | <ski> | @where+ strategic-deriving "Strategic Deriving" by Veronika Romashkina,Dmitrii Kovanikov in 2020-09-21 at <https://kowainik.github.io/posts/deriving> |
| 2020-11-23 15:18:39 | <lambdabot> | Good to know. |
| 2020-11-23 15:18:54 | <merijn> | hseg: That's just "fmap fst . minView" ? :) |
| 2020-11-23 15:19:13 | → | zaquest joins (~notzaques@5.128.210.178) |
| 2020-11-23 15:19:34 | <hseg> | sure... it did encourage me to reverse the iteration of my algorithm |
| 2020-11-23 15:19:47 | <hseg> | (i.e. replace "seen" by "to-process") |
| 2020-11-23 15:21:18 | <hseg> | also, considering the rest of containers have lookups, it's an annoying hole |
| 2020-11-23 15:21:47 | → | andos joins (~dan@69-165-210-185.cable.teksavvy.com) |
| 2020-11-23 15:23:01 | × | phaul quits (~phaul@ruby/staff/phaul) (Ping timeout: 264 seconds) |
| 2020-11-23 15:23:50 | → | Sgeo joins (~Sgeo@ool-18b982ad.dyn.optonline.net) |
| 2020-11-23 15:25:22 | × | christo quits (~chris@81.96.113.213) (Remote host closed the connection) |
| 2020-11-23 15:25:23 | <hseg> | tomsmeding: also, orbit's output is flipped from what peel wants |
| 2020-11-23 15:25:36 | <hseg> | it returns (seen, orbit) |
| 2020-11-23 15:25:53 | <tomsmeding> | oh that's too bad, I wrote it that way to make the <$> nice and compact :p |
| 2020-11-23 15:26:56 | × | czwartyeon quits (~czwartyeo@77-45-55-99.sta.asta-net.com.pl) (Ping timeout: 240 seconds) |
| 2020-11-23 15:27:01 | <hseg> | no problem -- just add a flip on the unfoldr |
| 2020-11-23 15:28:34 | × | enoq quits (~textual@194-208-146-143.lampert.tv) (Read error: Connection reset by peer) |
| 2020-11-23 15:29:01 | <tomsmeding> | :t flip flip |
| 2020-11-23 15:29:02 | <lambdabot> | b -> (a -> b -> c) -> a -> c |
| 2020-11-23 15:29:22 | <hseg> | cool! |
| 2020-11-23 15:29:30 | <dminuoso> | flip flip looks cute and useful |
| 2020-11-23 15:29:45 | × | mputz quits (~Thunderbi@dslb-084-058-211-084.084.058.pools.vodafone-ip.de) (Ping timeout: 240 seconds) |
| 2020-11-23 15:29:47 | <dminuoso> | Just dont know what for. |
| 2020-11-23 15:29:55 | → | phaul joins (~phaul@ruby/staff/phaul) |
| 2020-11-23 15:30:02 | <hseg> | it reverses operators |
| 2020-11-23 15:30:16 | × | toorevitimirp quits (~tooreviti@117.182.183.18) (Remote host closed the connection) |
| 2020-11-23 15:30:16 | <xerox_> | :t flip flip flip |
| 2020-11-23 15:30:17 | → | christo joins (~chris@81.96.113.213) |
| 2020-11-23 15:30:18 | <lambdabot> | (a1 -> ((a2 -> b -> c1) -> b -> a2 -> c1) -> c2) -> a1 -> c2 |
| 2020-11-23 15:30:20 | → | enoq joins (~textual@194-208-146-143.lampert.tv) |
| 2020-11-23 15:30:25 | <hseg> | > flip flip (++) ", world" "hello" |
| 2020-11-23 15:30:27 | <lambdabot> | error: |
| 2020-11-23 15:30:27 | <lambdabot> | • Couldn't match expected type ‘[Char] |
| 2020-11-23 15:30:27 | <lambdabot> | -> ([a0] -> [a0] -> [a0]) -> c’ |
| 2020-11-23 15:30:28 | <maerwald> | :t flip . flip . flip |
| 2020-11-23 15:30:30 | <lambdabot> | (a -> b -> c) -> b -> a -> c |
| 2020-11-23 15:30:37 | <xerox_> | that's what I was after |
| 2020-11-23 15:30:47 | <tomsmeding> | you know what's more fun? iterating 'flip' converges https://paste.tomsmeding.com/SefRZrAn |
| 2020-11-23 15:30:49 | <hseg> | > flip flip ", world" (++) "hello" |
| 2020-11-23 15:30:52 | <lambdabot> | "hello, world" |
| 2020-11-23 15:31:09 | <dminuoso> | Also, random occurences of `flip const id` in your code are good to ensure the reader is paying full attention. |
| 2020-11-23 15:31:28 | × | vollenweider_ quits (~vollenwei@4e69b241.skybroadband.com) (Ping timeout: 260 seconds) |
| 2020-11-23 15:31:46 | <tomsmeding> | nah, should replace that 'id' with an arbitrarily complex expression |
| 2020-11-23 15:31:46 | <hseg> | :t flip const id |
| 2020-11-23 15:31:48 | <lambdabot> | c -> c |
| 2020-11-23 15:31:56 | <hseg> | neat |
| 2020-11-23 15:32:00 | <hseg> | :t id id id id id |
| 2020-11-23 15:32:01 | ski | seconds the `where' over `let'-`in' |
| 2020-11-23 15:32:01 | <lambdabot> | a -> a |
| 2020-11-23 15:32:16 | × | cosimone quits (~cosimone@2001:b07:ae5:db26:d849:743b:370b:b3cd) (Quit: cosimone) |
| 2020-11-23 15:32:20 | × | tabemann quits (~tabemann@172-13-49-137.lightspeed.milwwi.sbcglobal.net) (Remote host closed the connection) |
| 2020-11-23 15:32:29 | <dminuoso> | ski: Ive started to become quite fond of `let` in pattern guards. |
| 2020-11-23 15:32:44 | <dminuoso> | for small bits, this can create less noise than where |
| 2020-11-23 15:32:46 | <ski> | that's not `let'-`in', though |
| 2020-11-23 15:32:58 | <dminuoso> | sure, just introducing this as a third alternative option |
| 2020-11-23 15:33:03 | <ski> | @type map `flip` "foo" |
| 2020-11-23 15:33:05 | <lambdabot> | (Char -> b) -> [b] |
| 2020-11-23 15:33:14 | <merijn> | dminuoso: What do you need let for in pattern guards? |
| 2020-11-23 15:33:14 | ski | nods |
| 2020-11-23 15:33:28 | <dminuoso> | merijn: foo x | let y = ... = ... |
| 2020-11-23 15:33:36 | <dminuoso> | Same reason you'd use where |
| 2020-11-23 15:33:43 | <merijn> | dminuoso: You can just do "| y <- .." |
| 2020-11-23 15:33:50 | <boxscape> | "merijn: Like those people who write C, but main is a char* whose values happen to be sensible code" I can't help but look into this now :/ |
All times are in UTC.