Newest at the top
2024-05-01 21:46:55 +0200 | noumenon | (~noumenon@113.51-175-156.customer.lyse.net) |
2024-05-01 21:44:31 +0200 | <mauke> | ^ monochrom's code basically says: "you don't get to choose an s; you must give me a polymorphic value that works with all possible choices of s" |
2024-05-01 21:44:29 +0200 | AlexNoo_ | (~AlexNoo@94.233.240.47) (Client Quit) |
2024-05-01 21:44:29 +0200 | AlexNoo_ | (~AlexNoo@94.233.240.47) |
2024-05-01 21:43:42 +0200 | <monochrom> | I don't have time to further explain the advanced answer if you don't understand it. |
2024-05-01 21:43:22 +0200 | <monochrom> | If you want an advanced answer, if you really want goo to take that parameter, then "goo :: (forall s. ST s (STRef s [Int])) -> [Int]" |
2024-05-01 21:43:20 +0200 | <mauke> | and that's not valid as an argument to runST |
2024-05-01 21:43:00 +0200 | <mauke> | that is, there could be some specific type T and someone could create a value of type ST T (STRef T [Int]) and pass it to goo |
2024-05-01 21:42:41 +0200 | <monochrom> | If you want an elementary answer, goo should not take that parameter. |
2024-05-01 21:42:06 +0200 | <mauke> | the way goo is declared, the caller of goo gets to choose an 's' |
2024-05-01 21:41:36 +0200 | <mauke> | it just passes through whatever s it gets |
2024-05-01 21:41:22 +0200 | <mauke> | readSTRef has no special requirements on s |
2024-05-01 21:41:11 +0200 | <mauke> | depends |
2024-05-01 21:41:07 +0200 | <lambdabot> | STRef s a -> ST s a |
2024-05-01 21:41:06 +0200 | <mauke> | :t readSTRef |
2024-05-01 21:40:57 +0200 | <Guest67> | Does readSTRef ref not return a value that's fully polymorphic in s? |
2024-05-01 21:40:46 +0200 | <mauke> | but goo does not |
2024-05-01 21:40:37 +0200 | <mauke> | runST requires its argument to be fully polymorphic in s |
2024-05-01 21:40:15 +0200 | <lambdabot> | (forall s. ST s a) -> a |
2024-05-01 21:40:14 +0200 | <mauke> | :t runST |
2024-05-01 21:39:58 +0200 | <mauke> | goo's type looks sus |
2024-05-01 21:38:40 +0200 | <Guest67> | In foo, that's not supposed to be a smiley face, it's supposed to be "(0 : )" |
2024-05-01 21:38:16 +0200 | <Guest67> | readSTRef ref |
2024-05-01 21:38:16 +0200 | <Guest67> | foo ref |
2024-05-01 21:38:15 +0200 | <Guest67> | ref <- x — type error here |
2024-05-01 21:38:15 +0200 | <Guest67> | goo x = runST $ do |
2024-05-01 21:38:14 +0200 | <Guest67> | goo :: ST s (STRef s [Int]) -> [Int] |
2024-05-01 21:38:14 +0200 | <Guest67> | foo ref = modifySTRef ref (0 :) |
2024-05-01 21:38:13 +0200 | <Guest67> | foo :: STRef s [Int] -> ST s () |
2024-05-01 21:38:13 +0200 | <Guest67> | x = newSTRef $ [1..10] |
2024-05-01 21:38:12 +0200 | <Guest67> | x :: ST s (STRef s [Int]) |
2024-05-01 21:38:12 +0200 | <Guest67> | Could anyone help me understand why this code doesn’t work/what the correct way of achieving this sort of functionality is? The type error lies with the parameter x in goo, when I left-arrow bind it to ref. |
2024-05-01 21:35:41 +0200 | Guest67 | (~Guest67@129.170.197.127) |
2024-05-01 21:34:02 +0200 | Batzy | (~quassel@user/batzy) |
2024-05-01 21:14:44 +0200 | malte | (~malte@mal.tc) |
2024-05-01 21:14:12 +0200 | tessd | (~test@evw199.neoplus.adsl.tpnet.pl) |
2024-05-01 21:13:34 +0200 | malte | (~malte@mal.tc) (Remote host closed the connection) |
2024-05-01 21:11:00 +0200 | madeleine-sydney | (~madeleine@c-76-155-235-153.hsd1.co.comcast.net) |
2024-05-01 21:09:46 +0200 | michalz | (~michalz@185.246.207.200) |
2024-05-01 21:09:15 +0200 | emmanuelux | (~emmanuelu@user/emmanuelux) |
2024-05-01 21:07:11 +0200 | michalz | (~michalz@185.246.207.218) (Client Quit) |
2024-05-01 21:05:43 +0200 | michalz | (~michalz@185.246.207.218) |
2024-05-01 21:02:40 +0200 | michalz | (~michalz@185.246.207.218) (Client Quit) |
2024-05-01 21:00:51 +0200 | michalz | (~michalz@185.246.207.218) |
2024-05-01 20:52:57 +0200 | euleritian | (~euleritia@ip4d16fc38.dynamic.kabel-deutschland.de) |
2024-05-01 20:52:32 +0200 | euleritian | (~euleritia@ip4d16fc38.dynamic.kabel-deutschland.de) (Read error: Connection reset by peer) |
2024-05-01 20:52:32 +0200 | danza | (~francesco@151.19.252.90) (Ping timeout: 260 seconds) |
2024-05-01 20:51:07 +0200 | euleritian | (~euleritia@ip4d16fc38.dynamic.kabel-deutschland.de) |
2024-05-01 20:50:16 +0200 | euleritian | (~euleritia@ip4d16fc38.dynamic.kabel-deutschland.de) (Read error: Connection reset by peer) |
2024-05-01 20:40:53 +0200 | peterbecich | (~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 268 seconds) |