Logs: freenode/#haskell
| 2020-11-25 11:39:21 | <ski> | type Answer = [Response] -> [Request] |
| 2020-11-25 11:39:24 | <ski> | it becomes |
| 2020-11-25 11:39:33 | <ski> | hPutStr :: Handle -> String -> Answer -> Answer |
| 2020-11-25 11:39:39 | <ski> | and then one'd also do |
| 2020-11-25 11:39:53 | <ski> | hGetLine :: Handle -> (String -> Answer) -> Answer |
| 2020-11-25 11:40:12 | <ski> | (another name for `Answer' that's been used is `Dialogue', for "dialogue-based I/O") |
| 2020-11-25 11:40:35 | <ski> | this is actually writing the program in continuation-passing style, and so one could express these using `Cont' : |
| 2020-11-25 11:40:46 | <ski> | hPutStr :: Handle -> String -> Cont Answer () |
| 2020-11-25 11:40:47 | → | solonarv joins (~solonarv@astrasbourg-653-1-191-240.w90-13.abo.wanadoo.fr) |
| 2020-11-25 11:40:57 | <ski> | hGetLine :: Handle -> Cont Answer String |
| 2020-11-25 11:41:49 | <ski> | and then we could define `IO' as `Cont Answer', and define monadic combinators on `IO' (like `returnIO',`bindIO'), or the overloaded ones that we have today, that applies to any monad |
| 2020-11-25 11:42:16 | × | wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 256 seconds) |
| 2020-11-25 11:43:00 | <dminuoso> | ski: But this is also more error prone in a subtle way. Response is not parametrized over the type of result it yields. |
| 2020-11-25 11:43:10 | <ski> | (it's also possible to have `Answer' as an abstract data type, and base I/O directly on it, instead of defining `Answer' in terms of the dialogue-based I/O. Andrew Appel's "Modern Compiler Implementation in SML/C/Java" does that, in a chapter about a purely functional language) |
| 2020-11-25 11:43:27 | <ski> | dminuoso : it isn't intended to |
| 2020-11-25 11:43:45 | <dminuoso> | So you could pass the `Response` to something not compatible with what it produces |
| 2020-11-25 11:44:02 | <ski> | you can use the CPS `(a -> Answer) -> Answer' to express a computed answer `a', and the ability to continue with further I/O dialogue after that |
| 2020-11-25 11:45:50 | <ski> | "Did that mechanism support things like forkIO?" -- not really. the dialogue models a synchronized, fully linear, interleaving of requests and responses. the more or less arbitrary interleaving of multiple such dialogues couldn't really be expressed nicely here, that i can see |
| 2020-11-25 11:45:53 | × | subttle quits (~anonymous@unaffiliated/subttle) (Quit: leaving) |
| 2020-11-25 11:46:16 | × | cads quits (~cads@ip-64-72-99-232.lasvegas.net) (Ping timeout: 240 seconds) |
| 2020-11-25 11:46:40 | <ski> | also, it's awkward to have to change `Request' and `Response', to add new primitive types of operations. it's better to have `Answer', or `IO', be an abstract type, and have ways of importing foreign operations dealing with them |
| 2020-11-25 11:46:43 | <dminuoso> | ski: well, I just thought that you could just dupliate another dialog machine on forkIO |
| 2020-11-25 11:47:09 | → | chaosmasttter joins (~chaosmast@p200300c4a7107e01f51a90bd3c8201d7.dip0.t-ipconnect.de) |
| 2020-11-25 11:47:15 | <dminuoso> | in the sense of forking the entire process |
| 2020-11-25 11:47:37 | <ski> | i guess something like `([Response] -> [Request]) -> ([Response] -> [Request]) -> ([Response] -> [Request])' could perhaps work, hmm |
| 2020-11-25 11:48:08 | <ski> | (btw, note that you got the `Response' vs. `Request' ordering wrong for `forkIO'. the `Requests' are the outputs, and the `Response' are the inputs) |
| 2020-11-25 11:48:26 | <ski> | hmm |
| 2020-11-25 11:49:34 | <ski> | well, i suppose you could have a request `ForkIO ([Response] -> [Request])', and defer to the OS how the interleaving of I/O operations should happen |
| 2020-11-25 11:49:57 | <ski> | (i was thinking about possibly describing, in-language, the interleaving) |
| 2020-11-25 11:52:35 | <ski> | triteraflops : in any case, uniqueness and monads are not directly comparable. they are at "different levels". it's more fair to compare uniqueness to `IO' and `ST'. the latter two can be thought of as abstract datatypes which conceptually makes use of uniqueness internally (even though the language doesn't allow expressing uniqueness). them being abstract protects the use of the "state-passing" to ensure |
| 2020-11-25 11:52:41 | <ski> | uniqueness inside, so that "update-in-place" can be used. however, as noticed by someone else, for some notions of I/O, the "world-passing" isn't really a good fit |
| 2020-11-25 11:54:23 | <tomsmeding> | Digit: are you switching ghc's using ghcup? Not sure if I've seen that ghc-pkg error before, perhaps a version mismatch? |
| 2020-11-25 11:54:46 | hekkaidekapus_ | is now known as hekkaidekapus |
| 2020-11-25 11:55:25 | × | Codaraxis quits (~Codaraxis@91.193.4.10) (Ping timeout: 240 seconds) |
| 2020-11-25 11:55:44 | <ski> | triteraflops : anyway, there are operations `return :: a -> St s a',`(`bind`) :: (St s a) -> (a -> St s b) -> St s b',`seqList :: [St s a] -> St s [a]' in Clean, `St s a' being defined as `s -> (a,s)'. these can be applied to passing unique values (the `World', or `File's or arrays) around, threading them through a computation. `seqList' corresponds in Haskell to `sequence', for the `State s' monad |
| 2020-11-25 11:56:12 | → | Codaraxis joins (~Codaraxis@91.193.4.10) |
| 2020-11-25 11:57:56 | <ski> | triteraflops : one advantage of the uniqueness approach is that not all I/O operations, or array operations, need to be explicitly sequenced, wrt each other. if you open two `File's, or operate on two arrays, then these would be two different "unique state threads", can be evaluated independently of each other. this improves laziness, as compared to Haskell's monadic `IO' and `ST', which insists on |
| 2020-11-25 11:58:02 | <ski> | sequentializing all the I/O or state operations, wrt each other |
| 2020-11-25 11:58:23 | → | boxscape joins (54a35f37@gateway/web/cgi-irc/kiwiirc.com/ip.84.163.95.55) |
| 2020-11-25 11:59:12 | → | Tario joins (~Tario@201.192.165.173) |
| 2020-11-25 11:59:19 | × | Yumasi quits (~guillaume@40.72.95.92.rev.sfr.net) (Ping timeout: 246 seconds) |
| 2020-11-25 11:59:47 | <ski> | (unless you're using `forkIO' to spawn a new thread doing I/O, or using `unsafeInterleaveST' to spawn a new "state thread" (not actually using preemptive or cooperative threads in the conventional sense), which is intended to operate on state that's disjoint from the rest of the state (hence the `unsafe' in the name)) |
| 2020-11-25 12:00:40 | × | plutoniix quits (~q@175.176.222.7) (Quit: Leaving) |
| 2020-11-25 12:01:15 | <hekkaidekapus> | tomsmeding, Digit: Building with v. ≥8.8 requires patching usages of `Control.Monad.fail` (see <https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/8.8#base-41300>). v. ≤8.6.5 will be fine modulo some tweaks in the cabal file. |
| 2020-11-25 12:01:15 | × | chkno quits (~chkno@75-7-2-127.lightspeed.sntcca.sbcglobal.net) (Read error: Connection reset by peer) |
| 2020-11-25 12:01:58 | → | chkno joins (~chkno@75-7-2-127.lightspeed.sntcca.sbcglobal.net) |
| 2020-11-25 12:02:36 | × | zaquest quits (~notzaques@5.128.210.178) (Quit: Leaving) |
| 2020-11-25 12:03:00 | × | Codaraxis quits (~Codaraxis@91.193.4.10) (Remote host closed the connection) |
| 2020-11-25 12:03:20 | → | Codaraxis joins (~Codaraxis@91.193.4.10) |
| 2020-11-25 12:06:16 | → | royal_screwup21 joins (52254809@gateway/web/cgi-irc/kiwiirc.com/ip.82.37.72.9) |
| 2020-11-25 12:06:55 | × | Codaraxis quits (~Codaraxis@91.193.4.10) (Remote host closed the connection) |
| 2020-11-25 12:08:29 | × | da39a3ee5e6b4b0d quits (~da39a3ee5@67.23.55.162) (Ping timeout: 256 seconds) |
| 2020-11-25 12:09:14 | → | Codaraxis joins (~Codaraxis@91.193.4.10) |
| 2020-11-25 12:10:23 | → | Entertainment joins (~entertain@104.246.132.210) |
| 2020-11-25 12:10:33 | × | Codaraxis quits (~Codaraxis@91.193.4.10) (Remote host closed the connection) |
| 2020-11-25 12:16:40 | → | gproto23 joins (~gproto23@unaffiliated/gproto23) |
| 2020-11-25 12:20:31 | hackage | phonetic-languages-simplified-common 0.3.0.0 - A simplified version of the phonetic-languages-functionality https://hackage.haskell.org/package/phonetic-languages-simplified-common-0.3.0.0 (OleksandrZhabenko) |
| 2020-11-25 12:21:32 | → | watt877 joins (~watt877@124.123.105.4) |
| 2020-11-25 12:22:30 | × | Stanley00 quits (~stanley00@unaffiliated/stanley00) (Remote host closed the connection) |
| 2020-11-25 12:23:57 | × | ClaudiusMaximus quits (~claude@unaffiliated/claudiusmaximus) (Read error: Connection reset by peer) |
| 2020-11-25 12:26:01 | × | watt877 quits (~watt877@124.123.105.4) (Ping timeout: 264 seconds) |
| 2020-11-25 12:28:15 | → | geowiesnot joins (~user@i15-les02-ix2-87-89-181-157.sfr.lns.abo.bbox.fr) |
| 2020-11-25 12:31:44 | × | Franciman quits (~francesco@host-82-54-193-143.retail.telecomitalia.it) (Quit: Leaving) |
| 2020-11-25 12:38:01 | hackage | servant-exceptions 0.2.1 - Extensible exceptions for servant APIs https://hackage.haskell.org/package/servant-exceptions-0.2.1 (ch1bo) |
| 2020-11-25 12:39:01 | hackage | servant-exceptions-server 0.2.1 - Extensible exceptions for servant API servers https://hackage.haskell.org/package/servant-exceptions-server-0.2.1 (ch1bo) |
| 2020-11-25 12:39:15 | × | LKoen quits (~LKoen@169.244.88.92.rev.sfr.net) (Quit: “It’s only logical. First you learn to talk, then you learn to think. Too bad it’s not the other way round.”) |
| 2020-11-25 12:40:31 | hackage | phonetic-languages-simplified-properties-lists 0.1.0.0 - A generalization of the uniqueness-periods-vector-properties package. https://hackage.haskell.org/package/phonetic-languages-simplified-properties-lists-0.1.0.0 (OleksandrZhabenko) |
| 2020-11-25 12:41:31 | → | invaser joins (~Thunderbi@31.148.23.125) |
| 2020-11-25 12:45:23 | → | Nahra joins (~Nahra@unaffiliated/nahra) |
| 2020-11-25 12:48:17 | → | mpereira joins (~mpereira@2a02:810d:f40:d96:f587:a442:5e3:1e55) |
| 2020-11-25 12:48:50 | × | cfricke quits (~cfricke@unaffiliated/cfricke) (Quit: WeeChat 2.9) |
| 2020-11-25 12:49:46 | → | psamim joins (samimpmatr@gateway/shell/matrix.org/x-tqcirtqddpnlomkh) |
| 2020-11-25 12:50:21 | → | n0042 joins (d055ed89@208.85.237.137) |
| 2020-11-25 12:51:59 | <n0042> | Hello folks. I have been experimenting with Data.Vector and I have noticed that it uses a lot of the same function names as the list class, which leads to complaints from ghc. How do you guys typically handle that? Should I call each function explicitly like `Data.Vector.length` or is there a one-liner to overwrite the normal commands in a program |
| 2020-11-25 12:52:00 | <n0042> | that will be using Vectors for everything? |
| 2020-11-25 12:52:23 | <dminuoso> | n0042: The common style is to use qualified imports |
| 2020-11-25 12:52:30 | <dminuoso> | import qualified Data.Vector as V |
| 2020-11-25 12:52:38 | <dminuoso> | Alternatively you can also hide imports from Prelude |
| 2020-11-25 12:52:50 | <n0042> | Excellent. Thank you very mcuh dminuoso |
| 2020-11-25 12:53:03 | <n0042> | *much |
| 2020-11-25 12:53:07 | <[exa]> | like, it is pretty common that if anyone writes V.length you just assume that's the vector length |
| 2020-11-25 12:53:23 | <[exa]> | same for other containers, M as Data.Map, S as Data.Set, etc |
| 2020-11-25 12:53:25 | dminuoso | usually imports Data.ByteString as V and Data.Vector as BS. |
| 2020-11-25 12:53:33 | dminuoso | then invites [exa] to fix his code |
| 2020-11-25 12:53:38 | <[exa]> | please no why |
| 2020-11-25 12:53:44 | <n0042> | ll |
| 2020-11-25 12:53:47 | <n0042> | *lol |
| 2020-11-25 12:54:00 | <dminuoso> | [exa]: Recall the tree parsing problem btw? |
| 2020-11-25 12:54:04 | <n0042> | Thank you both. I'll use those approaches. |
| 2020-11-25 12:54:09 | × | olligobber quits (~olligobbe@unaffiliated/olligobber) (Ping timeout: 265 seconds) |
| 2020-11-25 12:54:21 | <[exa]> | dminuoso: yeah, how did that end up? |
| 2020-11-25 12:54:25 | <dminuoso> | [exa]: Strangely I had another similar problem shortly after, and now I have the *real* solution. Rather than a whacky stupid stateful parser... |
| 2020-11-25 12:54:27 | <dminuoso> | you know... |
| 2020-11-25 12:54:29 | <dminuoso> | build a trie. |
| 2020-11-25 12:54:34 | <dminuoso> | done :> |
| 2020-11-25 12:54:54 | <[exa]> | hell yeah tries |
| 2020-11-25 12:55:10 | <[exa]> | cool |
| 2020-11-25 12:55:43 | <[exa]> | btw I saw some Trie packages like 2 days ago, great there are good data structures for that now |
| 2020-11-25 12:55:59 | <[exa]> | s/data structures/container implementations/ ..so |
| 2020-11-25 12:56:32 | <dminuoso> | Well, Im just finding out that general trie implementations dont make much sense |
All times are in UTC.