Logs: liberachat/#haskell
| 2021-05-26 01:28:52 | <hololeap> | ok, that's frickin rad |
| 2021-05-26 01:29:06 | <hololeap> | (at least it typechecks so far) |
| 2021-05-26 01:29:52 | <boxscape> | you should be able to do the same with completeDef I think? As in, put `complete = \case ...` below `complete :: r -> Maybe a` and then remove all the `complete = completeDef` lines? |
| 2021-05-26 01:30:23 | <boxscape> | ...if that's what you'd want, anyway |
| 2021-05-26 01:31:17 | <hololeap> | that would be what I want, but it doesn't like it |
| 2021-05-26 01:31:23 | <boxscape> | ah, hm |
| 2021-05-26 01:32:06 | <dmwit> | You have to give the completeDef type signature, and use DefaultSignatures |
| 2021-05-26 01:32:57 | → | horex539 joins (~horex539@2a02:a03f:6aa5:a00:bc6a:75bb:6cbe:61b0) |
| 2021-05-26 01:32:57 | <dmwit> | `class Completable r a | ... where complete :: r -> Maybe a; complete :: ValidityWrapper a ~ NoWrapper => IsComplete a -> Maybe a; complete = \case ...` |
| 2021-05-26 01:33:02 | × | horex539 quits (~horex539@2a02:a03f:6aa5:a00:bc6a:75bb:6cbe:61b0) (Remote host closed the connection) |
| 2021-05-26 01:34:25 | <dmwit> | Err, hm. You might need `complete :: (ValidityWrapper a ~ NoWrapper, r ~ IsComplete a) => r -> Maybe a` instead. |
| 2021-05-26 01:34:35 | <dmwit> | There are some rules I don't fully understand about the shape the default signature has to have. |
| 2021-05-26 01:34:42 | × | hughjfchen quits (~hughjfche@2409:8954:32d4:6358:1194:1ae8:3b3e:7012) (Quit: Quit) |
| 2021-05-26 01:35:28 | <hololeap> | dmwit: it's complaining about multiple declarations of `complete` when I do that |
| 2021-05-26 01:35:37 | <dmwit> | As an aside: many people seem to prefer `f <$> x <*> y` to `liftA2 f x y`. Why is that? |
| 2021-05-26 01:35:58 | <hololeap> | oh, it needs to be prefixed with `default` ... |
| 2021-05-26 01:36:18 | × | favonia quits (~favonia@user/favonia) (Ping timeout: 264 seconds) |
| 2021-05-26 01:36:32 | <dmwit> | Oh yeah. |
| 2021-05-26 01:36:38 | <dmwit> | Good thing there's documentation, huh? |
| 2021-05-26 01:36:53 | → | favonia joins (~favonia@user/favonia) |
| 2021-05-26 01:37:16 | <hololeap> | default complete :: (ValidityWrapper a ~ NoWrapper, r ~ IsComplete a) => r -> Maybe a |
| 2021-05-26 01:37:21 | <hololeap> | wow, that's really awesome |
| 2021-05-26 01:37:22 | <boxscape> | dmwit liftA2 just looks ugly with that capital letter and number, doesn't really fit the camelCase aesthetic |
| 2021-05-26 01:37:37 | <boxscape> | petty reason, but a reason anyway |
| 2021-05-26 01:37:42 | <boxscape> | (for me) |
| 2021-05-26 01:37:54 | <MorrowM> | <$> and <*> generalizes to as many args as you need |
| 2021-05-26 01:38:34 | <dmwit> | Sure. For the general case, you use the general tool. Do you also write `<$>` instead of `map` or `.` in every place you can? |
| 2021-05-26 01:38:52 | <dmwit> | But ok, aesthetics are sort of tough to argue with, even if I don't share them. |
| 2021-05-26 01:39:43 | <dmwit> | Also, one day I'd like to convince people that `pure f <*> x <*> y` is superior to `f <$> x <*> y`. |
| 2021-05-26 01:39:49 | <hololeap> | how many default definitions can you have? could I have more with different constraints? |
| 2021-05-26 01:40:10 | <dmwit> | I don't think so. How would it know which to pick if multiple of them had satisfiable constraints? |
| 2021-05-26 01:40:22 | × | waleee quits (~waleee@2001:9b0:216:8200:d457:9189:7843:1dbd) (Ping timeout: 264 seconds) |
| 2021-05-26 01:40:22 | <dmwit> | But perhaps you'd like the DerivingVia extension. |
| 2021-05-26 01:40:38 | <hololeap> | I know of it, but I'm not sure how that would help here |
| 2021-05-26 01:40:43 | <geekosaur> | afaik it only allows one and it should match the single default implementation provided |
| 2021-05-26 01:41:20 | <boxscape> | this article mentions how to use DerivingVia instead of defaultSignatures https://www.parsonsmatt.org/2020/11/10/simplifying_deriving.html |
| 2021-05-26 01:42:00 | <MorrowM> | dmwit: A lot of people use fmap always instead of map, so I presume it's the same sort of deal here. |
| 2021-05-26 01:42:38 | <boxscape> | I once wrote a function called `lift` that could lift any number of arguments |
| 2021-05-26 01:42:41 | <boxscape> | it was terrible |
| 2021-05-26 01:42:47 | <boxscape> | (type-inference-wise) |
| 2021-05-26 01:43:04 | <dmwit> | Yes, terrible, agree. |
| 2021-05-26 01:43:10 | <MorrowM> | Oh I did the same lol |
| 2021-05-26 01:43:25 | <MorrowM> | Although I called it liftAN |
| 2021-05-26 01:45:06 | <dmwit> | BTW we need a, like, liftJ2 :: Monad m => (a -> b -> m c) -> m a -> m b -> m c, and liftJ3 and liftJ4 and some extensible infix functions. |
| 2021-05-26 01:45:18 | <dmwit> | I feel like I need that like one project in three. |
| 2021-05-26 01:45:23 | <boxscape> | incidentally I also prefer traverse over mapM and sequence over sequenceA for the same reason I don't like liftA2 |
| 2021-05-26 01:45:53 | × | mnrmnaugh quits (~mnrmnaugh@pool-96-252-87-182.bstnma.fios.verizon.net) (Quit: Leaving) |
| 2021-05-26 01:46:16 | <MorrowM> | I'd imagine you're not fond of liftM2 then |
| 2021-05-26 01:46:41 | <boxscape> | no that's worse than liftA2 because it has the uncessessary Monad constraint |
| 2021-05-26 01:46:47 | <boxscape> | that is not how you spell that word |
| 2021-05-26 01:46:50 | <MorrowM> | Indeed |
| 2021-05-26 01:47:42 | <MorrowM> | Nice thing about liftA2 though is you can compose it |
| 2021-05-26 01:47:46 | → | pe200012 joins (~pe200012@119.131.208.84) |
| 2021-05-26 01:47:54 | <boxscape> | I'm really torn on sequenceA and sequence because on one hand sequence is prettier and on the other hand it has the unnecessary constraint |
| 2021-05-26 01:48:16 | <MorrowM> | @type liftA2 . liftA2 |
| 2021-05-26 01:48:17 | <lambdabot> | (Applicative f1, Applicative f2) => (a -> b -> c) -> f1 (f2 a) -> f1 (f2 b) -> f1 (f2 c) |
| 2021-05-26 01:48:26 | <Axman6> | dmwit++ |
| 2021-05-26 01:48:29 | × | pe200012_ quits (~pe200012@120.236.162.14) (Ping timeout: 272 seconds) |
| 2021-05-26 01:51:30 | <trueboxguy> | MorrowM: if you are who I think you are: remember me composing liftA3? |
| 2021-05-26 01:51:59 | <MorrowM> | What, who are you? :P |
| 2021-05-26 01:57:46 | × | dfg quits (~dfg@li490-89.members.linode.com) (Changing host) |
| 2021-05-26 01:57:46 | → | dfg joins (~dfg@user/dfg) |
| 2021-05-26 01:58:55 | <trueboxguy> | Ah, was just a poor guess then MorrowM. Was talking to someone else called Morrow who composed liftA3 and got the type (on another platform) |
| 2021-05-26 01:59:32 | <trueboxguy> | Also called MorrowM :p |
| 2021-05-26 02:00:53 | <MorrowM> | trueboxguy, notice the :P boxy |
| 2021-05-26 02:01:13 | <trueboxguy> | MorrowM: notice my :p |
| 2021-05-26 02:01:28 | × | boxscape quits (~boxscape@user/boxscape) (Quit: Connection closed) |
| 2021-05-26 02:01:37 | → | ddellacosta joins (~ddellacos@86.106.121.78) |
| 2021-05-26 02:01:42 | <trueboxguy> | I just had to make sure in my first message. Imagine how awkward it would have been... |
| 2021-05-26 02:02:46 | <trueboxguy> | Anyways good night |
| 2021-05-26 02:03:15 | <hololeap> | I'm looking into DuplicateRecordFields, and it seems like it doesn't know how to disambiguate the name when it is used as a function, e.g. passed into something that takes (MyData -> MyField) |
| 2021-05-26 02:03:27 | <hololeap> | is there another extension that can help with this? |
| 2021-05-26 02:03:48 | × | MidAutumnMoon quits (~MidAutumn@user/midautumnmoon) (Quit: Quit 啾) |
| 2021-05-26 02:04:24 | → | MidAutumnMoon joins (~MidAutumn@user/midautumnmoon) |
| 2021-05-26 02:05:35 | <hololeap> | I suppose TypeApplications... |
| 2021-05-26 02:06:10 | <hololeap> | although at that point I might as well prepend the name of the data type to the record name |
| 2021-05-26 02:06:18 | × | ddellacosta quits (~ddellacos@86.106.121.78) (Ping timeout: 264 seconds) |
| 2021-05-26 02:10:25 | → | mnrmnaugh joins (~mnrmnaugh@pool-96-252-87-182.bstnma.fios.verizon.net) |
| 2021-05-26 02:11:43 | <hololeap> | the docs are confusing because it almost sounds like it is allowed if it can reify which data type it needs. but here, if I replace the selector function with a hole _, it gives me the exact data type that it is expecting for the argument... so what gives? |
| 2021-05-26 02:15:15 | nova | is now known as core2 |
| 2021-05-26 02:15:24 | core2 | is now known as nova |
| 2021-05-26 02:17:00 | → | FinnElija joins (~finn_elij@user/finn-elija/x-0085643) |
| 2021-05-26 02:17:00 | finn_elija | is now known as Guest6473 |
| 2021-05-26 02:17:00 | × | Guest6473 quits (~finn_elij@user/finn-elija/x-0085643) (Killed (tungsten.libera.chat (Nickname regained by services))) |
| 2021-05-26 02:17:00 | FinnElija | is now known as finn_elija |
| 2021-05-26 02:19:04 | × | mnrmnaugh quits (~mnrmnaugh@pool-96-252-87-182.bstnma.fios.verizon.net) (Quit: Leaving) |
| 2021-05-26 02:20:10 | <hololeap> | here it is with the selector function: http://sprunge.us/rXNkIi ... and here it is with the hole: http://sprunge.us/jmfLco |
| 2021-05-26 02:20:26 | → | hamishmack joins (sid389057@id-389057.stonehaven.irccloud.com) |
| 2021-05-26 02:27:37 | → | horex539 joins (~horex539@2a02:a03f:6aa5:a00:7cf0:f700:f86d:91fc) |
| 2021-05-26 02:32:11 | × | horex539 quits (~horex539@2a02:a03f:6aa5:a00:7cf0:f700:f86d:91fc) (Ping timeout: 252 seconds) |
| 2021-05-26 02:37:02 | × | td_ quits (~td@muedsl-82-207-238-005.citykom.de) (Ping timeout: 265 seconds) |
| 2021-05-26 02:37:18 | → | hughjfchen joins (~hughjfche@117.136.40.253) |
| 2021-05-26 02:37:22 | × | favonia quits (~favonia@user/favonia) (Ping timeout: 264 seconds) |
| 2021-05-26 02:38:46 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-05-26 02:38:46 | → | td_ joins (~td@94.134.91.198) |
| 2021-05-26 02:39:28 | → | favonia joins (~favonia@user/favonia) |
| 2021-05-26 02:40:35 | <hololeap> | interesting. this works: complete = completeNewtype MyItemId (id :: MyItemIdF -> IsComplete Text) |
| 2021-05-26 02:40:56 | <hololeap> | but this doesn't: complete = completeNewtype MyItemId (id @MyItemIdF) |
| 2021-05-26 02:41:04 | × | hughjfchen quits (~hughjfche@117.136.40.253) (Client Quit) |
| 2021-05-26 02:42:14 | <hololeap> | (same error as the first paste) |
All times are in UTC.