Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-02-27 11:29:36 × emmanuel_erc quits (~user@2603-7000-9600-01c9-c589-d024-9ed2-1840.res6.spectrum.com) (Read error: Connection reset by peer)
2021-02-27 11:29:54 × basoares_ quits (~basoares@2a04:ee41:4:2178:a846:18f7:81d4:249b) (Client Quit)
2021-02-27 11:30:21 hackage arch-hs 0.7.1.0 - Distribute hackage packages to archlinux https://hackage.haskell.org/package/arch-hs-0.7.1.0 (berberman)
2021-02-27 11:30:42 emmanuel_erc joins (~user@2603-7000-9600-01c9-c589-d024-9ed2-1840.res6.spectrum.com)
2021-02-27 11:31:07 jacks2 joins (~bc8134e3@217.29.117.252)
2021-02-27 11:31:09 × heatsink quits (~heatsink@107-136-5-69.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 264 seconds)
2021-02-27 11:32:43 <Guest34200> * Couldn't match type `[]' with `IO'
2021-02-27 11:32:43 <Guest34200>       Expected type: IO [Double]
2021-02-27 11:32:44 <Guest34200>         Actual type: [[Double]]
2021-02-27 11:33:01 <Guest34200> this is on one of the lines in bar
2021-02-27 11:33:30 <xsperry> there's no bar above
2021-02-27 11:33:31 <Guest34200> someFunction (readImg filepath)
2021-02-27 11:33:58 <Guest34200> this is the line ghci is screaming at ^
2021-02-27 11:34:32 <Guest34200> sorry ill make it more clear
2021-02-27 11:34:35 Deide joins (~Deide@217.155.19.23)
2021-02-27 11:34:49 <jacks2> best to post compilable example
2021-02-27 11:34:59 <Guest34200> main :: IO ()
2021-02-27 11:34:59 <Guest34200> main = do
2021-02-27 11:35:00 <Guest34200>     bar (readImg filepath)
2021-02-27 11:35:10 <jacks2> use some pastebin
2021-02-27 11:36:39 × emmanuel_erc quits (~user@2603-7000-9600-01c9-c589-d024-9ed2-1840.res6.spectrum.com) (Read error: Connection reset by peer)
2021-02-27 11:36:54 <Guest34200> https://pastebin.com/js1mUD5N
2021-02-27 11:37:05 × GZJ0X__ quits (~gzj@unaffiliated/gzj) (Read error: Connection reset by peer)
2021-02-27 11:37:26 GZJ0X__ joins (~gzj@unaffiliated/gzj)
2021-02-27 11:37:26 emmanuel_erc joins (~user@2603-7000-9600-01c9-c589-d024-9ed2-1840.res6.spectrum.com)
2021-02-27 11:37:46 <mouseghost> 404 not found
2021-02-27 11:37:53 <Guest34200> ?.?
2021-02-27 11:37:53 <lambdabot> Maybe you meant: ? .
2021-02-27 11:37:59 <Guest34200> one sec lol
2021-02-27 11:38:07 × GZJ0X__ quits (~gzj@unaffiliated/gzj) (Remote host closed the connection)
2021-02-27 11:38:13 <__monty__> @where paste
2021-02-27 11:38:13 <lambdabot> Help us help you: please paste full code, input and/or output at e.g. https://paste.tomsmeding.com
2021-02-27 11:38:30 GZJ0X__ joins (~gzj@unaffiliated/gzj)
2021-02-27 11:39:30 <Guest34200> https://paste.tomsmeding.com/YFGfSk0C
2021-02-27 11:40:36 danvet joins (~Daniel@2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa)
2021-02-27 11:41:07 × borne quits (~fritjof@2a06:8782:ffbb:1337:2133:4ed6:e22f:c3eb) (Quit: WeeChat 3.0)
2021-02-27 11:41:48 <jacks2> what's the type of convolveXY?
2021-02-27 11:42:29 <Guest34200> forall a. Num a => [[a]] -> [[a]] -> [[a]]
2021-02-27 11:42:37 <jacks2> and what's the type of readImg "volcano.jpg"?
2021-02-27 11:42:51 <Guest34200> FilePath -> IO [[Graphics.Image.ColorSpace.Pixel Y Double]]
2021-02-27 11:42:57 bergey joins (~user@pool-74-108-99-127.nycmny.fios.verizon.net)
2021-02-27 11:43:07 <jacks2> it's IO [[Graphics.Image.ColorSpace.Pixel Y Double]]
2021-02-27 11:43:07 × emmanuel_erc quits (~user@2603-7000-9600-01c9-c589-d024-9ed2-1840.res6.spectrum.com) (Read error: Connection reset by peer)
2021-02-27 11:43:15 <Guest34200> oh
2021-02-27 11:43:18 <jacks2> see the problem?
2021-02-27 11:43:26 <Guest34200> yeah it outputs io
2021-02-27 11:43:32 <jacks2> yes
2021-02-27 11:43:37 <Guest34200> but convolvexy takes in [[a]]
2021-02-27 11:43:43 <Guest34200> specifically [[double]]
2021-02-27 11:43:57 emmanuel_erc joins (~user@2603-7000-9600-01c9-c589-d024-9ed2-1840.res6.spectrum.com)
2021-02-27 11:44:16 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-02-27 11:44:46 <Guest34200> tomsmeding mentioned earlier working in the IO monad as a resolution
2021-02-27 11:45:34 <jacks2> you can do the same thing you did in readImg, use <-
2021-02-27 11:47:57 × bergey quits (~user@pool-74-108-99-127.nycmny.fios.verizon.net) (Ping timeout: 264 seconds)
2021-02-27 11:48:11 <Guest34200> as in
2021-02-27 11:48:25 <Guest34200> set convolvexy ....... to a variable?
2021-02-27 11:48:26 × finn_elija quits (~finn_elij@gateway/tor-sasl/finnelija/x-67402716) (Ping timeout: 268 seconds)
2021-02-27 11:48:33 terrorjack joins (~terrorjac@ec2-18-162-149-225.ap-east-1.compute.amazonaws.com)
2021-02-27 11:48:38 <Guest34200> like result <- convolvexy .. . ...
2021-02-27 11:48:59 chloekek joins (~chloekek@84-80-232-61.fixed.kpn.net)
2021-02-27 11:49:29 <jacks2> no, your issue, as you noticed above, is that readImg "volcano.jpg" returns IO [[..]] and convolvexy accepts [[..]]
2021-02-27 11:49:32 <chloekek> Does it make sense to use Cabal’s Nix integration when already running cabal from nix-shell?
2021-02-27 11:49:54 <Guest34200> right
2021-02-27 11:49:54 × emmanuel_erc quits (~user@2603-7000-9600-01c9-c589-d024-9ed2-1840.res6.spectrum.com) (Read error: Connection reset by peer)
2021-02-27 11:50:22 hackage xml-conduit 1.9.1.0 - Pure-Haskell utilities for dealing with XML with the conduit package. https://hackage.haskell.org/package/xml-conduit-1.9.1.0 (koral)
2021-02-27 11:50:26 emmanuel_erc joins (~user@2603-7000-9600-01c9-c589-d024-9ed2-1840.res6.spectrum.com)
2021-02-27 11:50:33 <jacks2> so use <- to end up with [[..]] from readImg "volcano.jpg"
2021-02-27 11:51:28 finn_elija joins (~finn_elij@gateway/tor-sasl/finnelija/x-67402716)
2021-02-27 11:53:54 <Guest34200> hmm I think I'm misunderstanding <-. I'm thinking of it in a imperative way, <- is like a statement no?
2021-02-27 11:54:58 <jacks2> :t getLine
2021-02-27 11:54:59 <lambdabot> IO String
2021-02-27 11:55:11 <jacks2> do line <- getLine; -- line is now String
2021-02-27 11:55:19 <Guest34200> :o
2021-02-27 11:55:25 <Guest34200> wow
2021-02-27 11:55:56 <Guest34200> so you're able to assign types like that?
2021-02-27 11:56:07 <jacks2> I figured you understand that much, since you are doing it in readImg
2021-02-27 11:56:35 <Guest34200> well I was thinking of it in the imperative way haha
2021-02-27 11:56:44 × emmanuel_erc quits (~user@2603-7000-9600-01c9-c589-d024-9ed2-1840.res6.spectrum.com) (Read error: Connection reset by peer)
2021-02-27 11:57:06 <Guest34200> like i'm assigning the output of some function to procImg
2021-02-27 11:57:34 emmanuel_erc joins (~user@2603-7000-9600-01c9-c589-d024-9ed2-1840.res6.spectrum.com)
2021-02-27 11:58:39 <__monty__> Guest34200: What helped me understand is seeing do-notation desugared. `do { x <- getLine; putStrLn x }` desugars to `getLine >>= \x -> putStrLn x`.
2021-02-27 11:59:57 <__monty__> While `do { print 1; print 2 }` desugars to `print 1 >> print 2` which is equivalent to `print 1 >>= \_ -> print 2`, so unless you use <- you're not binding the value in what follows.
2021-02-27 12:01:51 <jacks2> <- in do allows you to seemingly remove IO within a do block, with a ceveat caveat that do block itself returns IO at the end. you can't escape IO once you start using it
2021-02-27 12:02:24 <Guest34200> i see
2021-02-27 12:02:24 × jacks2 quits (~bc8134e3@217.29.117.252) (Quit: http://www.okay.uz/ (EOF))
2021-02-27 12:03:17 × zaquest quits (~notzaques@5.128.210.178) (Quit: Leaving)
2021-02-27 12:04:02 jacks2 joins (~bc8134e3@217.29.117.252)
2021-02-27 12:04:07 <jacks2> "do line <- getLine; putStrLn line" desugars to "getLine >>= \line -> putStrLn line" which is just "getLine >>= putStrLn"
2021-02-27 12:05:08 <jacks2> havre you used Maybe yet?
2021-02-27 12:05:10 <jacks2> have*
2021-02-27 12:05:35 <Guest34200> no
2021-02-27 12:06:05 <Guest34200> doing  res <- readImg "vol.jpg" and then convolveXY res [[0.33,0.33,0.33],[0.33,0.33,0.33],[0.33,0.33,0.33]] still gives me the same error
2021-02-27 12:06:27 <Guest34200> but res shows up as the correct type
2021-02-27 12:06:50 zaquest joins (~notzaques@5.128.210.178)
2021-02-27 12:06:57 codedmart_ is now known as codedmart
2021-02-27 12:07:24 <ezzieyguywuf> MarcelineVQ: thanks for yoyr thoughts on liquidhaskell
2021-02-27 12:07:47 Guest34200 is now known as daffy
2021-02-27 12:07:58 <jacks2> convolveXY doesn't return IO, which is what you have to return in IO do block
2021-02-27 12:08:00 <jacks2> :t return
2021-02-27 12:08:02 <lambdabot> Monad m => a -> m a

All times are in UTC.