2024-07-02 00:05:11 +0200 | CrunchyFlakes | (~CrunchyFl@146.52.130.128) (Quit: ZNC 1.8.2 - https://znc.in) |
2024-07-02 00:05:45 +0200 | CrunchyFlakes | (~CrunchyFl@ip92348280.dynamic.kabel-deutschland.de) |
2024-07-02 00:12:07 +0200 | __monty__ | (~toonn@user/toonn) (Quit: leaving) |
2024-07-02 00:17:51 +0200 | mikess | (~mikess@user/mikess) (Ping timeout: 255 seconds) |
2024-07-02 00:20:12 +0200 | target_i | (~target_i@user/target-i/x-6023099) (Quit: leaving) |
2024-07-02 00:22:26 +0200 | sawilagar | (~sawilagar@user/sawilagar) (Ping timeout: 268 seconds) |
2024-07-02 00:38:05 +0200 | emm | (~emm@user/edmeme) (Ping timeout: 256 seconds) |
2024-07-02 00:52:17 +0200 | acidjnk_new3 | (~acidjnk@p200300d6e72cfb4649ca0157bfe844d2.dip0.t-ipconnect.de) (Ping timeout: 272 seconds) |
2024-07-02 01:05:46 +0200 | mreh | (~matthew@host86-160-168-12.range86-160.btcentralplus.com) |
2024-07-02 01:09:22 +0200 | poscat | (~poscat@user/poscat) (Ping timeout: 246 seconds) |
2024-07-02 01:12:13 +0200 | mreh | (~matthew@host86-160-168-12.range86-160.btcentralplus.com) (Ping timeout: 256 seconds) |
2024-07-02 01:15:54 +0200 | poscat | (~poscat@user/poscat) |
2024-07-02 01:24:33 +0200 | gmg | (~user@user/gehmehgeh) (Quit: Leaving) |
2024-07-02 01:48:40 +0200 | Taneb | (~Taneb@runciman.hacksoc.org) (Quit: I seem to have stopped.) |
2024-07-02 01:53:31 +0200 | mikess | (~mikess@user/mikess) |
2024-07-02 01:54:43 +0200 | euleritian | (~euleritia@ip4d16fc38.dynamic.kabel-deutschland.de) (Ping timeout: 256 seconds) |
2024-07-02 01:54:53 +0200 | Square | (~Square@user/square) (Ping timeout: 240 seconds) |
2024-07-02 01:55:02 +0200 | Unicorn_Princess | (~Unicorn_P@user/Unicorn-Princess/x-3540542) (Remote host closed the connection) |
2024-07-02 01:56:11 +0200 | <oo_miguel> | Trying to figure out how to create [a->b] from a->[b]. Appears like this should be straightforward. |
2024-07-02 01:57:13 +0200 | <EvanR> | @djinn (a->[b]) -> [a->b] |
2024-07-02 01:57:13 +0200 | <lambdabot> | Error: Undefined type [] |
2024-07-02 01:58:53 +0200 | <EvanR> | the problem is, how long should that list be |
2024-07-02 01:59:28 +0200 | <oo_miguel> | same length as the list returned by the first function |
2024-07-02 01:59:31 +0200 | <EvanR> | :t \f -> map (\i x -> f x !! i) [0..] |
2024-07-02 01:59:32 +0200 | <lambdabot> | (t -> [a]) -> [t -> a] |
2024-07-02 01:59:51 +0200 | <EvanR> | you can't call the first function without an argument |
2024-07-02 01:59:56 +0200 | <EvanR> | catch 22 |
2024-07-02 02:00:17 +0200 | <oo_miguel> | but the type does not carry any information about the length |
2024-07-02 02:00:24 +0200 | <EvanR> | here's another "solution" |
2024-07-02 02:00:30 +0200 | <EvanR> | :t \f -> [] |
2024-07-02 02:00:31 +0200 | <lambdabot> | p -> [a] |
2024-07-02 02:00:54 +0200 | <EvanR> | :t \f -> [] :: (a -> [b]) -> [a -> b] |
2024-07-02 02:00:55 +0200 | <lambdabot> | error: |
2024-07-02 02:00:55 +0200 | <lambdabot> | • Couldn't match expected type ‘(a1 -> [b1]) -> [a1 -> b1]’ |
2024-07-02 02:00:55 +0200 | <lambdabot> | with actual type ‘[a0]’ |
2024-07-02 02:01:59 +0200 | <EvanR> | what if f returns [] |
2024-07-02 02:02:42 +0200 | <EvanR> | then the result is an empty list, and no function can be called, there is no argument |
2024-07-02 02:02:49 +0200 | <EvanR> | it's a paradoxical function |
2024-07-02 02:02:57 +0200 | <oo_miguel> | I am looking for something like that one you posted above: \f -> map (\i x -> f x !! i) [0..]. but this will obviously fail if the returned list is not infinite |
2024-07-02 02:03:28 +0200 | <EvanR> | you might be thinking you look into the future, and see what f x is |
2024-07-02 02:03:39 +0200 | <EvanR> | which determines the size of [0..] |
2024-07-02 02:03:42 +0200 | machinedgod | (~machinedg@d173-183-246-216.abhsia.telus.net) (Ping timeout: 256 seconds) |
2024-07-02 02:03:58 +0200 | <EvanR> | perhaps you can do it with the tardis monad xD |
2024-07-02 02:04:30 +0200 | <haskellbridge> | <iqubic (she/her)> Are we trying to write a function of type "(a -> [b]) -> [a -> b]"? |
2024-07-02 02:06:26 +0200 | it_ | (~quassel@v2202212189510211193.supersrv.de) (Quit: No Ping reply in 180 seconds.) |
2024-07-02 02:06:39 +0200 | <haskellbridge> | <iqubic (she/her)> EvanR: This is probably more in depth than in needs to be, but here we're using the "a" in negative position only, and you can't summon a value of type "a" from nowhere. |
2024-07-02 02:06:42 +0200 | <oo_miguel> | @EvanR; if "f x" returns "[ ]" i want to get [] |
2024-07-02 02:06:43 +0200 | <lambdabot> | Unknown command, try @list |
2024-07-02 02:07:39 +0200 | it_ | (~quassel@v2202212189510211193.supersrv.de) |
2024-07-02 02:07:42 +0200 | <haskellbridge> | <iqubic (she/her)> oo_miguel: Where does x come from? Who supplies that value? |
2024-07-02 02:08:39 +0200 | <oo_miguel> | let me try to rephrase my question.. given a function with one parameter that returns a list.. i want to get a list of fucntions of one parameter that return values analgously |
2024-07-02 02:08:54 +0200 | <oo_miguel> | so lets say : |
2024-07-02 02:08:54 +0200 | <oo_miguel> | f something = [1,2,3] |
2024-07-02 02:09:51 +0200 | <oo_miguel> | I wnat to get a list of functions [a,b,c] ... ouch |
2024-07-02 02:09:52 +0200 | <oo_miguel> | ok |
2024-07-02 02:10:05 +0200 | <oo_miguel> | guess I seee now what the problem is |
2024-07-02 02:11:09 +0200 | <oo_miguel> | thanks EvanR & haskellbridge , for claryfying |
2024-07-02 02:11:10 +0200 | <ncf> | list distributes over reader, not the other way around |
2024-07-02 02:11:30 +0200 | <haskellbridge> | <iqubic (she/her)> Yes... That's a way to explain it. |
2024-07-02 02:12:33 +0200 | <haskellbridge> | <iqubic (she/her)> ncf: Does that mean that it's possible to write something of the type "[a -> b] -> a -> [b]". |
2024-07-02 02:13:03 +0200 | <ncf> | :t sequence |
2024-07-02 02:13:04 +0200 | <lambdabot> | (Traversable t, Monad m) => t (m a) -> m (t a) |
2024-07-02 02:13:35 +0200 | <haskellbridge> | <iqubic (she/her)> :t \fs x -> map (\f -> f x) fs |
2024-07-02 02:13:41 +0200 | <ncf> | :t distribute -- or: |
2024-07-02 02:13:42 +0200 | <lambdabot> | error: |
2024-07-02 02:13:42 +0200 | <lambdabot> | • Variable not in scope: distribute |
2024-07-02 02:13:42 +0200 | <lambdabot> | • Perhaps you meant ‘distrib’ (imported from Control.Lens) |
2024-07-02 02:13:48 +0200 | <ncf> | fuck |
2024-07-02 02:13:55 +0200 | <haskellbridge> | <iqubic (she/her)> Why does lambdabot hate me? |
2024-07-02 02:13:58 +0200 | <ncf> | :t Data.Distributive.distribute |
2024-07-02 02:13:59 +0200 | <lambdabot> | (Data.Distributive.Distributive g, Functor f) => f (g a) -> g (f a) |
2024-07-02 02:14:08 +0200 | <geekosaur> | haskellbridge puts a prefix in front of your messages, @iqubic. (it doesn't puppet on the IRC end) |
2024-07-02 02:14:21 +0200 | <haskellbridge> | <iqubic (she/her)> Right... I see. |
2024-07-02 02:14:23 +0200 | <geekosaur> | % :t sequence @[] |
2024-07-02 02:14:24 +0200 | <yahb2> | sequence @[] :: Monad m => [m a] -> m [a] |
2024-07-02 02:14:42 +0200 | <geekosaur> | % :t sequence @[] @((->) _) |
2024-07-02 02:14:42 +0200 | <yahb2> | sequence @[] @((->) _) :: Monad ((->) w) => [w -> a] -> w -> [a] |
2024-07-02 02:15:19 +0200 | <haskellbridge> | <iqubic (she/her)> \fs x -> map (\f -> f x) fs should have the type of "[a -> b] -> a -> [b}" though. |
2024-07-02 02:15:43 +0200 | <ncf> | yes that's what sequence does |
2024-07-02 02:16:18 +0200 | <haskellbridge> | <iqubic (she/her)> Right... and you cannot got the other way, because you can't pluck a value of type a out of thin air. |
2024-07-02 02:16:22 +0200 | <ncf> | (it's not like there's more than one way to do it...) |
2024-07-02 02:16:58 +0200 | <ncf> | well i guess there is, you could mess with the list |
2024-07-02 02:17:16 +0200 | <haskellbridge> | <iqubic (she/her)> Right... |
2024-07-02 02:17:55 +0200 | <haskellbridge> | <iqubic (she/her)> ncf: You can also technically do "\fs a -> []" |
2024-07-02 02:21:42 +0200 | <geekosaur> | you could also add a Monoid constraint to a so you can use `mempty` to manufacture a value, but that's unlikely to give you useful results |
2024-07-02 02:22:09 +0200 | <geekosaur> | (or `Default`, with the same caveat) |
2024-07-02 02:23:45 +0200 | emmanuelux | (~emmanuelu@user/emmanuelux) |
2024-07-02 02:26:35 +0200 | <ncf> | in any case you won't get an actual distributive law |
2024-07-02 02:28:16 +0200 | <oo_miguel> | what makes me wonder.. just theoratically assuming I would know the length of the list returned by f, would the following (posted by EvanR above) work: |
2024-07-02 02:28:16 +0200 | <oo_miguel> | \f -> map (\i x -> f x !! i) [0..99] |
2024-07-02 02:29:24 +0200 | Tuplanolla | (~Tuplanoll@91-159-69-59.elisa-laajakaista.fi) (Quit: Leaving.) |
2024-07-02 02:30:59 +0200 | <monochrom> | @type \f -> map (\i x -> f x !! i) [0..99] |
2024-07-02 02:31:00 +0200 | <lambdabot> | (t -> [a]) -> [t -> a] |
2024-07-02 02:32:08 +0200 | <monochrom> | yeah |
2024-07-02 02:33:07 +0200 | <geekosaur> | looks very brute force, though, and might rerun `f x` for each index |
2024-07-02 02:33:14 +0200 | <ncf> | yes, because lists of length n are representable (by Fin n), so you're just using the fact that flip :: (t → Fin n → a) → (Fin n → t → a) is a distributive law for (t →) over (Fin n →) |
2024-07-02 02:33:57 +0200 | <Leary> | oo_miguel: If you want to produce `n` outputs, then `f` must satisfy `length (f x) >= n` for all `x`. |
2024-07-02 02:34:37 +0200 | <monochrom> | It is a strange question in the first place. |
2024-07-02 02:35:18 +0200 | <oo_miguel> | yeah right. let's forget about it. I will redesign my initial solution. Thanks for all the constructive answers |
2024-07-02 02:36:35 +0200 | <ncf> | it's not like the excluded middle would change anything :p |
2024-07-02 02:44:13 +0200 | euleritian | (~euleritia@dynamic-176-004-131-157.176.4.pool.telefonica.de) |
2024-07-02 02:55:47 +0200 | robotsnowfall | (~robotsnow@user/robotsnowfall) (Quit: ZNC 1.9.0 - https://znc.in) |
2024-07-02 02:56:49 +0200 | euleritian | (~euleritia@dynamic-176-004-131-157.176.4.pool.telefonica.de) (Ping timeout: 246 seconds) |
2024-07-02 02:59:00 +0200 | euleritian | (~euleritia@dynamic-176-004-131-157.176.4.pool.telefonica.de) |
2024-07-02 03:33:51 +0200 | puke | (~puke@user/puke) (Quit: puke) |
2024-07-02 03:39:31 +0200 | waleee | (~waleee@h-176-10-144-38.NA.cust.bahnhof.se) (Ping timeout: 246 seconds) |
2024-07-02 03:40:08 +0200 | rvalue | (~rvalue@user/rvalue) (Ping timeout: 256 seconds) |
2024-07-02 03:44:35 +0200 | fryguybob | (~fryguybob@syn-024-094-050-022.res.spectrum.com) (Quit: leaving) |
2024-07-02 03:46:01 +0200 | rvalue | (~rvalue@user/rvalue) |
2024-07-02 03:48:49 +0200 | puke | (~puke@user/puke) |
2024-07-02 03:50:24 +0200 | danse-nr3 | (~danse-nr3@151.37.108.131) |
2024-07-02 03:58:25 +0200 | robotsnowfall | (~robotsnow@user/robotsnowfall) |