Newest at the top
| 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 +0100 | tromp | (~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 +0100 | ljdarj1 | ljdarj |
| 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? |
| 2025-11-28 20:06:57 +0100 | tzh | (~tzh@c-76-115-131-146.hsd1.or.comcast.net) |
| 2025-11-28 20:06:53 +0100 | ljdarj1 | (~Thunderbi@user/ljdarj) ljdarj |
| 2025-11-28 20:06:49 +0100 | ljdarj | (~Thunderbi@user/ljdarj) (Ping timeout: 246 seconds) |
| 2025-11-28 20:06:23 +0100 | <milan> | :D My apologies |
| 2025-11-28 20:06:03 +0100 | <EvanR> | have some* xD |
| 2025-11-28 20:05:51 +0100 | <EvanR> | also have to decorum and put a space between IO and () |
| 2025-11-28 20:05:19 +0100 | <EvanR> | (note you don't have to type print to see the result in the repl) |
| 2025-11-28 20:05:05 +0100 | <EvanR> | print has that type, why is that "yet" |
| 2025-11-28 20:04:51 +0100 | <milan> | EvanR: Agree |
| 2025-11-28 20:04:43 +0100 | <milan> | Yet print :: Show a => a -> IO() ? |
| 2025-11-28 20:04:12 +0100 | <EvanR> | which is good because there's a lot |
| 2025-11-28 20:03:52 +0100 | <EvanR> | the tower of machinery to get that on the screen has no effect on the program |
| 2025-11-28 20:03:41 +0100 | <EvanR> | easily |
| 2025-11-28 20:03:24 +0100 | <EvanR> | that is why you can type purely function programs in the repl and see the result |
| 2025-11-28 20:03:11 +0100 | <milan> | So simply printing to console should not be considered "impure" and thus in IO monad? |
| 2025-11-28 20:03:08 +0100 | infinity0 | (~infinity0@pwned.gg) (Quit: WeeChat 4.6.3) |
| 2025-11-28 20:02:41 +0100 | <milan> | Yes, but... I understand why reading from (external object) is not pure.. You can always read something else so now your function can return different things. But why writing to external object is also considered impure? Wheter it succeds or not can't affect my pure program right? |
| 2025-11-28 19:59:52 +0100 | <EvanR> | something behind the scenes just hooks it up |
| 2025-11-28 19:59:39 +0100 | <EvanR> | and data |
| 2025-11-28 19:59:33 +0100 | <EvanR> | if that's all it is then it's possible to get a lot done using only pure functions |