2025/11/28

Newest at the top

2025-11-28 20:18:57 +0100 <milan> hmm
2025-11-28 20:18:22 +0100acidjnk(~acidjnk@p200300d6e7171911dda60d32ed7e3ae9.dip0.t-ipconnect.de) (Ping timeout: 246 seconds)
2025-11-28 20:18:04 +0100 <EvanR> just evaluating print 3 by itself wouldn't necessarily do the IO i.e. in (print 3, print 3), so it's a big distinction to make
2025-11-28 20:17:32 +0100 <milan> I agree
2025-11-28 20:17:22 +0100ChaiTRex(~ChaiTRex@user/chaitrex) ChaiTRex
2025-11-28 20:17:04 +0100 <EvanR> algebraically
2025-11-28 20:17:00 +0100 <EvanR> in this way you can build up a big IO from smaller ones
2025-11-28 20:16:53 +0100ChaiTRex(~ChaiTRex@user/chaitrex) (Remote host closed the connection)
2025-11-28 20:16:42 +0100 <lambdabot> IO a -> (a -> IO b) -> (a -> IO c) -> IO c
2025-11-28 20:16:41 +0100 <EvanR> :t bracket
2025-11-28 20:16:28 +0100 <EvanR> or pass it as an argument
2025-11-28 20:16:20 +0100 <EvanR> you could store the IO () in a data structure or mutable variable for later
2025-11-28 20:16:00 +0100 <EvanR> but the program itself just computes data
2025-11-28 20:15:53 +0100 <milan> Yep
2025-11-28 20:15:50 +0100 <EvanR> would print twice
2025-11-28 20:15:43 +0100 <EvanR> e.g. main = print 3 >> print 3 :: IO ()
2025-11-28 20:15:18 +0100 <EvanR> main :: IO ()
2025-11-28 20:15:10 +0100 <EvanR> as the program runs, the I/O commands it computes are executed
2025-11-28 20:14:47 +0100 <EvanR> that's just the supporting infrastructure for the runtime
2025-11-28 20:14:34 +0100 <milan> Some external object that might or might not correctly change state because we asked it to... it is same for display in calculator, and same for file in disk.
2025-11-28 20:14:15 +0100 <EvanR> haskell is a purely functional programming language, not purely functional hardware
2025-11-28 20:13:41 +0100tromp(~textual@2001:1c00:3487:1b00:9176:7929:ae5a:d4f6)
2025-11-28 20:13:40 +0100 <milan> or file that we can write to.. or socket we can write to..
2025-11-28 20:13:39 +0100 <EvanR> I figured you were talking about the programming language though, not the hardware
2025-11-28 20:13:25 +0100 <milan> same as console
2025-11-28 20:13:21 +0100 <milan> It has it has display
2025-11-28 20:13:07 +0100 <EvanR> your calculator is useful despite not having any I/O commands
2025-11-28 20:13:05 +0100 <mniip> if you're looking for something to use while debugging pure code, there is such a tool
2025-11-28 20:12:50 +0100 <EvanR> not necessarily
2025-11-28 20:12:44 +0100 <milan> Then all programs would be unusable
2025-11-28 20:12:37 +0100 <milan> Well
2025-11-28 20:12:25 +0100 <milan> Had we dropped our expectation on how and if something must appear in console?
2025-11-28 20:12:11 +0100 <EvanR> so it's not going to be great at printing anything
2025-11-28 20:11:47 +0100 <mniip> this is why pure functions cannot perform side effects such as output something to the console
2025-11-28 20:11:42 +0100 <EvanR> if myPrint is a pure function, then it means you can't observe any side effects
2025-11-28 20:11:27 +0100 <milan> mniip: hmm...
2025-11-28 20:11:09 +0100 <mniip> referential transparency says that `(print 3, print 3)` and `let x = print 3 in (x, x)` must do the same thing, but you'd expect the first one to output twice and the second one only once
2025-11-28 20:10:55 +0100 <milan> What about myPrint :: Show a => a -> Int ?
2025-11-28 20:10:03 +0100 <EvanR> note it wouldn't be a very good print function, for one thing you don't know the input has Show support
2025-11-28 20:09:12 +0100ljdarj1ljdarj
2025-11-28 20:09:08 +0100 <lambdabot> Num a => b -> a
2025-11-28 20:09:07 +0100 <EvanR> :t const 1
2025-11-28 20:08:48 +0100 <EvanR> always returning 1 would be const 1
2025-11-28 20:08:40 +0100 <EvanR> while being a pure function
2025-11-28 20:08:27 +0100 <EvanR> what behavior do you want the function to have again
2025-11-28 20:08:10 +0100 <milan> No it always yields 1
2025-11-28 20:07:54 +0100 <milan> No I am asking why it returns Monad if it does not have to
2025-11-28 20:07:48 +0100 <EvanR> i.e. print 3 yields the number 3 or something?
2025-11-28 20:07:36 +0100 <EvanR> you're asking why the print function doesn't return a number
2025-11-28 20:07:13 +0100 <milan> Why print does not have type a -> Int? And always produce number 1? Why is it IO?