Logs: liberachat/#haskell
| 2021-05-28 16:28:15 | <seabass> | davean: now we can chat here :D |
| 2021-05-28 16:28:26 | <tomsmeding> | _73: https://paste.tomsmeding.com/OHvMJ9ci |
| 2021-05-28 16:28:28 | tomsmeding | is off to dinner |
| 2021-05-28 16:28:32 | <davean> | lol |
| 2021-05-28 16:28:41 | <hololeap> | type family SomeWrapper a :: Type -> Type |
| 2021-05-28 16:28:46 | <hololeap> | data Thing a = This (SomeWrapper a a) | That |
| 2021-05-28 16:28:47 | <davean> | seabass: BTW I did figure it out, my alt-key was stuck down |
| 2021-05-28 16:28:53 | <a6a45081-2b83> | how to send a start message? |
| 2021-05-28 16:28:55 | <seabass> | davean, ah, right :D |
| 2021-05-28 16:29:04 | × | benin quits (~benin@183.82.177.19) (Ping timeout: 264 seconds) |
| 2021-05-28 16:29:04 | <wroathe> | tomsmeding: Did you just whip all of that up in the last few minutes? |
| 2021-05-28 16:29:05 | benin8 | is now known as benin |
| 2021-05-28 16:29:19 | × | connrs quits (~connrs@s1.connrs.uk) (Quit: ZNC 1.8.2 - https://znc.in) |
| 2021-05-28 16:29:19 | <hololeap> | is there a way to make a Functor instance for Thing? it seems impossible since Functor is not allowed to reference `a` and thus we can't tell if `SomeWrapper a` is a Functor |
| 2021-05-28 16:29:26 | × | boxscape quits (~boxscape@user/boxscape) (Quit: Connection closed) |
| 2021-05-28 16:29:45 | <seabass> | davean: I get the opposite: not holding the control key down and typing Emacs keybindings fills my buffer with random b, d, ws etc etc |
| 2021-05-28 16:29:57 | <seabass> | I like that GHCI has GNU-style keybidings |
| 2021-05-28 16:30:03 | → | tromp joins (~textual@dhcp-077-249-230-040.chello.nl) |
| 2021-05-28 16:30:17 | <davean> | well, by default - they're configurable |
| 2021-05-28 16:30:18 | × | simendsjo quits (~user@cm-84.211.91.241.getinternet.no) (Ping timeout: 264 seconds) |
| 2021-05-28 16:30:21 | → | connrs joins (~connrs@s1.connrs.uk) |
| 2021-05-28 16:31:32 | <hololeap> | I thought I had seen people get around this by making it `data Thing a a = ...`, but GHC complains about conflicting definitions of `a` when I try that |
| 2021-05-28 16:31:57 | <seabass> | davean: yes, indeed :). BTW, I've just noticed that this channel is publically logged, so please excuse me if I swim off... |
| 2021-05-28 16:32:22 | <davean> | seabass: fairwell |
| 2021-05-28 16:32:24 | × | T_S__ quits (sid501726@id-501726.highgate.irccloud.com) () |
| 2021-05-28 16:32:38 | <seabass> | bye! :) |
| 2021-05-28 16:32:41 | ← | seabass parts (~sebastian@user/seabass) (Bye!) |
| 2021-05-28 16:34:28 | × | connrs quits (~connrs@s1.connrs.uk) (Client Quit) |
| 2021-05-28 16:34:35 | <hololeap> | anyone? |
| 2021-05-28 16:35:07 | → | connrs joins (~connrs@s1.connrs.uk) |
| 2021-05-28 16:35:29 | → | ubert joins (~Thunderbi@p200300ecdf259d8974882ed522245916.dip0.t-ipconnect.de) |
| 2021-05-28 16:35:47 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-05-28 16:37:27 | → | [Kalisto] joins (~Nico@user/kalisto/x-8968079) |
| 2021-05-28 16:37:42 | → | Tuplanolla joins (~Tuplanoll@91-159-68-239.elisa-laajakaista.fi) |
| 2021-05-28 16:37:43 | → | benin5 joins (~benin@183.82.177.19) |
| 2021-05-28 16:37:53 | × | nschoe quits (~quassel@178.251.84.79) (Ping timeout: 272 seconds) |
| 2021-05-28 16:38:21 | → | holy_ joins (~h01y_b4z0@2400:adc1:178:c800:9e45:76a9:57f2:1665) |
| 2021-05-28 16:39:42 | × | benin quits (benin@gateway/vpn/protonvpn/benin) (Ping timeout: 248 seconds) |
| 2021-05-28 16:39:42 | benin5 | is now known as benin |
| 2021-05-28 16:40:56 | <rahguzar> | hololeap : I am confused what you are trying to do . And your trying to define `data Thing a a` makes me think you are confused too. Though I might be wrong |
| 2021-05-28 16:41:50 | × | winter quits (~winter@2603-6011-f901-9e5b-0000-0000-0000-08cf.res6.spectrum.com) (Ping timeout: 248 seconds) |
| 2021-05-28 16:42:44 | <hololeap> | that was just something I tried. I'm trying to make a Functor instance for Thing given the definitions above |
| 2021-05-28 16:42:58 | × | spirgel quits (spirgel@gateway/vpn/protonvpn/spirgel) () |
| 2021-05-28 16:43:15 | × | da39a3ee5e6b4b0d quits (~textual@2403:6200:8876:ee80:e020:f584:6e47:bcb0) (Quit: Textual IRC Client: www.textualapp.com) |
| 2021-05-28 16:43:38 | × | Bartosz quits (~textual@50.35.215.151) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2021-05-28 16:44:32 | × | a6a45081-2b83 quits (~aditya@106.212.79.20) (Quit: Konversation terminated!) |
| 2021-05-28 16:44:55 | → | a6a45081-2b83 joins (~aditya@106.212.79.20) |
| 2021-05-28 16:44:56 | <rahguzar> | I don't think that is generally possible. Whether or not `Thing a` can be factor depends on what `SomeWrapper a` is i.e the implementation of your type family. |
| 2021-05-28 16:46:20 | <hololeap> | right, I would have to reference `a`, so that I could use the constraint (Functor (SomeWrapper a)), but since Functor is ((* -> *) -> Constraint), it's not allowed to reference `a` |
| 2021-05-28 16:46:56 | <hololeap> | I thought there might be some way to get around this |
| 2021-05-28 16:47:59 | <cheater> | zwro[m]: there's also runhaskell which can be used in a shebang |
| 2021-05-28 16:49:02 | → | Ariakenom joins (~Ariakenom@2001:9b1:efb:fc00:9b0:fc3f:488a:32da) |
| 2021-05-28 16:50:39 | <rahguzar> | I don't know what you mean by referencing `a` here. You need to implement `fmap :: (a -> b) -> Thing a -> Thing b` whether such a function exists depends on what `SomeWrapper a a` is. Maybe it is `a` , maybe it is (a,a) . In these cases a `Functor` instance is possible. |
| 2021-05-28 16:52:23 | <tomsmeding> | wroathe: well more than a few minutes, but yes |
| 2021-05-28 16:52:45 | <hololeap> | I would need to be able to say (Functor (SomeWrapper a) => ...) wouldn't I? |
| 2021-05-28 16:52:58 | <dminuoso> | hololeap: That wont work either |
| 2021-05-28 16:53:02 | × | Morrow quits (~MorrowM_@bzq-110-168-31-106.red.bezeqint.net) (Ping timeout: 248 seconds) |
| 2021-05-28 16:53:25 | <tomsmeding> | wroathe: directory created 17:38 my local time, paste sent 18:28, so took me 50 minutes :p |
| 2021-05-28 16:53:36 | → | rk04 joins (~rk04@103.232.8.236) |
| 2021-05-28 16:53:50 | <hololeap> | dminuoso: why not? |
| 2021-05-28 16:54:05 | <rahguzar> | But maybe it is `SomeWrapper a a` is `Int` if `a` is `Int` and otherwise it is `Double` for that there won't be. |
| 2021-05-28 16:54:33 | <hololeap> | well, I did specify that (SomeWrapper a) has kind (Type -> Type) |
| 2021-05-28 16:54:51 | <dminuoso> | hololeap: Consider the type of fmap |
| 2021-05-28 16:54:57 | <dminuoso> | % :t fmap |
| 2021-05-28 16:54:57 | <yahb> | dminuoso: Functor f => (a -> b) -> f a -> f b |
| 2021-05-28 16:55:43 | <dminuoso> | See how the type variable must be free to change? You need some additional degree of freedom to express this in a constraint, perhaps QuantifiedConstraints? |
| 2021-05-28 16:56:17 | → | v01d4lph4 joins (~v01d4lph4@user/v01d4lph4) |
| 2021-05-28 16:56:20 | → | tremon joins (~tremon@217-63-61-89.cable.dynamic.v4.ziggo.nl) |
| 2021-05-28 16:57:04 | → | orzo joins (joe@lasker.childrenofmay.org) |
| 2021-05-28 16:57:10 | <dminuoso> | hololeap: Presumably you dont have access to SomeWrapper's constructor, right? |
| 2021-05-28 16:57:10 | <hololeap> | cool, haven't heard of that. I will check it out |
| 2021-05-28 16:57:43 | × | xff0x quits (~xff0x@2001:1a81:53e0:500:230:e4e3:4c7:7c57) (Ping timeout: 272 seconds) |
| 2021-05-28 16:58:04 | → | isovector1 joins (~isovector@172.103.216.166) |
| 2021-05-28 16:58:05 | <hololeap> | it would depend on which `a` we're talking about in (SomeWrapper a) |
| 2021-05-28 16:58:09 | <isovector1> | does anyone use the `replace _ with <e>` code actions in HLS today? |
| 2021-05-28 16:58:25 | <isovector1> | wondering if anyone will be upset if they were to disappear |
| 2021-05-28 16:58:33 | <dminuoso> | hololeap: The thing is, if you stare at the type of fmap and set `f ~ SomeWrapper a` (Im playing fast and lose with type unification here) |
| 2021-05-28 16:58:36 | <dminuoso> | then you get: |
| 2021-05-28 16:58:50 | → | simendsjo joins (~user@cm-84.211.91.241.getinternet.no) |
| 2021-05-28 16:58:54 | × | wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 248 seconds) |
| 2021-05-28 16:58:59 | <hololeap> | but with the Functor interface, we wouldn't need to know what constructor is used |
| 2021-05-28 16:59:06 | → | xff0x joins (~xff0x@2001:1a81:53fe:8d00:3833:823b:7d79:69a2) |
| 2021-05-28 16:59:22 | <hololeap> | just that (SomeWrapper a) is a Functor |
| 2021-05-28 16:59:36 | <dminuoso> | Well, then you wont have a valid functor instance for your data type |
| 2021-05-28 17:00:01 | <dminuoso> | You could coerce your way out if the first type variable was a phantom type, maybe |
| 2021-05-28 17:00:16 | <dminuoso> | Let's make this happen real fast |
| 2021-05-28 17:00:26 | <dminuoso> | % data Pair a b = Pair a b |
| 2021-05-28 17:00:27 | <yahb> | dminuoso: |
| 2021-05-28 17:00:30 | <dminuoso> | % data Pair a b = Pair a b deriving Functor |
| 2021-05-28 17:00:30 | <yahb> | dminuoso: |
| 2021-05-28 17:00:49 | <dminuoso> | % data Foo a = Foo (Pair a a) |
| 2021-05-28 17:00:49 | <yahb> | dminuoso: |
| 2021-05-28 17:01:24 | → | pe200012_ joins (~pe200012@218.107.17.245) |
| 2021-05-28 17:01:43 | <dminuoso> | Assuming you dont have access to the data constructor of Pair, then `fmap f :: Pair a Int -> Pair a Char` for the same of argument |
| 2021-05-28 17:01:57 | × | pe200012 quits (~pe200012@119.131.208.84) (Ping timeout: 272 seconds) |
| 2021-05-28 17:01:58 | <dminuoso> | See how the first type argument is fixed? |
| 2021-05-28 17:02:25 | <dminuoso> | You'd require `Bifunctor Pair` at the least |
| 2021-05-28 17:02:52 | → | arjun joins (~user@user/arjun) |
| 2021-05-28 17:03:08 | <dminuoso> | such that you can write `instance Functor Foo where fmap f (Foo pair) = Foo (bimap f pair)` |
| 2021-05-28 17:03:49 | → | tomferon[m] joins (~tomferon@2001:470:69fc:105::268) |
All times are in UTC.