Logs: freenode/#haskell
| 2021-02-28 10:29:51 | <olligobber> | hmm, stack won't load validated-literals |
| 2021-02-28 10:29:54 | <edwardk> | i understand that. just giving a general sense of what it picks what it picks |
| 2021-02-28 10:33:18 | × | toorevitimirp quits (~tooreviti@117.182.182.60) (Remote host closed the connection) |
| 2021-02-28 10:33:46 | × | todda7 quits (~torstein@athedsl-258913.home.otenet.gr) (Read error: Connection reset by peer) |
| 2021-02-28 10:33:58 | <olligobber> | ugh, best solution seems to be a dummy Empty module |
| 2021-02-28 10:33:59 | <olligobber> | :( |
| 2021-02-28 10:34:02 | → | todda7 joins (~torstein@athedsl-258913.home.otenet.gr) |
| 2021-02-28 10:34:12 | → | average joins (uid473595@gateway/web/irccloud.com/x-fxgddkvvlaaxcpgp) |
| 2021-02-28 10:34:51 | → | toorevitimirp joins (~tooreviti@117.182.182.60) |
| 2021-02-28 10:35:29 | <edwardk> | adding another package to your cabal project that depends on the project you want the guts of but which doesn't export any modules? |
| 2021-02-28 10:35:46 | → | Ishutin_ joins (~ishutin@80-95-70-202.pool.digikabel.hu) |
| 2021-02-28 10:35:46 | <edwardk> | then cabal repl yourdummyproject ? |
| 2021-02-28 10:35:57 | → | nineonine joins (~nineonine@2604:3d08:7785:9600:8c3e:8d1a:de68:76d3) |
| 2021-02-28 10:39:13 | × | hnOsmium0001 quits (uid453710@gateway/web/irccloud.com/x-ssveckbgtfjmjehe) (Quit: Connection closed for inactivity) |
| 2021-02-28 10:39:37 | × | Ishutin quits (~ishutin@92-249-193-15.pool.digikabel.hu) (Ping timeout: 272 seconds) |
| 2021-02-28 10:39:47 | → | daffy joins (01c8aa98@1.200.170.152) |
| 2021-02-28 10:40:50 | × | nineonine quits (~nineonine@2604:3d08:7785:9600:8c3e:8d1a:de68:76d3) (Ping timeout: 264 seconds) |
| 2021-02-28 10:44:03 | → | hiroaki_ joins (~hiroaki@2a02:908:4b18:8c40:cc64:29af:c80:536f) |
| 2021-02-28 10:44:04 | × | kuribas quits (~user@ptr-25vy0i8a0npfg024kq6.18120a2.ip6.access.telenet.be) (Remote host closed the connection) |
| 2021-02-28 10:48:11 | → | fendor joins (~fendor@078132053193.public.t-mobile.at) |
| 2021-02-28 10:48:33 | <tomsmeding> | olligobber: you know that ':m' will unfocus all modules? |
| 2021-02-28 10:48:56 | → | rdivyanshu joins (uid322626@gateway/web/irccloud.com/x-qtewvwtwengjftbg) |
| 2021-02-28 10:50:00 | <olligobber> | tomsmeding, a way to do `:m' automatically after cabal loads the modules would be good, but I don't think it's possible |
| 2021-02-28 10:51:21 | → | heatsink joins (~heatsink@2600:1700:bef1:5e10:692f:34e4:c65a:92f2) |
| 2021-02-28 10:51:49 | × | todda7 quits (~torstein@athedsl-258913.home.otenet.gr) (Ping timeout: 260 seconds) |
| 2021-02-28 10:54:06 | <tomsmeding> | olligobber: it doesn't seem so; you can inject additional ghci startup scripts, but those run before the modules are loaded |
| 2021-02-28 10:55:46 | <olligobber> | yeah :( |
| 2021-02-28 10:55:50 | × | heatsink quits (~heatsink@2600:1700:bef1:5e10:692f:34e4:c65a:92f2) (Ping timeout: 264 seconds) |
| 2021-02-28 10:57:36 | <tomsmeding> | olligobber: for a nice hack, you can take the command line that cabal uses to start ghci, remove all the modules from it, and then pass a -ghci-script that :add's those modules and then does :m |
| 2021-02-28 10:57:44 | <tomsmeding> | that seems to work for me on a simple project |
| 2021-02-28 10:57:51 | <daffy> | what does the error message "ambiguous type variable" mean? i using a function that is supposed to output four types, and the actual output seems to contain "Any" as one of the types. I'm assuming the "Any" type is where the ambiguity is coming from but I can't tell why it's one of the types |
| 2021-02-28 11:08:37 | <olligobber> | so in my .cabal file, I have an executable that includes the library in the build-depends, and the library includes a bunch of things in its build-depends, but when it builds the executable it doesn't have the things in the library's build-depends |
| 2021-02-28 11:10:47 | → | todda7 joins (~torstein@athedsl-258913.home.otenet.gr) |
| 2021-02-28 11:11:24 | → | kiwi_3697 joins (51f28de3@gateway/web/cgi-irc/kiwiirc.com/ip.81.242.141.227) |
| 2021-02-28 11:12:32 | → | Franciman joins (~francesco@host-82-49-79-189.retail.telecomitalia.it) |
| 2021-02-28 11:13:42 | ← | kiwi_3697 parts (51f28de3@gateway/web/cgi-irc/kiwiirc.com/ip.81.242.141.227) () |
| 2021-02-28 11:14:33 | <boxscape> | daffy "ambiguous type variable" means there is not enough context to determine how a type variable should be instantiated. For example, in `read :: Read a => String -> a`, `a` is a type variable, and if you try to just do `read "42"` without context, you'll get such an error because it doesn't know what `a` should be. `Any` is a special type that |
| 2021-02-28 11:14:33 | <boxscape> | ghc uses in certain contexts to instantiate type variables if it doesn't know how else it should instantiate them - but Any should be a consequence, not the source of the issue here, I would think. |
| 2021-02-28 11:14:52 | <daffy> | hmmm |
| 2021-02-28 11:15:09 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-02-28 11:15:10 | <daffy> | i see |
| 2021-02-28 11:15:18 | → | psutcliffe joins (~psutcliff@2a00:801:3f2:4b56:e93e:1663:ff0c:6c42) |
| 2021-02-28 11:17:03 | <boxscape> | daffy feel free to post a link to code if you need more specific help |
| 2021-02-28 11:17:16 | <xsperry> | if you pass the result of read "42" to some function, though, it will use the type of the argument to that function to determine what read should return |
| 2021-02-28 11:18:48 | <daffy> | I'm using the function fromLists from hip, and I'm passing it something of type [[Pixel Y Double]]. |
| 2021-02-28 11:18:59 | <daffy> | fromLists :: forall arr cs e. Array arr cs e => [[Pixel cs e]] -> Image arr cs e |
| 2021-02-28 11:19:06 | <daffy> | this is the type of fromLists |
| 2021-02-28 11:19:36 | <daffy> | _ :: [[Pixel Y Double]] -> Image Any Y Double and i believe this is the type of the variable I'm storing the result of fromLists to |
| 2021-02-28 11:19:49 | × | todda7 quits (~torstein@athedsl-258913.home.otenet.gr) (Ping timeout: 260 seconds) |
| 2021-02-28 11:21:00 | <boxscape> | hm so it doesn't know what `arr` should be |
| 2021-02-28 11:21:18 | <daffy> | which arr is it talking about? I'm a bit confused about the type signature |
| 2021-02-28 11:24:55 | <boxscape> | I haven't used hip unfortunately so I'm not 100% sure how it works, it looks like there's a BaseArray class which has instances for various array types like `VU` (unboxed vectors) and others, and this is what `arr` should be filled with as well |
| 2021-02-28 11:25:06 | <boxscape> | in Image |
| 2021-02-28 11:25:13 | <boxscape> | 's argument |
| 2021-02-28 11:26:26 | <boxscape> | daffy can you try adding a type signature `[[Pixel Y Double]] -> Image VU Y Double`? |
| 2021-02-28 11:27:22 | <boxscape> | basically arr determines which underlying array representation you use |
| 2021-02-28 11:27:37 | <daffy> | when I read the image originally i specific VS |
| 2021-02-28 11:27:44 | <daffy> | as the array representation |
| 2021-02-28 11:27:49 | <daffy> | *specified |
| 2021-02-28 11:27:50 | <boxscape> | ah, okay, in that case use VS |
| 2021-02-28 11:28:25 | <daffy> | the type signature right now is IO (Inte.Image GHC.Types.Any Y Double) though |
| 2021-02-28 11:28:29 | <daffy> | I'm doing this in main |
| 2021-02-28 11:28:33 | <daffy> | and the function is in a do block |
| 2021-02-28 11:29:23 | <boxscape> | in that case, can you try IO (Image VS Y Double)? |
| 2021-02-28 11:29:34 | <boxscape> | though I'm not sure why it would be "Inte.Image" |
| 2021-02-28 11:29:58 | → | __monty__ joins (~toonn@unaffiliated/toonn) |
| 2021-02-28 11:30:20 | <daffy> | oh Inte is just an alias for one of the packages |
| 2021-02-28 11:30:26 | <boxscape> | ah, that makes sense |
| 2021-02-28 11:30:40 | <olligobber> | cabal is such a pain |
| 2021-02-28 11:32:03 | <[exa]> | olligobber: if I got your previous message right, you'd expect that dependencies are imported transitively? |
| 2021-02-28 11:32:15 | <[exa]> | s/imported/exposed/ |
| 2021-02-28 11:32:27 | <olligobber> | yeah |
| 2021-02-28 11:32:41 | <olligobber> | if a needs b and b needs c, then a needs c, right? |
| 2021-02-28 11:33:20 | <[exa]> | yeah, and the package is not getting installed for you? |
| 2021-02-28 11:33:32 | <[exa]> | ie. the middle library compilation dies with not having a dependency? |
| 2021-02-28 11:33:33 | <olligobber> | I'll share my .cabal and the error |
| 2021-02-28 11:33:41 | <olligobber> | but yeah, that's what's happening |
| 2021-02-28 11:34:09 | <daffy> | boxscape it worked |
| 2021-02-28 11:34:42 | <daffy> | so the problem was that i had to specify what arr? |
| 2021-02-28 11:34:48 | <olligobber> | https://gist.github.com/olligobber/6ba9cfba3953f7320eb350db621b16fb |
| 2021-02-28 11:35:03 | <boxscape> | daffy: nice. I can't really tell you without more context why it didn't know what that variable should be, but generally speaking you can always get rid of "ambiguous type variable" errors by adding type signatures |
| 2021-02-28 11:35:20 | <daffy> | ah, ok |
| 2021-02-28 11:35:38 | <daffy> | so are the type signatures automatically generated by vscode no good? |
| 2021-02-28 11:35:52 | <boxscape> | daffy ah, the "Any" was generated by VSCode? |
| 2021-02-28 11:36:34 | <daffy> | uhhh no the the "Any" was when I hovered over the function |
| 2021-02-28 11:36:49 | <daffy> | and it said it had Any as one of the types |
| 2021-02-28 11:37:08 | <daffy> | IO (Inte.Image GHC.Types.Any Y Double) was what was generated by vscode |
| 2021-02-28 11:38:20 | → | minoru_shiraeesh joins (~shiraeesh@109.166.56.139) |
| 2021-02-28 11:39:15 | × | dsrt^ quits (dsrt@ip98-184-89-2.mc.at.cox.net) () |
| 2021-02-28 11:39:39 | <[exa]> | olligobber: well so it's thinking that you want to import the library file as a source of the executable |
| 2021-02-28 11:39:39 | <boxscape> | daffy I would guess that VSCode should generally produce decent type signatures, though I haven't tried it. In this particular case though it's unhelpful, because it also doesn't know how to properly fill the ambiguous type variable. |
| 2021-02-28 11:40:03 | <xsperry> | do you get the same type in ghci with your old code? |
| 2021-02-28 11:40:12 | <[exa]> | olligobber: which is kinda hard to explain to the compiler. Suggest separating src/ and lib/ ? |
| 2021-02-28 11:40:27 | → | vs^ joins (vs@ip98-184-89-2.mc.at.cox.net) |
| 2021-02-28 11:40:30 | <olligobber> | [exa], use src for the executables and lib for the library? |
| 2021-02-28 11:40:32 | <boxscape> | xsperry keep in mind that this is inside an IO block so not trivial to ask for a type in ghci |
| 2021-02-28 11:40:55 | × | srk quits (~sorki@gateway/tor-sasl/sorki) (Remote host closed the connection) |
| 2021-02-28 11:40:55 | × | hexo quits (~hexo@gateway/tor-sasl/hexo) (Remote host closed the connection) |
| 2021-02-28 11:41:00 | <xsperry> | type holes would work |
| 2021-02-28 11:41:06 | <xsperry> | typed* |
All times are in UTC.