2022-01-07 00:01:01 +0100 | <dmj`> | Inst: a@(x:xs) will never match on the empty list, so null a will never be called, it will pattern match failure instead |
2022-01-07 00:01:13 +0100 | <Inst> | thanks |
2022-01-07 00:02:31 +0100 | xb0o2 | (~xb0o2@user/xb0o2) |
2022-01-07 00:03:52 +0100 | deadmarshal | (~deadmarsh@95.38.112.110) |
2022-01-07 00:03:54 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
2022-01-07 00:04:25 +0100 | johnw | (~johnw@2607:f6f0:3004:1:c8b4:50ff:fef8:6bf0) |
2022-01-07 00:04:53 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) |
2022-01-07 00:05:51 +0100 | <Inst> | monochrom: more about flexing |
2022-01-07 00:06:00 +0100 | <dmj`> | geekosaur: fclabels didn't need existentials :) |
2022-01-07 00:07:14 +0100 | <monochrom> | What did fclabels need? |
2022-01-07 00:07:35 +0100 | <Inst> | gah, maybe i'll try again later |
2022-01-07 00:07:36 +0100 | <Inst> | too tired |
2022-01-07 00:08:14 +0100 | <dmj`> | monochrom: nothing basically, but chooses to use TypeOperators |
2022-01-07 00:14:12 +0100 | <[itchyjunk]> | myMap :: (a -> b) -> [a] -> [b], does this type signature look okay? |
2022-01-07 00:14:31 +0100 | <monochrom> | Yes. |
2022-01-07 00:14:42 +0100 | <[itchyjunk]> | I don't understand the error I am getting : https://bpa.st/Z42Q |
2022-01-07 00:15:24 +0100 | <monochrom> | Cannot reproduce. |
2022-01-07 00:15:38 +0100 | sonny | (~sonny@bras-base-london1483w-grc-32-70-52-175-166.dsl.bell.ca) |
2022-01-07 00:16:56 +0100 | <geekosaur> | I feel like you used parentheses where you weren't supposed to. Show how you're invoking it? |
2022-01-07 00:17:15 +0100 | <[itchyjunk]> | *Main> myMap +1 [1..5] |
2022-01-07 00:17:21 +0100 | <[itchyjunk]> | :x |
2022-01-07 00:17:25 +0100 | <monochrom> | myMap (+ 1) [1..5] |
2022-01-07 00:17:26 +0100 | Vajb | (~Vajb@2001:999:50:e6be:1e98:9376:d93e:4506) (Remote host closed the connection) |
2022-01-07 00:17:28 +0100 | <sonny> | section requires parens right? |
2022-01-07 00:17:38 +0100 | <[itchyjunk]> | what's section? |
2022-01-07 00:17:42 +0100 | <[itchyjunk]> | hmm was that the only issue? |
2022-01-07 00:17:43 +0100 | Vajb | (~Vajb@2001:999:50:e6be:1e98:9376:d93e:4506) |
2022-01-07 00:17:44 +0100 | <sonny> | +1 |
2022-01-07 00:17:47 +0100 | <monochrom> | (+ 1) and (1 +) |
2022-01-07 00:17:59 +0100 | machinedgod | (~machinedg@24.105.81.50) (Ping timeout: 256 seconds) |
2022-01-07 00:18:01 +0100 | <sonny> | not sure how to describe it |
2022-01-07 00:18:01 +0100 | <[itchyjunk]> | wow, so the code was right and i used it wrong :< |
2022-01-07 00:18:02 +0100 | <monochrom> | > map (+ 1) [1..5] |
2022-01-07 00:18:04 +0100 | <lambdabot> | [2,3,4,5,6] |
2022-01-07 00:18:21 +0100 | <sonny> | haskell does give you that confident feeling ;) |
2022-01-07 00:18:27 +0100 | chele | (~chele@user/chele) (Remote host closed the connection) |
2022-01-07 00:18:39 +0100 | max22- | (~maxime@2a01cb0883359800b8731b08b5ca29d9.ipv6.abo.wanadoo.fr) (Quit: Leaving) |
2022-01-07 00:18:39 +0100 | <geekosaur> | a section is a partially applied operator. It requires parentheses to distinguish it from a normal application |
2022-01-07 00:18:49 +0100 | <geekosaur> | so `map + 1` looks like adding 1 to the function map |
2022-01-07 00:19:07 +0100 | <geekosaur> | but `map (+1)` is mapping a partially applied addition operator |
2022-01-07 00:20:19 +0100 | <geekosaur> | (spaces are not relevant here) |
2022-01-07 00:20:31 +0100 | <geekosaur> | :t map +1 |
2022-01-07 00:20:32 +0100 | <lambdabot> | Num ((a -> b) -> [a] -> [b]) => (a -> b) -> [a] -> [b] |
2022-01-07 00:20:53 +0100 | <geekosaur> | not the weird constraint |
2022-01-07 00:20:56 +0100 | <geekosaur> | *note |
2022-01-07 00:21:11 +0100 | Morrow | (~user@bzq-110-168-31-106.red.bezeqint.net) |
2022-01-07 00:21:19 +0100 | <[itchyjunk]> | ah |
2022-01-07 00:22:05 +0100 | <sonny> | [itchyjunk] what's => |
2022-01-07 00:23:14 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) |
2022-01-07 00:23:14 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) (Changing host) |
2022-01-07 00:23:14 +0100 | wroathe | (~wroathe@user/wroathe) |
2022-01-07 00:24:13 +0100 | deadmarshal | (~deadmarsh@95.38.112.110) (Ping timeout: 256 seconds) |
2022-01-07 00:24:53 +0100 | <[itchyjunk]> | in the type signatuer? i haven't learned the constraint stuff yet xD |
2022-01-07 00:25:14 +0100 | <[itchyjunk]> | you can apply constraints to the function with it |
2022-01-07 00:25:19 +0100 | <[itchyjunk]> | i think |
2022-01-07 00:25:46 +0100 | <geekosaur> | in this case it would be asserting that the type of `map` must have a Num instance (which it doesn't, being a function) |
2022-01-07 00:25:47 +0100 | <Heffalump[m]> | A simpler example of something with a constraint is |
2022-01-07 00:25:47 +0100 | <Heffalump[m]> | (+) :: Num a => a -> a -> a |
2022-01-07 00:26:14 +0100 | <Heffalump[m]> | which just says "+" works on any type that happens to be an instance of the Num class. |
2022-01-07 00:26:18 +0100 | <geekosaur> | Haskell will happily let you do that right up until you try to use it and it discovers there is no Num instance for that type |
2022-01-07 00:26:38 +0100 | <[itchyjunk]> | ah |
2022-01-07 00:27:11 +0100 | <geekosaur> | anyway, Num is what lets us treat Int, Integer, Float, and Double (and some others) the same way instead of having to have separate addition and multiplication operators for each |
2022-01-07 00:27:13 +0100 | <sonny> | ok, so Num is the typeclass? |
2022-01-07 00:27:32 +0100 | polyphem_ | (~rod@2a02:810d:640:776c:e450:3ca3:b389:687a) |
2022-01-07 00:27:40 +0100 | <geekosaur> | SML used to require a different addition operator for floats and doubles, which was pretty icky |
2022-01-07 00:27:53 +0100 | <sonny> | yeah, that's really strict |
2022-01-07 00:27:55 +0100 | Morrow | (~user@bzq-110-168-31-106.red.bezeqint.net) (Quit: leaving) |
2022-01-07 00:27:59 +0100 | <geekosaur> | `1 + 2`, but `1.0 +. 2.0` |
2022-01-07 00:28:44 +0100 | polyphem | (~rod@2a02:810d:640:776c:e450:3ca3:b389:687a) (Ping timeout: 252 seconds) |
2022-01-07 00:29:12 +0100 | merijn | (~merijn@83-160-49-249.ip.xs4all.nl) |
2022-01-07 00:29:15 +0100 | <[itchyjunk]> | Num is an interface iirc |
2022-01-07 00:29:38 +0100 | <geekosaur> | not quite, but somewhat close |
2022-01-07 00:30:03 +0100 | <[itchyjunk]> | I am still stuck with keeping a counter through recursion |
2022-01-07 00:30:08 +0100 | gehmehgeh | (~user@user/gehmehgeh) (Quit: Leaving) |
2022-01-07 00:30:15 +0100 | <monochrom> | Don't keep a counter. |
2022-01-07 00:30:27 +0100 | <[itchyjunk]> | i wany a myTupels :: [a] -> [(Int,a)] where the int represents the position of each element |
2022-01-07 00:30:54 +0100 | <Heffalump[m]> | this is a standard idiom: zip [1..] xs |
2022-01-07 00:30:55 +0100 | <geekosaur> | think about it differently |
2022-01-07 00:30:57 +0100 | <sonny> | monochrom it's the accumulator |
2022-01-07 00:30:59 +0100 | <monochrom> | Oh OK, keep a counter. |
2022-01-07 00:31:18 +0100 | <[itchyjunk]> | hmm i'll try thinking about it differently |
2022-01-07 00:31:48 +0100 | <[itchyjunk]> | i was thinking : myTuples (x:xs) = (count,x) : myTuples xs might work if i could keep track of count but i'd have to pass that around which isn't ideal |
2022-01-07 00:31:53 +0100 | Midjak | (~Midjak@may53-1-78-226-116-92.fbx.proxad.net) (Quit: This computer has gone to sleep) |
2022-01-07 00:32:34 +0100 | <monochrom> | If you know how to achieve "f n = [n, n+1, n+2, ...]", it is the same idea. |
2022-01-07 00:32:55 +0100 | <[itchyjunk]> | hmm, idk if i do. guess i'll do that first |
2022-01-07 00:33:04 +0100 | <[itchyjunk]> | oh wait |
2022-01-07 00:33:06 +0100 | <monochrom> | You will have to "pass that around". |
2022-01-07 00:34:03 +0100 | <geekosaur> | there's an idiom for that too. foo xs = go 0 xs where go cnt [] = ...; go cnt (x:xs) = ... |
2022-01-07 00:34:34 +0100 | <geekosaur> | and on recursion you add 1 to the cnt you pass to the recursive call |
2022-01-07 00:34:59 +0100 | werneta | (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) (Ping timeout: 256 seconds) |
2022-01-07 00:35:35 +0100 | Morrow | (~user@bzq-110-168-31-106.red.bezeqint.net) |
2022-01-07 00:35:39 +0100 | <[itchyjunk]> | hmm f :: Int -> [Int] |
2022-01-07 00:35:40 +0100 | Morrow | (~user@bzq-110-168-31-106.red.bezeqint.net) (Client Quit) |
2022-01-07 00:35:50 +0100 | <[itchyjunk]> | f x = x : f (x+1), i thought this might work. |
2022-01-07 00:35:57 +0100 | Morrow | (~user@bzq-110-168-31-106.red.bezeqint.net) |
2022-01-07 00:36:15 +0100 | <geekosaur> | it might, depending on what you intend "work" to be |
2022-01-07 00:36:34 +0100 | <[itchyjunk]> | <interactive>:16:1: error: Variable not in scope: f :: Integer -> t |
2022-01-07 00:36:36 +0100 | <geekosaur> | > let f x = x : f (x+1) in take 5 (f 4) |
2022-01-07 00:36:37 +0100 | <lambdabot> | [4,5,6,7,8] |
2022-01-07 00:36:44 +0100 | epolanski | (uid312403@id-312403.helmsley.irccloud.com) (Quit: Connection closed for inactivity) |
2022-01-07 00:36:50 +0100 | werneta | (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) |
2022-01-07 00:37:31 +0100 | <geekosaur> | show what you actually did to get that error |
2022-01-07 00:37:59 +0100 | bitdex | (~bitdex@gateway/tor-sasl/bitdex) |
2022-01-07 00:38:20 +0100 | <[itchyjunk]> | https://bpa.st/WPWQ |
2022-01-07 00:38:47 +0100 | <geekosaur> | you're being bitten by ghci |
2022-01-07 00:38:54 +0100 | <[itchyjunk]> | hmm |
2022-01-07 00:39:01 +0100 | <geekosaur> | you need to enter the type signature and the function on the same line, with a semicolon between them |
2022-01-07 00:39:15 +0100 | <geekosaur> | ghci can't tell you're going to enter the actual function next |
2022-01-07 00:39:25 +0100 | <[itchyjunk]> | ah let me do it in a file as always |
2022-01-07 00:39:34 +0100 | <Axman6> | or you can use :{ to start a multi line definition and :} to close it |
2022-01-07 00:39:41 +0100 | <[itchyjunk]> | argh infinite list, it works |
2022-01-07 00:39:47 +0100 | <Axman6> | :{ |
2022-01-07 00:39:53 +0100 | <Axman6> | f :: Int -> [Int] |
2022-01-07 00:40:01 +0100 | <monochrom> | Ugh no, "f :: Int -> [Int]" leads to an error message that says "Int" not "Integer" nor "t". |
2022-01-07 00:40:03 +0100 | <Axman6> | f x = x : f (x+1) |
2022-01-07 00:40:05 +0100 | <Axman6> | :} |
2022-01-07 00:40:25 +0100 | <monochrom> | "f x = x : f (x+1)" does not lead to any error message. |
2022-01-07 00:40:37 +0100 | <monochrom> | "f 0" under that does not lead to any error message either. |
2022-01-07 00:40:43 +0100 | <monochrom> | So, again, cannot reproduce. |
2022-01-07 00:40:49 +0100 | <[itchyjunk]> | Yes it's fixed now |
2022-01-07 00:41:51 +0100 | <[itchyjunk]> | so back to :: [a] ->[(Int,a)] problem. for the f :: Int -> [Int] , i passed an int to the function which it was incrimenting |
2022-01-07 00:42:19 +0100 | <monochrom> | So make a helper function that has the extra Int parameter. |
2022-01-07 00:42:21 +0100 | <[itchyjunk]> | but for mine, i am only passing it some list, it would have to start with some var and add 1 to it each time or somesuc |
2022-01-07 00:42:37 +0100 | <geekosaur> | I showed an example of how we do that earlier |
2022-01-07 00:42:47 +0100 | <geekosaur> | [06 23:34:03] <geekosaur> there's an idiom for that too. foo xs = go 0 xs where go cnt [] = ...; go cnt (x:xs) = ... |
2022-01-07 00:42:54 +0100 | bitdex | (~bitdex@gateway/tor-sasl/bitdex) (Ping timeout: 276 seconds) |
2022-01-07 00:43:42 +0100 | <[itchyjunk]> | hmmmm |
2022-01-07 00:43:57 +0100 | <geekosaur> | `go` is a helper function, as monochrom said |
2022-01-07 00:44:16 +0100 | <geekosaur> | since it's defined in a where clause, there's no particular reason to give it a fancy name |
2022-01-07 00:44:57 +0100 | shapr | (~user@2601:7c0:c202:5190:e39f:2980:57ec:6939) (Ping timeout: 240 seconds) |
2022-01-07 00:45:26 +0100 | <Axman6> | what as this function supposed to do [itchyjunk]? |
2022-01-07 00:46:02 +0100 | <Axman6> | given [1,1,1,2,2,3], what should I get back? |
2022-01-07 00:46:21 +0100 | <Axman6> | are we doing run length encoding? just ziping indices? |
2022-01-07 00:46:41 +0100 | <[itchyjunk]> | [(0,1), (1,1), (2,1), (3,2), (4,2), (5,3)] |
2022-01-07 00:47:17 +0100 | <[itchyjunk]> | I am trying to work my way up to problem 2 here : |
2022-01-07 00:47:18 +0100 | <[itchyjunk]> | http://www.cas.mcmaster.ca/~dalvescb/LH_Week05_Exercises.pdf |
2022-01-07 00:47:28 +0100 | <Axman6> | ok, then the suggestion of writing a worker (go) and a wrapper is a good idea |
2022-01-07 00:47:48 +0100 | <[itchyjunk]> | I am trying to understand the helper go function :x |
2022-01-07 00:47:56 +0100 | _xor | (~xor@dsl-50-5-233-169.fuse.net) (Quit: bbiab) |
2022-01-07 00:48:23 +0100 | <monochrom> | go 4 [x,y,z] = [(x,4), (y,5), (z,6)] |
2022-01-07 00:48:32 +0100 | <[itchyjunk]> | ah |
2022-01-07 00:48:51 +0100 | <[itchyjunk]> | i think i get it |
2022-01-07 00:48:54 +0100 | [itchyjunk] | tries stuff |
2022-01-07 00:49:03 +0100 | <Axman6> | (or [(4,x),(5,y),(6,z)] with the above type) |
2022-01-07 00:49:17 +0100 | <monochrom> | This is why I grew out of using either words or precise formulas to explain to beginners. |
2022-01-07 00:49:40 +0100 | <monochrom> | The most effective communication is semi-concrete semi-symbolic examples. |
2022-01-07 00:49:51 +0100 | <monochrom> | Such as "map f [x,y,z] = [f x, f y, f z]" |
2022-01-07 00:50:06 +0100 | dsrt^ | (~dsrt@207.5.21.20) (Read error: Connection reset by peer) |
2022-01-07 00:50:19 +0100 | <monochrom> | As opposed to "it applies f to every element" or writing out the code. |
2022-01-07 00:50:24 +0100 | xb0o2 | (~xb0o2@user/xb0o2) (Quit: Client closed) |
2022-01-07 00:52:05 +0100 | vicfred | (~vicfred@user/vicfred) |
2022-01-07 00:52:12 +0100 | <monochrom> | Well, in the case of "map f", the wording is short enough to be probably understandable by beginners. But you will run into larger cases where the wording is so lengthy, the beginner simply stops reading. |
2022-01-07 00:52:19 +0100 | machinedgod | (~machinedg@24.105.81.50) |
2022-01-07 00:52:36 +0100 | <Axman6> | that opne of the reasons I usually ask "what output do you expect for <this> input?" |
2022-01-07 00:52:58 +0100 | <Axman6> | that's one* |
2022-01-07 00:52:59 +0100 | <[itchyjunk]> | This is what my helper ended up looking like |
2022-01-07 00:52:59 +0100 | <[itchyjunk]> | https://bpa.st/CF6Q |
2022-01-07 00:53:01 +0100 | <[itchyjunk]> | seems to work |
2022-01-07 00:53:42 +0100 | <monochrom> | Yeah, like that. |
2022-01-07 00:53:46 +0100 | <Axman6> | Looks pretty good to me |
2022-01-07 00:54:50 +0100 | <[itchyjunk]> | https://bpa.st/HPNA |
2022-01-07 00:55:00 +0100 | <Axman6> | there are other (actually infinite) ways to write that, but this is one of the most clear. There are different ways that Haskellers might prefer to use though, we tend to avoid explicit recursion unless it's necessary |
2022-01-07 00:55:02 +0100 | <[itchyjunk]> | this works /o\. think i am ready to tackle that problem 2 now |
2022-01-07 00:55:25 +0100 | <[itchyjunk]> | hmm what's explicit vs implicit recursion? |
2022-01-07 00:55:30 +0100 | <[itchyjunk]> | Don't think I know the difference |
2022-01-07 00:55:30 +0100 | <Axman6> | usually we would define that `go` function in a where clause of `myTuples` |
2022-01-07 00:55:40 +0100 | <[itchyjunk]> | ah |
2022-01-07 00:55:56 +0100 | <Axman6> | unless it's also useful for other things too |
2022-01-07 00:56:28 +0100 | <geekosaur> | explicit recursion is what you have been writing. implicit recursion is using a function that does the recursion internally, like map or foldr |
2022-01-07 00:56:43 +0100 | <Axman6> | I think for now you can ignore that there are other ways to do what you've done, it's pretty likely you'll start to see some patterns and think "Can I write that pattern once and reuse it?" |
2022-01-07 00:59:59 +0100 | bitdex | (~bitdex@gateway/tor-sasl/bitdex) |
2022-01-07 01:03:27 +0100 | merijn | (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 256 seconds) |
2022-01-07 01:07:43 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
2022-01-07 01:07:57 +0100 | kupi | (uid212005@id-212005.hampstead.irccloud.com) (Quit: Connection closed for inactivity) |
2022-01-07 01:08:08 +0100 | <[itchyjunk]> | https://bpa.st/2WEA |
2022-01-07 01:08:26 +0100 | <[itchyjunk]> | Here, i want to apply f to the resulting list after applying myTuples |
2022-01-07 01:08:51 +0100 | <[itchyjunk]> | So apply myTuples to x, take the first element of this list and apply f to it, is how i am thinking |
2022-01-07 01:09:19 +0100 | <[itchyjunk]> | oh wait i see an issue already |
2022-01-07 01:09:55 +0100 | <Axman6> | I have two questions for you: what is the type of `x`? what is the type of `ys`? |
2022-01-07 01:10:03 +0100 | <[itchyjunk]> | Ah, nm. i thought of a different approach |
2022-01-07 01:10:16 +0100 | doyougnu | (~doyougnu@c-73-25-202-122.hsd1.or.comcast.net) (Ping timeout: 256 seconds) |
2022-01-07 01:10:33 +0100 | <[itchyjunk]> | x is a list [a], ys is a [(Int,a)] looking list |
2022-01-07 01:10:43 +0100 | <[itchyjunk]> | i think i have an idea though |
2022-01-07 01:11:06 +0100 | <[itchyjunk]> | wait, not i don't xD |
2022-01-07 01:11:39 +0100 | <Axman6> | so you have mapWithIndex f x = f y : mapWithIndex f ys, and based on what you said above, x and ys have different types, yes? |
2022-01-07 01:12:35 +0100 | <Axman6> | have you ever seen a function with the type (a -> b) -> [a] -> [b]? |
2022-01-07 01:12:40 +0100 | <[itchyjunk]> | yes in my code, the ys is giving me the problem |
2022-01-07 01:12:51 +0100 | <[itchyjunk]> | i would need to pass the [a] type instead of ys type there |
2022-01-07 01:12:57 +0100 | pretty_dumm_guy | (trottel@gateway/vpn/protonvpn/prettydummguy/x-88029655) (Quit: WeeChat 3.4) |
2022-01-07 01:13:04 +0100 | <[itchyjunk]> | yes i have seem map |
2022-01-07 01:13:13 +0100 | <[itchyjunk]> | i also implementd a myMap with that type earlier |
2022-01-07 01:13:31 +0100 | <Axman6> | do you think you could use it here? |
2022-01-07 01:13:45 +0100 | <[itchyjunk]> | Use map itself? |
2022-01-07 01:13:45 +0100 | <Axman6> | you have a way to turn [a] -> [(Int,a)] |
2022-01-07 01:14:03 +0100 | <[itchyjunk]> | i thought of using map but not sure if that's cheating or not |
2022-01-07 01:14:05 +0100 | <Axman6> | and you have myMap :: (a -> b) -> [a] -> [b] right? |
2022-01-07 01:14:17 +0100 | <[itchyjunk]> | i can map f myTuples(x) |
2022-01-07 01:14:18 +0100 | <Axman6> | if you wrote the code, it's definitely not cheating |
2022-01-07 01:14:25 +0100 | <Axman6> | can you? |
2022-01-07 01:14:35 +0100 | <[itchyjunk]> | hmm |
2022-01-07 01:14:58 +0100 | <Axman6> | also, it's worth pointing out now that we don't call functions like that in HAskell, myTuples(x) means myTuples (x) which is myTuples x |
2022-01-07 01:15:10 +0100 | <Axman6> | to pass x to my tuples, you just use a space |
2022-01-07 01:15:44 +0100 | <[itchyjunk]> | map f (myTuples x) |
2022-01-07 01:15:46 +0100 | <Axman6> | if you need to ensure that is understood as a single expression, you can use (myTuples x) |
2022-01-07 01:15:52 +0100 | <Axman6> | does it work? |
2022-01-07 01:16:00 +0100 | <[itchyjunk]> | i haven't tried, let me try it now |
2022-01-07 01:17:27 +0100 | <[itchyjunk]> | it compiles but idk how to test it @_@ |
2022-01-07 01:17:39 +0100 | <[itchyjunk]> | mapWithIndex ? [1..10] |
2022-01-07 01:17:53 +0100 | <ProfSimm> | Actually... why not have mutable local variables/ |
2022-01-07 01:17:54 +0100 | <Axman6> | (\(i,x) -> x*i) |
2022-01-07 01:18:13 +0100 | <Axman6> | ProfSimm: what does local mean? |
2022-01-07 01:18:46 +0100 | <[itchyjunk]> | https://bpa.st/YEWA |
2022-01-07 01:18:48 +0100 | <jackdk> | Axman6: inside of a `runST`? `0:-)` |
2022-01-07 01:18:53 +0100 | <ProfSimm> | Axman6: that's a good question |
2022-01-07 01:18:54 +0100 | <[itchyjunk]> | I don't think i understand the problem statement very well :( |
2022-01-07 01:19:00 +0100 | <Axman6> | ssshhh, we're getting there :P |
2022-01-07 01:19:08 +0100 | <[itchyjunk]> | i think i have a solution but idk how to test it |
2022-01-07 01:19:23 +0100 | <Axman6> | [itchyjunk]: I gave you a function above to use for ? |
2022-01-07 01:19:36 +0100 | <[itchyjunk]> | oh |
2022-01-07 01:19:50 +0100 | <jackdk> | [itchyjunk]: use ghci? Also the equation at line 18 is redundant, as `myMap` handles empty lists |
2022-01-07 01:20:04 +0100 | <Axman6> | what result do you expect to get for mapWithIndex (\(i,x) -> x*i) [1..10]? |
2022-01-07 01:20:51 +0100 | <[itchyjunk]> | [0,2,6,..] |
2022-01-07 01:20:58 +0100 | wyrd | (~wyrd@gateway/tor-sasl/wyrd) (Quit: Lost terminal) |
2022-01-07 01:21:03 +0100 | <[itchyjunk]> | 90 as the last element |
2022-01-07 01:21:57 +0100 | <[itchyjunk]> | ah, right i guess the [] handeling is redundent |
2022-01-07 01:22:05 +0100 | <[itchyjunk]> | Axman6, i get what i expect |
2022-01-07 01:22:13 +0100 | <[itchyjunk]> | [0,2,6,12,20,30,42,56,72,90] |
2022-01-07 01:22:17 +0100 | <Square> | I had a File.hs with instances a,b,c of verbose instances over data types. I found i could generate "a" and "b" of these instances with TH. So i add a $(buildMyInstances ..) to same file. But now i got dependency issues as "a" and "b" depends on "c" and "c" depends on "a". |
2022-01-07 01:22:49 +0100 | <Square> | I had a File.hs with verbose instances a,b,c. * |
2022-01-07 01:23:26 +0100 | <[itchyjunk]> | guess my solution works \o/ |
2022-01-07 01:23:41 +0100 | <Square> | is there some trick to enjoy some 2-pass compilation even with TH generation? |
2022-01-07 01:24:43 +0100 | <Axman6> | ProfSimm: it turns out that you can do what you're asking for, but it's not a straight forward as you might expect. laziness makes this particularly difficult |
2022-01-07 01:24:49 +0100 | wyrd | (~wyrd@gateway/tor-sasl/wyrd) |
2022-01-07 01:25:35 +0100 | Tuplanolla | (~Tuplanoll@91-159-69-90.elisa-laajakaista.fi) (Quit: Leaving.) |
2022-01-07 01:26:34 +0100 | <Axman6> | Square: with TH, the order of definitions matters - that looks like it might not be possible if there's a cyclic dep though. can you do all the definitions in TH in the same spot? |
2022-01-07 01:27:22 +0100 | <Square> | Axman6, im afraid not. I guess i need to change plan |
2022-01-07 01:31:00 +0100 | <jackdk> | It may be possible to mix TH and .hs-boot files, but that's for a braver soul than I |
2022-01-07 01:33:37 +0100 | merijn | (~merijn@83-160-49-249.ip.xs4all.nl) |
2022-01-07 01:34:36 +0100 | deadmarshal | (~deadmarsh@95.38.112.110) |
2022-01-07 01:34:58 +0100 | merijn | (~merijn@83-160-49-249.ip.xs4all.nl) (Client Quit) |
2022-01-07 01:38:37 +0100 | deadmarshal | (~deadmarsh@95.38.112.110) (Ping timeout: 240 seconds) |
2022-01-07 01:38:37 +0100 | justsomeguy | (~justsomeg@user/justsomeguy) (Ping timeout: 240 seconds) |
2022-01-07 01:40:47 +0100 | baltrobob | (~baltrobob@p200300f03f1e516a1063109df4bd766d.dip0.t-ipconnect.de) |
2022-01-07 01:40:52 +0100 | sonny | (~sonny@bras-base-london1483w-grc-32-70-52-175-166.dsl.bell.ca) (Ping timeout: 256 seconds) |
2022-01-07 01:43:16 +0100 | sonny | (~sonny@bras-base-london1483w-grc-32-70-52-175-166.dsl.bell.ca) |
2022-01-07 01:45:21 +0100 | <dmj`> | monochrom: can't a free monad library be written w/o existentials though |
2022-01-07 01:46:07 +0100 | <Axman6> | or without an existential crisis? |
2022-01-07 01:46:13 +0100 | <Axman6> | Seems hard |
2022-01-07 01:46:48 +0100 | sonny | (~sonny@bras-base-london1483w-grc-32-70-52-175-166.dsl.bell.ca) () |
2022-01-07 01:47:18 +0100 | TonyStone | (~TonyStone@cpe-74-76-51-197.nycap.res.rr.com) (Remote host closed the connection) |
2022-01-07 01:49:01 +0100 | acidjnk | (~acidjnk@p200300d0c7271e249cd77df40fde183d.dip0.t-ipconnect.de) (Ping timeout: 240 seconds) |
2022-01-07 01:49:01 +0100 | acidjnk_new3 | (~acidjnk@p200300d0c7271e249cd77df40fde183d.dip0.t-ipconnect.de) (Ping timeout: 240 seconds) |
2022-01-07 01:50:32 +0100 | jgeerds | (~jgeerds@55d4ac73.access.ecotel.net) (Ping timeout: 240 seconds) |
2022-01-07 01:51:41 +0100 | baltrobob | (~baltrobob@p200300f03f1e516a1063109df4bd766d.dip0.t-ipconnect.de) (Quit: Client closed) |
2022-01-07 01:52:51 +0100 | <ProfSimm> | Axman6: I was thinking what if we could reuse names by basically internally appending counts to them (so if I declare X three times internally it's X1, X2, X3) |
2022-01-07 01:53:04 +0100 | <ProfSimm> | Axman6: but it becomes weird in some cases |
2022-01-07 01:55:35 +0100 | TonyStone | (~TonyStone@2603-7080-8607-c36a-9cdb-69bc-753b-1e50.res6.spectrum.com) |
2022-01-07 01:57:36 +0100 | ProfSimm | (~ProfSimm@87.227.196.109) (Remote host closed the connection) |
2022-01-07 01:57:46 +0100 | <Axman6> | you might want to look a the ST monad, it gives you genuine mutatable variables in a way that guarantees that things are pure from the outside |
2022-01-07 01:58:13 +0100 | <geekosaur> | they just quit |
2022-01-07 01:59:13 +0100 | ouestbillie | (~gallup@192-222-138-215.qc.cable.ebox.net) (Remote host closed the connection) |
2022-01-07 01:59:49 +0100 | <EvanR> | does the word concatenate imply joining two things with discrete pieces, like a string or list |
2022-01-07 02:00:24 +0100 | <EvanR> | or does it work for solids, shapes |
2022-01-07 02:01:08 +0100 | <geekosaur> | I think for those you need to say how you;re combining them |
2022-01-07 02:04:12 +0100 | mvk | (~mvk@2607:fea8:5cdd:f000::45db) |
2022-01-07 02:07:21 +0100 | machinedgod | (~machinedg@24.105.81.50) (Ping timeout: 256 seconds) |
2022-01-07 02:09:49 +0100 | dudek | (~dudek@185.150.236.156) (Quit: Leaving) |
2022-01-07 02:12:07 +0100 | albet70 | (~xxx@2400:8902::f03c:92ff:fe60:98d8) (Remote host closed the connection) |
2022-01-07 02:14:21 +0100 | lavaman | (~lavaman@98.38.249.169) |
2022-01-07 02:16:59 +0100 | kaph | (~kaph@net-2-38-107-19.cust.vodafonedsl.it) (Ping timeout: 256 seconds) |
2022-01-07 02:18:14 +0100 | albet70 | (~xxx@2400:8902::f03c:92ff:fe60:98d8) |
2022-01-07 02:18:26 +0100 | eastbillie | (~gallup@192-222-138-215.qc.cable.ebox.net) (Remote host closed the connection) |
2022-01-07 02:19:00 +0100 | kaph | (~kaph@net-2-38-107-19.cust.vodafonedsl.it) |
2022-01-07 02:21:55 +0100 | sonny | (~sonny@bras-base-london1483w-grc-32-70-52-175-166.dsl.bell.ca) |
2022-01-07 02:22:33 +0100 | <sonny> | [itchyjunk] how is this function used? |
2022-01-07 02:23:37 +0100 | cosimone | (~user@2001:b07:ae5:db26:c24a:d20:4d91:1e20) |
2022-01-07 02:24:03 +0100 | <sonny> | seems like it's just to transform a single element in the list |
2022-01-07 02:27:19 +0100 | eggplantade | (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
2022-01-07 02:28:32 +0100 | FinnElija | (~finn_elij@user/finn-elija/x-0085643) (Remote host closed the connection) |
2022-01-07 02:28:56 +0100 | FinnElija | (~finn_elij@user/finn-elija/x-0085643) |
2022-01-07 02:30:44 +0100 | wyrd_ | (~wyrd@gateway/tor-sasl/wyrd) |
2022-01-07 02:32:06 +0100 | wyrd | (~wyrd@gateway/tor-sasl/wyrd) (Ping timeout: 276 seconds) |
2022-01-07 02:32:26 +0100 | raehik | (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 256 seconds) |
2022-01-07 02:33:09 +0100 | wyrd_ | (~wyrd@gateway/tor-sasl/wyrd) (Client Quit) |
2022-01-07 02:33:10 +0100 | eggplantade | (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
2022-01-07 02:34:55 +0100 | <sonny> | can you list a lambda function parameters in a definition? |
2022-01-07 02:35:17 +0100 | wyrd | (~wyrd@gateway/tor-sasl/wyrd) |
2022-01-07 02:37:28 +0100 | <dmj`> | sonny: what would that look like |
2022-01-07 02:38:24 +0100 | <sonny> | mapWithIndex \((idx, elem)) lst = ... |
2022-01-07 02:38:48 +0100 | <EvanR> | what on earth |
2022-01-07 02:39:29 +0100 | <[itchyjunk]> | sonny, idk how it's used |
2022-01-07 02:39:38 +0100 | <[itchyjunk]> | sonny, the one gives to me here to test was |
2022-01-07 02:39:44 +0100 | <sonny> | not sure how else to interpret "mapWithIndex is just like map, however it takes a function that takes a tuple with the corresponding index of the element in list" |
2022-01-07 02:40:02 +0100 | <[itchyjunk]> | <Axman6> what result do you expect to get for mapWithIndex (\(i,x) -> x*i) [1..10]? |
2022-01-07 02:40:59 +0100 | <sonny> | [1..i..10] -> [1..i*x..10] |
2022-01-07 02:41:18 +0100 | <[itchyjunk]> | hmm? |
2022-01-07 02:41:45 +0100 | <[itchyjunk]> | [0,2,6,12,20,30,42,56,72,90] |
2022-01-07 02:41:47 +0100 | <sonny> | I think it just gives you a new list with the element at position i updated |
2022-01-07 02:41:48 +0100 | <[itchyjunk]> | this is the result |
2022-01-07 02:42:07 +0100 | <[itchyjunk]> | did you end up writing the function in problem 2? |
2022-01-07 02:42:14 +0100 | <sonny> | that's just map ... |
2022-01-07 02:42:22 +0100 | <sonny> | I am trying to understand problem 2 now |
2022-01-07 02:42:46 +0100 | <dmj`> | sonny: what is the type of elem |
2022-01-07 02:42:51 +0100 | <[itchyjunk]> | how is it map? map :: (a->b)-> [a] -> [b] |
2022-01-07 02:43:07 +0100 | <[itchyjunk]> | this one is ((Int,a) -> b) -> [a] -> [b] |
2022-01-07 02:43:17 +0100 | Inst | (~delicacie@c-98-208-218-119.hsd1.fl.comcast.net) (Ping timeout: 240 seconds) |
2022-01-07 02:43:17 +0100 | <[itchyjunk]> | so not quite map |
2022-01-07 02:43:18 +0100 | <sonny> | dmj`: `((Int,a) -> b) -> [a] -> [b]` |
2022-01-07 02:44:37 +0100 | <sonny> | oh ok |
2022-01-07 02:44:38 +0100 | <EvanR> | mapWithIndex devolves into map if you choose not to use the Int |
2022-01-07 02:44:57 +0100 | <sonny> | I think I sorta get what it's asking |
2022-01-07 02:45:40 +0100 | vysn | (~vysn@user/vysn) |
2022-01-07 02:45:54 +0100 | jakalx | (~jakalx@base.jakalx.net) (Error from remote client) |
2022-01-07 02:46:18 +0100 | <sonny> | nvm, I'm super confused |
2022-01-07 02:46:22 +0100 | <[itchyjunk]> | sonny, did you mean this is a higher order function? |
2022-01-07 02:46:26 +0100 | jakalx | (~jakalx@base.jakalx.net) |
2022-01-07 02:46:36 +0100 | <[itchyjunk]> | sonny, i used map as a solution in mine. i wrote my own map and used it |
2022-01-07 02:46:46 +0100 | <[itchyjunk]> | i helped me understand things better |
2022-01-07 02:47:02 +0100 | <sonny> | higher order function? |
2022-01-07 02:47:40 +0100 | <[itchyjunk]> | isn't that what it's called? map take in function as an input so we call it higher order function right? |
2022-01-07 02:47:49 +0100 | <sonny> | nah |
2022-01-07 02:47:51 +0100 | <[itchyjunk]> | not sure if i am remembering things properly anymore xD |
2022-01-07 02:47:54 +0100 | <sonny> | it's just a function |
2022-01-07 02:48:08 +0100 | <sonny> | unless there is some math terminology |
2022-01-07 02:48:18 +0100 | <[itchyjunk]> | think i was learning map because it was higher order function |
2022-01-07 02:48:23 +0100 | <[itchyjunk]> | math calls it functionals i think |
2022-01-07 02:48:30 +0100 | <[itchyjunk]> | programming calls it higher order functions? |
2022-01-07 02:48:37 +0100 | <[itchyjunk]> | like (\x.xx) (\x.xx) |
2022-01-07 02:48:40 +0100 | <sonny> | no? |
2022-01-07 02:49:20 +0100 | <[itchyjunk]> | https://en.wikipedia.org/wiki/Higher-order_function |
2022-01-07 02:49:25 +0100 | <sonny> | well, I'm probably not the one to ask |
2022-01-07 02:49:26 +0100 | Gurkenglas | (~Gurkengla@dslb-002-203-144-204.002.203.pools.vodafone-ip.de) (Ping timeout: 256 seconds) |
2022-01-07 02:49:45 +0100 | <sonny> | but yeah I don't get what mapWithIndex is supposed to do |
2022-01-07 02:49:56 +0100 | <[itchyjunk]> | it takes 2 parameter |
2022-01-07 02:49:59 +0100 | <[itchyjunk]> | a function and a list |
2022-01-07 02:50:01 +0100 | <[itchyjunk]> | and returns a list |
2022-01-07 02:50:07 +0100 | <[itchyjunk]> | its a higher order function |
2022-01-07 02:50:16 +0100 | <[itchyjunk]> | similar to map |
2022-01-07 02:50:21 +0100 | <sonny> | ok |
2022-01-07 02:50:35 +0100 | <[itchyjunk]> | thats why i reimplremented map |
2022-01-07 02:50:48 +0100 | <[itchyjunk]> | to understand a function that can take a function as parameter |
2022-01-07 02:50:52 +0100 | <sonny> | yeah I don't get what's different |
2022-01-07 02:51:20 +0100 | <[itchyjunk]> | (a -> b) -> [a] -> [b], (a->b) is a function |
2022-01-07 02:51:38 +0100 | <sonny> | yes |
2022-01-07 02:51:54 +0100 | <EvanR> | [itchyjunk], yes, in the old days higher order functions would be this awesome thing |
2022-01-07 02:52:04 +0100 | <EvanR> | by I mean, javascript can do it, not that special |
2022-01-07 02:52:07 +0100 | <EvanR> | but* |
2022-01-07 02:52:22 +0100 | <EvanR> | I mean, C kind of does it |
2022-01-07 02:52:30 +0100 | <EvanR> | pointer to function |
2022-01-07 02:52:33 +0100 | <[itchyjunk]> | i saw it in table of contents of a haskell book so i figured its one of those things that you have to learn |
2022-01-07 02:52:42 +0100 | <sonny> | {(a->b) -> [a]} -> [b] |
2022-01-07 02:52:48 +0100 | <[itchyjunk]> | i don't have the attention to read a book so making due with table of contents xD |
2022-01-07 02:53:01 +0100 | <[itchyjunk]> | sonny, idk what that is |
2022-01-07 02:53:01 +0100 | <EvanR> | map :: (a -> b) -> ([a] -> [b]) |
2022-01-07 02:53:10 +0100 | <sonny> | that nomenclature might be subject to debate |
2022-01-07 02:53:37 +0100 | <EvanR> | sonny, mapWithIndex just passes the current index along with the value |
2022-01-07 02:53:50 +0100 | <sonny> | [itchyjunk] I was trying to show the order |
2022-01-07 02:54:11 +0100 | <EvanR> | {(a -> b) -> [a]} -> [b] doesn't look right at all |
2022-01-07 02:54:15 +0100 | <[itchyjunk]> | its right associative so it would be (a -> b) -> ([a] -> [b]) i think |
2022-01-07 02:54:21 +0100 | <sonny> | oh |
2022-01-07 02:54:24 +0100 | <[itchyjunk]> | you're doing left associativity for some reason? |
2022-01-07 02:54:30 +0100 | <sonny> | yeah lol |
2022-01-07 02:54:36 +0100 | <sonny> | mistake |
2022-01-07 02:54:51 +0100 | <EvanR> | map has 2 args, if you pass just 1, you are left with [a] -> [b], 1 arg to go |
2022-01-07 02:55:24 +0100 | <[itchyjunk]> | sonny, i make like 6 mini problems and solved it to solve that problem 2 |
2022-01-07 02:55:26 +0100 | <[itchyjunk]> | https://bpa.st/YEWA |
2022-01-07 02:55:43 +0100 | <[itchyjunk]> | each of the function i wrote there, i thought of a mini problem to solve |
2022-01-07 02:56:31 +0100 | <sonny> | EvanR ok, so I just need to make sure that I have the current index? |
2022-01-07 02:56:39 +0100 | <sonny> | otherwise it's the same? |
2022-01-07 02:56:48 +0100 | <EvanR> | I don't know what the actual question is, sorry |
2022-01-07 02:56:56 +0100 | <sonny> | one sec |
2022-01-07 02:57:04 +0100 | <[itchyjunk]> | http://www.cas.mcmaster.ca/~dalvescb/LH_Week05_Exercises.pdf |
2022-01-07 02:57:07 +0100 | <[itchyjunk]> | problem 2) there |
2022-01-07 02:57:30 +0100 | <EvanR> | implement mapWithIndex |
2022-01-07 02:57:51 +0100 | <EvanR> | we've all be repeating the requirements for this function, we're all in agreement, so great xD |
2022-01-07 02:58:02 +0100 | <EvanR> | been* |
2022-01-07 02:58:58 +0100 | sonny | scratches head |
2022-01-07 02:59:25 +0100 | <[itchyjunk]> | :D |
2022-01-07 02:59:28 +0100 | <EvanR> | 1. understand the question 3. write down the solution |
2022-01-07 02:59:31 +0100 | <EvanR> | step 2 is overrated |
2022-01-07 02:59:45 +0100 | <[itchyjunk]> | step 1 is really hard |
2022-01-07 02:59:48 +0100 | <EvanR> | ^ |
2022-01-07 03:03:37 +0100 | Morrow | (~user@bzq-110-168-31-106.red.bezeqint.net) (Remote host closed the connection) |
2022-01-07 03:07:12 +0100 | Morrow | (~user@bzq-110-168-31-106.red.bezeqint.net) |
2022-01-07 03:10:00 +0100 | <EvanR> | >write a quickCheck property to test both simultaneously (i.e check one in terms of the other) |
2022-01-07 03:10:15 +0100 | <EvanR> | does that really succeed in testing both simultaneously |
2022-01-07 03:11:01 +0100 | n8chan | (~nate@108-233-125-227.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 240 seconds) |
2022-01-07 03:11:27 +0100 | spdr | (~bc8147f2@cerf.good1.com) |
2022-01-07 03:12:24 +0100 | ubert1 | (~Thunderbi@p200300ecdf09947d3ce845fd45b74154.dip0.t-ipconnect.de) |
2022-01-07 03:13:25 +0100 | ubert | (~Thunderbi@p200300ecdf0994dbb267d7c5a67baed4.dip0.t-ipconnect.de) (Ping timeout: 240 seconds) |
2022-01-07 03:13:25 +0100 | ubert1 | ubert |
2022-01-07 03:13:39 +0100 | n8chan | (~nate@108-233-125-227.lightspeed.sntcca.sbcglobal.net) |
2022-01-07 03:14:10 +0100 | <jackdk> | it's a test that exercises both at once |
2022-01-07 03:14:10 +0100 | <[itchyjunk]> | is that like unit tests? |
2022-01-07 03:14:37 +0100 | Morrow | (~user@bzq-110-168-31-106.red.bezeqint.net) (Ping timeout: 240 seconds) |
2022-01-07 03:14:45 +0100 | <EvanR> | yeah... though both could be wrong in such a way that cancels out... two wrongs make a right xD |
2022-01-07 03:15:12 +0100 | <EvanR> | oh now I see where they are going with it |
2022-01-07 03:15:33 +0100 | <EvanR> | "who cares as long as *the property* is satisfied" |
2022-01-07 03:16:41 +0100 | Morrow | (~user@147.161.13.151) |
2022-01-07 03:17:58 +0100 | califax- | (~califax@user/califx) |
2022-01-07 03:18:24 +0100 | doyougnu | (~doyougnu@c-73-25-202-122.hsd1.or.comcast.net) |
2022-01-07 03:19:33 +0100 | califax | (~califax@user/califx) (Ping timeout: 276 seconds) |
2022-01-07 03:19:33 +0100 | califax- | califax |
2022-01-07 03:25:08 +0100 | sonny | (~sonny@bras-base-london1483w-grc-32-70-52-175-166.dsl.bell.ca) (Ping timeout: 256 seconds) |
2022-01-07 03:28:07 +0100 | xkuru | (~xkuru@user/xkuru) (Read error: Connection reset by peer) |
2022-01-07 03:28:59 +0100 | eggplantade | (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
2022-01-07 03:31:01 +0100 | kjak | (~kjak@pool-108-45-56-21.washdc.fios.verizon.net) (Ping timeout: 240 seconds) |
2022-01-07 03:31:26 +0100 | neurocyte0917 | (~neurocyte@IP-046243081042.dynamic.medianet-world.de) |
2022-01-07 03:31:26 +0100 | neurocyte0917 | (~neurocyte@IP-046243081042.dynamic.medianet-world.de) (Changing host) |
2022-01-07 03:31:26 +0100 | neurocyte0917 | (~neurocyte@user/neurocyte) |
2022-01-07 03:33:29 +0100 | neurocyte091 | (~neurocyte@user/neurocyte) (Ping timeout: 256 seconds) |
2022-01-07 03:33:29 +0100 | neurocyte0917 | neurocyte091 |
2022-01-07 03:34:35 +0100 | hyiltiz | (~quassel@31.220.5.250) (Quit: hyiltiz) |
2022-01-07 03:35:25 +0100 | xff0x | (~xff0x@2001:1a81:5223:a300:e304:e5b3:98c9:ca79) (Ping timeout: 240 seconds) |
2022-01-07 03:37:36 +0100 | xff0x | (~xff0x@2001:1a81:525f:5800:748a:2b9d:1b8:40fa) |
2022-01-07 03:49:24 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) (Remote host closed the connection) |
2022-01-07 03:49:55 +0100 | Morrow | (~user@147.161.13.151) (Ping timeout: 256 seconds) |
2022-01-07 03:50:07 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
2022-01-07 03:50:54 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) (Remote host closed the connection) |
2022-01-07 03:51:33 +0100 | Morrow | (~user@bzq-110-168-31-106.red.bezeqint.net) |
2022-01-07 03:57:29 +0100 | hyiltiz | (~quassel@31.220.5.250) |
2022-01-07 04:01:58 +0100 | hyiltiz | (~quassel@31.220.5.250) (Ping timeout: 256 seconds) |
2022-01-07 04:04:24 +0100 | hyiltiz | (~quassel@31.220.5.250) |
2022-01-07 04:05:55 +0100 | eggplantade | (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
2022-01-07 04:08:57 +0100 | Morrow | (~user@bzq-110-168-31-106.red.bezeqint.net) (Ping timeout: 240 seconds) |
2022-01-07 04:11:45 +0100 | finn_elija | (~finn_elij@user/finn-elija/x-0085643) |
2022-01-07 04:11:45 +0100 | FinnElija | (~finn_elij@user/finn-elija/x-0085643) (Killed (NickServ (Forcing logout FinnElija -> finn_elija))) |
2022-01-07 04:11:45 +0100 | finn_elija | FinnElija |
2022-01-07 04:13:43 +0100 | geranim0 | (~geranim0@modemcable242.171-178-173.mc.videotron.ca) (Ping timeout: 256 seconds) |
2022-01-07 04:15:12 +0100 | shapr | (~user@2601:7c0:c202:5190:f139:f199:c0b7:ebd5) |
2022-01-07 04:22:14 +0100 | sonny | (~sonny@bras-base-london1483w-grc-32-70-52-175-166.dsl.bell.ca) |
2022-01-07 04:33:39 +0100 | EvanR | (~EvanR@user/evanr) (Quit: Leaving) |
2022-01-07 04:34:31 +0100 | EvanR | (~EvanR@user/evanr) |
2022-01-07 04:34:58 +0100 | arjun | (~arjun@user/arjun) |
2022-01-07 04:36:19 +0100 | Guest32 | (~Guest32@115.98.235.146) |
2022-01-07 04:37:47 +0100 | <Guest32> | hi.. I need to sum all digits of a number till I arrive at a single digit eg 29 = 2+9 =11 =1+1 =2 |
2022-01-07 04:37:56 +0100 | <Guest32> | how to I do it? |
2022-01-07 04:38:41 +0100 | <Guest32> | I have created a function which splits the numbers into a list |
2022-01-07 04:38:44 +0100 | <Guest32> | toDigits x |
2022-01-07 04:38:44 +0100 | <Guest32> | | x < 1 = [] |
2022-01-07 04:38:45 +0100 | <Guest32> | | otherwise = toDigits (div x 10) ++ [mod x 10] |
2022-01-07 04:38:59 +0100 | <EvanR> | nice, see also divMod |
2022-01-07 04:39:13 +0100 | Maxdamantus | (~Maxdamant@user/maxdamantus) (Ping timeout: 256 seconds) |
2022-01-07 04:39:15 +0100 | <EvanR> | > divMod 25 7 |
2022-01-07 04:39:16 +0100 | <lambdabot> | (3,4) |
2022-01-07 04:39:46 +0100 | <int-e> | > divmod (3^2 + 4^2) (3 + 4) |
2022-01-07 04:39:47 +0100 | <lambdabot> | error: |
2022-01-07 04:39:47 +0100 | <lambdabot> | • Variable not in scope: divmod :: t0 -> t1 -> t |
2022-01-07 04:39:47 +0100 | <lambdabot> | • Perhaps you meant one of these: |
2022-01-07 04:39:55 +0100 | <int-e> | > divMod (3^2 + 4^2) (3 + 4) |
2022-01-07 04:39:56 +0100 | <lambdabot> | (3,4) |
2022-01-07 04:40:12 +0100 | Inst | (~delicacie@c-98-208-218-119.hsd1.fl.comcast.net) |
2022-01-07 04:41:14 +0100 | <Guest32> | divMod 23 |
2022-01-07 04:41:22 +0100 | <Guest32> | >divMod 23 |
2022-01-07 04:41:23 +0100 | <EvanR> | :t divMod 23 |
2022-01-07 04:41:24 +0100 | <lambdabot> | Integral a => a -> (a, a) |
2022-01-07 04:41:40 +0100 | <Guest32> | :t divMod 23 |
2022-01-07 04:41:41 +0100 | <lambdabot> | Integral a => a -> (a, a) |
2022-01-07 04:44:15 +0100 | <EvanR> | > echo |
2022-01-07 04:44:16 +0100 | <lambdabot> | echo |
2022-01-07 04:44:27 +0100 | <Guest32> | @Evanr how do I get to a single digit? |
2022-01-07 04:44:27 +0100 | <lambdabot> | Unknown command, try @list |
2022-01-07 04:45:12 +0100 | <EvanR> | you want to just sum all the digits? |
2022-01-07 04:45:18 +0100 | <EvanR> | or all but the last digit |
2022-01-07 04:45:34 +0100 | <EvanR> | or just take the last digit |
2022-01-07 04:45:51 +0100 | shapr | (~user@2601:7c0:c202:5190:f139:f199:c0b7:ebd5) (Remote host closed the connection) |
2022-01-07 04:46:06 +0100 | <Guest32> | all digits |
2022-01-07 04:46:14 +0100 | <Guest32> | till the total gets to one digit |
2022-01-07 04:46:19 +0100 | <EvanR> | > sum [1,2,3,4,5] |
2022-01-07 04:46:21 +0100 | <lambdabot> | 15 |
2022-01-07 04:46:36 +0100 | <EvanR> | > sum (init [1,2,3,4]) |
2022-01-07 04:46:37 +0100 | <lambdabot> | 6 |
2022-01-07 04:46:44 +0100 | <EvanR> | > last [1,2,3,4,5] |
2022-01-07 04:46:45 +0100 | <lambdabot> | 5 |
2022-01-07 04:47:09 +0100 | td_ | (~td@94.134.91.33) (Ping timeout: 256 seconds) |
2022-01-07 04:47:52 +0100 | Maxdamantus | (~Maxdamant@user/maxdamantus) |
2022-01-07 04:47:52 +0100 | <Guest32> | > sum divMod 29 |
2022-01-07 04:47:54 +0100 | <lambdabot> | error: |
2022-01-07 04:47:54 +0100 | <lambdabot> | • No instance for (Foldable ((->) Integer)) |
2022-01-07 04:47:54 +0100 | <lambdabot> | arising from a use of ‘e_129’ |
2022-01-07 04:48:08 +0100 | <Guest32> | divMod 29 |
2022-01-07 04:48:21 +0100 | <EvanR> | divMod takes a divisor and a dividend, two arguments |
2022-01-07 04:48:21 +0100 | <Guest32> | > divMod 29 |
2022-01-07 04:48:23 +0100 | <lambdabot> | <Integer -> (Integer,Integer)> |
2022-01-07 04:48:39 +0100 | <EvanR> | er, dividend, and divisor |
2022-01-07 04:48:44 +0100 | <jackdk> | whoa, functions with a show instance? |
2022-01-07 04:48:47 +0100 | td_ | (~td@94.134.91.64) |
2022-01-07 04:49:04 +0100 | <Guest32> | ok |
2022-01-07 04:49:14 +0100 | <Guest32> | > divMod 29 10 |
2022-01-07 04:49:16 +0100 | <lambdabot> | (2,9) |
2022-01-07 04:49:30 +0100 | <Guest32> | > sum divMod 29 10 |
2022-01-07 04:49:32 +0100 | <lambdabot> | error: |
2022-01-07 04:49:32 +0100 | <lambdabot> | • Couldn't match type ‘(t0, t0)’ with ‘t1 -> t’ |
2022-01-07 04:49:32 +0100 | <lambdabot> | Expected type: t0 -> t0 -> t1 -> t |
2022-01-07 04:49:41 +0100 | <Guest32> | > sum (divMod 29 10) |
2022-01-07 04:49:43 +0100 | <lambdabot> | 9 |
2022-01-07 04:50:07 +0100 | <EvanR> | \o/ |
2022-01-07 04:50:19 +0100 | <Guest32> | shouldn't this be giving 11? |
2022-01-07 04:50:35 +0100 | <EvanR> | divMod doesn't give digits |
2022-01-07 04:51:09 +0100 | <EvanR> | but it does the two things you did to get digits |
2022-01-07 04:52:29 +0100 | <Guest32> | ok |
2022-01-07 04:57:39 +0100 | sirlensalot | (~sirlensal@ool-44c5f8c9.dyn.optonline.net) (Quit: sirlensalot) |
2022-01-07 04:58:37 +0100 | waleee | (~waleee@2001:9b0:21d:fc00:398f:b003:b90d:acf4) (Ping timeout: 240 seconds) |
2022-01-07 05:00:01 +0100 | haasn | (~nand@haasn.dev) (Quit: ZNC 1.7.5+deb4 - https://znc.in) |
2022-01-07 05:01:22 +0100 | haasn | (~nand@haasn.dev) |
2022-01-07 05:02:15 +0100 | Guest32 | (~Guest32@115.98.235.146) (Quit: Client closed) |
2022-01-07 05:04:43 +0100 | shapr | (~user@2601:7c0:c202:5190:ca94:a895:80bc:42cf) |
2022-01-07 05:11:11 +0100 | abarbu | (~user@c-66-31-23-28.hsd1.ma.comcast.net) |
2022-01-07 05:19:29 +0100 | [_] | (~itchyjunk@user/itchyjunk/x-7353470) |
2022-01-07 05:20:05 +0100 | [itchyjunk] | Guest2700 |
2022-01-07 05:26:39 +0100 | mbuf | (~Shakthi@122.178.240.232) |
2022-01-07 05:27:57 +0100 | <abarbu> | How can I avoid type variables leaking out of this code? |
2022-01-07 05:27:58 +0100 | <abarbu> | I want a phantom that is True if any two other variables are True. |
2022-01-07 05:27:58 +0100 | <abarbu> | type family Or (a :: Bool) (b :: Bool) :: Bool where |
2022-01-07 05:28:01 +0100 | <abarbu> | Or True a = True |
2022-01-07 05:28:04 +0100 | <abarbu> | Or a True = True |
2022-01-07 05:28:07 +0100 | <abarbu> | Or False False = False |
2022-01-07 05:28:09 +0100 | <abarbu> | one :: Proxy a |
2022-01-07 05:28:12 +0100 | <abarbu> | one = undefined |
2022-01-07 05:28:15 +0100 | <abarbu> | combine :: Proxy a -> Proxy b -> Proxy (Or a b) |
2022-01-07 05:28:18 +0100 | <abarbu> | combine _ _ = undefined |
2022-01-07 05:28:22 +0100 | <abarbu> | fn = combine one one |
2022-01-07 05:28:28 +0100 | <abarbu> | The type of fn comes out to be fn :: D (GOr a b) |
2022-01-07 05:28:31 +0100 | <abarbu> | Everything works, but the more you use this code, the more it leaks out strangely-named type variables in trees of Or whose structure depends on the internals of the code. Seems like a very poor API. How can I avoid this leakage? |
2022-01-07 05:28:34 +0100 | <abarbu> | Is there some other way to approach this problem? |
2022-01-07 05:31:04 +0100 | deadmarshal | (~deadmarsh@95.38.112.110) |
2022-01-07 05:37:25 +0100 | arjun | (~arjun@user/arjun) (Quit: Leaving) |
2022-01-07 05:41:33 +0100 | wroathe | (~wroathe@user/wroathe) (Ping timeout: 256 seconds) |
2022-01-07 05:42:07 +0100 | bontaq | (~user@ool-45779fe5.dyn.optonline.net) (Ping timeout: 256 seconds) |
2022-01-07 05:48:32 +0100 | cyphase | (~cyphase@user/cyphase) (Ping timeout: 240 seconds) |
2022-01-07 05:56:58 +0100 | <Axman6> | @where paste |
2022-01-07 05:56:58 +0100 | <lambdabot> | Help us help you: please paste full code, input and/or output at e.g. https://paste.tomsmeding.com |
2022-01-07 05:57:53 +0100 | sonny | (~sonny@bras-base-london1483w-grc-32-70-52-175-166.dsl.bell.ca) (Closing Window) |
2022-01-07 06:00:03 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) |
2022-01-07 06:01:46 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) |
2022-01-07 06:01:46 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) (Changing host) |
2022-01-07 06:01:46 +0100 | wroathe | (~wroathe@user/wroathe) |
2022-01-07 06:04:58 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
2022-01-07 06:07:03 +0100 | wroathe | (~wroathe@user/wroathe) (Ping timeout: 256 seconds) |
2022-01-07 06:13:46 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
2022-01-07 06:16:05 +0100 | jiribenes | (~jiribenes@rosa.jiribenes.com) (Remote host closed the connection) |
2022-01-07 06:16:32 +0100 | jiribenes | (~jiribenes@rosa.jiribenes.com) |
2022-01-07 06:25:44 +0100 | cosimone | (~user@2001:b07:ae5:db26:c24a:d20:4d91:1e20) (Remote host closed the connection) |
2022-01-07 06:26:19 +0100 | cosimone | (~user@2001:b07:ae5:db26:c24a:d20:4d91:1e20) |
2022-01-07 06:27:24 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) (Remote host closed the connection) |
2022-01-07 06:27:44 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
2022-01-07 06:28:55 +0100 | slowButPresent | (~slowButPr@user/slowbutpresent) (Quit: leaving) |
2022-01-07 06:32:50 +0100 | Jing | (~hedgehog@2604:a840:3::103c) |
2022-01-07 06:33:17 +0100 | deadmarshal | (~deadmarsh@95.38.112.110) (Ping timeout: 240 seconds) |
2022-01-07 06:33:20 +0100 | phma | (phma@2001:5b0:211b:f778:91c:a71f:b4a2:a400) (Read error: Connection reset by peer) |
2022-01-07 06:35:00 +0100 | phma | (phma@2001:5b0:211c:3a48:e7cb:c702:2cb6:39c) |
2022-01-07 06:43:11 +0100 | shapr | (~user@2601:7c0:c202:5190:ca94:a895:80bc:42cf) (Remote host closed the connection) |
2022-01-07 06:43:25 +0100 | shapr | (~user@2601:7c0:c202:5190:d7e6:1445:a66d:b9b1) |
2022-01-07 06:46:38 +0100 | cods | (~fred@82-65-232-44.subs.proxad.net) (Ping timeout: 268 seconds) |
2022-01-07 06:54:19 +0100 | takuan | (~takuan@178-116-218-225.access.telenet.be) |
2022-01-07 06:59:24 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) (Remote host closed the connection) |
2022-01-07 06:59:44 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
2022-01-07 07:00:08 +0100 | nhatanh02 | (~satori@123.24.172.30) |
2022-01-07 07:05:24 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) (Remote host closed the connection) |
2022-01-07 07:05:42 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
2022-01-07 07:06:43 +0100 | johnw | (~johnw@2607:f6f0:3004:1:c8b4:50ff:fef8:6bf0) (Quit: ZNC - http://znc.in) |
2022-01-07 07:16:37 +0100 | nhatanh02 | (~satori@123.24.172.30) (Ping timeout: 240 seconds) |
2022-01-07 07:28:46 +0100 | FinnElija | (~finn_elij@user/finn-elija/x-0085643) (Remote host closed the connection) |
2022-01-07 07:29:06 +0100 | FinnElija | (~finn_elij@user/finn-elija/x-0085643) |
2022-01-07 07:39:33 +0100 | <hyiltiz> | Happy New Years and hope a safe new year to all! |
2022-01-07 07:42:38 +0100 | nhatanh02 | (~satori@123.24.172.30) |
2022-01-07 07:44:06 +0100 | bitdex | (~bitdex@gateway/tor-sasl/bitdex) (Ping timeout: 276 seconds) |
2022-01-07 07:44:49 +0100 | bitdex | (~bitdex@gateway/tor-sasl/bitdex) |
2022-01-07 07:47:29 +0100 | <hyiltiz> | When did the channel topic started with a r/haskell link? |
2022-01-07 07:48:27 +0100 | cyphase | (~cyphase@user/cyphase) |
2022-01-07 07:48:56 +0100 | cods | (~fred@82-65-232-44.subs.proxad.net) |
2022-01-07 08:02:33 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) |
2022-01-07 08:02:33 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) (Changing host) |
2022-01-07 08:02:33 +0100 | wroathe | (~wroathe@user/wroathe) |
2022-01-07 08:04:07 +0100 | deadmarshal | (~deadmarsh@95.38.112.110) |
2022-01-07 08:07:45 +0100 | wroathe | (~wroathe@user/wroathe) (Ping timeout: 256 seconds) |
2022-01-07 08:11:35 +0100 | spdr | (~bc8147f2@cerf.good1.com) (Quit: CGI:IRC (Session timeout)) |
2022-01-07 08:11:59 +0100 | kaph_ | (~kaph@net-2-38-107-19.cust.vodafonedsl.it) |
2022-01-07 08:14:33 +0100 | kaph | (~kaph@net-2-38-107-19.cust.vodafonedsl.it) (Ping timeout: 256 seconds) |
2022-01-07 08:18:54 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) (Remote host closed the connection) |
2022-01-07 08:19:18 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
2022-01-07 08:19:37 +0100 | zmt01 | (~zmt00@user/zmt00) (Ping timeout: 240 seconds) |
2022-01-07 08:28:37 +0100 | xff0x | (~xff0x@2001:1a81:525f:5800:748a:2b9d:1b8:40fa) (Ping timeout: 240 seconds) |
2022-01-07 08:29:47 +0100 | xff0x | (~xff0x@2001:1a81:525f:5800:1882:d375:707:2176) |
2022-01-07 08:30:15 +0100 | coolnickname | (uid531864@user/coolnickname) |
2022-01-07 08:31:27 +0100 | mc47 | (~mc47@xmonad/TheMC47) |
2022-01-07 08:32:15 +0100 | [itchyjunk] | (~itchyjunk@user/itchyjunk/x-7353470) (Read error: Connection reset by peer) |
2022-01-07 08:35:16 +0100 | Codaraxis_ | (~Codaraxis@user/codaraxis) |
2022-01-07 08:38:37 +0100 | Codaraxis | (~Codaraxis@user/codaraxis) (Ping timeout: 240 seconds) |
2022-01-07 08:54:46 +0100 | simendsjo | (~user@84.211.91.241) |
2022-01-07 08:59:57 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) |
2022-01-07 09:00:24 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) (Remote host closed the connection) |
2022-01-07 09:00:47 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
2022-01-07 09:07:42 +0100 | jumper149 | (~jumper149@base.felixspringer.xyz) |
2022-01-07 09:14:46 +0100 | puke | (~puke@user/puke) |
2022-01-07 09:18:31 +0100 | shriekingnoise | (~shrieking@186.137.144.80) (Quit: Quit) |
2022-01-07 09:21:33 +0100 | jespada_ | (~jespada@87.74.32.18) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
2022-01-07 09:24:36 +0100 | Sgeo_ | (~Sgeo@user/sgeo) (Read error: Connection reset by peer) |
2022-01-07 09:33:19 +0100 | simendsjo | (~user@84.211.91.241) (Ping timeout: 256 seconds) |
2022-01-07 09:33:37 +0100 | shapr | (~user@2601:7c0:c202:5190:d7e6:1445:a66d:b9b1) (Ping timeout: 240 seconds) |
2022-01-07 09:33:38 +0100 | econo | (uid147250@user/econo) (Quit: Connection closed for inactivity) |
2022-01-07 09:35:19 +0100 | zaquest | (~notzaques@5.130.79.72) (Remote host closed the connection) |
2022-01-07 09:37:50 +0100 | zaquest | (~notzaques@5.130.79.72) |
2022-01-07 09:43:46 +0100 | mc47 | (~mc47@xmonad/TheMC47) (Remote host closed the connection) |
2022-01-07 09:43:59 +0100 | Brumaire | (~quassel@37.166.249.26) |
2022-01-07 09:45:53 +0100 | vpan | (~0@212.117.1.172) |
2022-01-07 09:47:34 +0100 | gehmehgeh | (~user@user/gehmehgeh) |
2022-01-07 09:51:01 +0100 | machinedgod | (~machinedg@24.105.81.50) |
2022-01-07 09:53:04 +0100 | mc47 | (~mc47@xmonad/TheMC47) |
2022-01-07 09:53:20 +0100 | Gurkenglas | (~Gurkengla@dslb-002-203-144-204.002.203.pools.vodafone-ip.de) |
2022-01-07 09:53:55 +0100 | cemguresci | (~cemguresc@2001:a61:11ff:a001:2dad:6df8:999e:4708) |
2022-01-07 09:56:12 +0100 | chele | (~chele@user/chele) |
2022-01-07 10:00:08 +0100 | inkbottle[m] | (~inkbottle@2001:470:69fc:105::2ff5) (Quit: You have been kicked for being idle) |
2022-01-07 10:00:21 +0100 | acode | (~acode@dslb-188-100-024-238.188.100.pools.vodafone-ip.de) |
2022-01-07 10:03:23 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) |
2022-01-07 10:03:23 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) (Changing host) |
2022-01-07 10:03:23 +0100 | wroathe | (~wroathe@user/wroathe) |
2022-01-07 10:04:30 +0100 | coot | (~coot@89-64-85-93.dynamic.chello.pl) |
2022-01-07 10:05:12 +0100 | mmhat | (~mmh@55d459b4.access.ecotel.net) |
2022-01-07 10:05:58 +0100 | <juhp> | Missing file: /usr/lib64/ghc-8.10.7/lib/settings |
2022-01-07 10:06:00 +0100 | <juhp> | hmm |
2022-01-07 10:06:13 +0100 | tzh | (~tzh@c-24-21-73-154.hsd1.or.comcast.net) (Quit: zzz) |
2022-01-07 10:06:51 +0100 | <juhp> | I am getting this from stack after replacing ~/.stack/programs/x86_64-linux/ghc-tinfo6-8.10.7 |
2022-01-07 10:08:02 +0100 | <juhp> | The problem being that the file exists... |
2022-01-07 10:08:36 +0100 | wroathe | (~wroathe@user/wroathe) (Ping timeout: 256 seconds) |
2022-01-07 10:08:40 +0100 | <juhp> | Oops no it doesn't ughhh |
2022-01-07 10:09:37 +0100 | Tuplanolla | (~Tuplanoll@91-159-68-11.elisa-laajakaista.fi) |
2022-01-07 10:09:56 +0100 | <juhp> | Ok I need to work a bit harder on this hack, sorry |
2022-01-07 10:16:55 +0100 | geekosaur | (~geekosaur@xmonad/geekosaur) (Read error: Connection reset by peer) |
2022-01-07 10:17:46 +0100 | geekosaur | (~geekosaur@xmonad/geekosaur) |
2022-01-07 10:18:58 +0100 | acode | (~acode@dslb-188-100-024-238.188.100.pools.vodafone-ip.de) (Quit: Client closed) |
2022-01-07 10:22:20 +0100 | <maerwald[m]> | Aha |
2022-01-07 10:23:42 +0100 | puke | (~puke@user/puke) (Remote host closed the connection) |
2022-01-07 10:23:58 +0100 | puke | (~puke@user/puke) |
2022-01-07 10:24:52 +0100 | ubert | (~Thunderbi@p200300ecdf09947d3ce845fd45b74154.dip0.t-ipconnect.de) (Remote host closed the connection) |
2022-01-07 10:25:12 +0100 | <cemguresci> | Hi guys, I am trying to learn data types and I am having some trouble. I run this code in ghci. https://paste.tomsmeding.com/aK5GQ3vV |
2022-01-07 10:25:55 +0100 | <cemguresci> | I wrote the error message in paste as well :D |
2022-01-07 10:26:44 +0100 | _ht | (~quassel@82-169-194-8.biz.kpn.net) |
2022-01-07 10:26:51 +0100 | <[exa]> | cemguresci: why do you use `data` for TimeStamp when it's an alias? |
2022-01-07 10:26:54 +0100 | <cemguresci> | My first intention was actually have an object with timestamp automatically but I couldn't figure it out as well |
2022-01-07 10:26:58 +0100 | <[exa]> | (or looks like you use it as alias to me) |
2022-01-07 10:27:07 +0100 | <[exa]> | you probably want: |
2022-01-07 10:27:20 +0100 | <[exa]> | `data TimeStamp = TimeStamp UTCTime deriving Show` |
2022-01-07 10:27:27 +0100 | <[exa]> | or |
2022-01-07 10:27:40 +0100 | <[exa]> | `type TimeStamp = UTCTime` (no way to do `deriving` here tho) |
2022-01-07 10:28:05 +0100 | <[exa]> | the 2nd variant should work with the rest of the code |
2022-01-07 10:28:54 +0100 | <[exa]> | with the 1st variant you're defining a struct, so you'd need to add a constructor to the use, such as: `test = Test "haskell" (TimeStamp ct)` |
2022-01-07 10:29:16 +0100 | eggplantade | (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
2022-01-07 10:30:21 +0100 | off^ | (~off@207.5.21.20) |
2022-01-07 10:32:34 +0100 | <cemguresci> | exa: whats the difference between `data TimeStamp = TimeStamp UTCTime deriving Show and `data TimeStamp = UTCTime deriving Show ? |
2022-01-07 10:33:04 +0100 | <[exa]> | the second defines that "UTCTime" is a constructor for your empty structure |
2022-01-07 10:33:19 +0100 | <[exa]> | which is probably not what you want |
2022-01-07 10:33:44 +0100 | <[exa]> | the syntax for `data` is: `data TypeName = ConstructorName Content1 Content2 | Constructor2Name Content1 Content2 Content3 | ..." |
2022-01-07 10:34:20 +0100 | Codaraxis__ | (~Codaraxis@user/codaraxis) |
2022-01-07 10:34:24 +0100 | <[exa]> | it defines the TypeName (as the name for the whole thing) and all ConstructorNames (as kinda "functions" that create the type) |
2022-01-07 10:35:04 +0100 | <[exa]> | in your case, the "UTCTime" becomes a constructor for a variant of the TypeName type that has no contents |
2022-01-07 10:35:15 +0100 | Brumaire | (~quassel@37.166.249.26) (Quit: ran away) |
2022-01-07 10:35:36 +0100 | Brumaire | (~quassel@37.166.249.26) |
2022-01-07 10:35:53 +0100 | <[exa]> | it is a bit confusing for newcomers because in so many other languages the constructor names and type names are forcibly same |
2022-01-07 10:36:55 +0100 | <cemguresci> | yes, I am really confused :D |
2022-01-07 10:37:08 +0100 | <[exa]> | Simpler example: `data Bool = False | True` |
2022-01-07 10:37:27 +0100 | <[exa]> | this gives 2 constructors of the type, `False :: Bool` and `True :: Bool` |
2022-01-07 10:37:38 +0100 | <[exa]> | and both variants contain nothing |
2022-01-07 10:37:55 +0100 | <cemguresci> | what do you mean by containing nothing? |
2022-01-07 10:38:03 +0100 | <[exa]> | there are no data fields in there |
2022-01-07 10:38:04 +0100 | Codaraxis_ | (~Codaraxis@user/codaraxis) (Ping timeout: 256 seconds) |
2022-01-07 10:38:19 +0100 | <[exa]> | what's your previous language? |
2022-01-07 10:38:25 +0100 | <cemguresci> | python |
2022-01-07 10:39:20 +0100 | <[exa]> | ah okay I'm not good in Python but you can imagine this e.g. as 2 empty classes True and False that share a common "parent", so they can be used interchangeably |
2022-01-07 10:40:09 +0100 | <cemguresci> | okay, I see |
2022-01-07 10:40:52 +0100 | <[exa]> | a more useful example: `data MaybeNumber = ActualNumber Int | NoNumber` |
2022-01-07 10:41:27 +0100 | <[exa]> | defines 1 structure that contains an integer, 1 structure that doesn't contain anything, and both are of the type MaybeNumber |
2022-01-07 10:41:51 +0100 | <[exa]> | (a more generic parametrized version of this is the standard Maybe, `data Maybe a = Nothing | Just a` |
2022-01-07 10:41:59 +0100 | puke | (~puke@user/puke) (Quit: puke) |
2022-01-07 10:42:37 +0100 | <[exa]> | anyway, in your case the `data TimeStamp = UTCTime` translates to basically `class UTCTime: pass` |
2022-01-07 10:42:40 +0100 | <cemguresci> | awesome, now I understand. |
2022-01-07 10:42:54 +0100 | <cemguresci> | another question. can we use getCurrentTime function in data definition. I want to have timestamp when its defined |
2022-01-07 10:43:13 +0100 | <[exa]> | getCurrentTime has type (IO UTCTime) right? |
2022-01-07 10:43:18 +0100 | <cemguresci> | yes |
2022-01-07 10:43:45 +0100 | <[exa]> | so it's not a "value", but a description of an IO action that you need to explicitly run at a certain point |
2022-01-07 10:43:53 +0100 | Codaraxis_ | (~Codaraxis@user/codaraxis) |
2022-01-07 10:44:10 +0100 | <[exa]> | one way is what you did, `<-` in `do` notation is something that "runs" these actions and gets their results as actual values |
2022-01-07 10:45:00 +0100 | <[exa]> | but there are tools to do that less verbosely, e.g. you can write `Test "haskell" <$> getCurrentTime`, which nicely combines the action with the struct creation |
2022-01-07 10:45:22 +0100 | <[exa]> | (and you get a thing of type `IO Test`, which is the action that creates your whole structure right away) |
2022-01-07 10:45:29 +0100 | max22- | (~maxime@2a01cb088335980037d8471a1d5e7a78.ipv6.abo.wanadoo.fr) |
2022-01-07 10:46:11 +0100 | <[exa]> | (`<$>` is like `$`, but "through some kind of <box>", which is the IO action here) |
2022-01-07 10:46:51 +0100 | <cemguresci> | hmm thats interesting |
2022-01-07 10:47:12 +0100 | <[exa]> | this is one interesting thing about purity in haskell, it forces you to organize the stuff precisely (e.g., no reliance on argument evaluation order as in C's and pythons) |
2022-01-07 10:47:42 +0100 | Codaraxis__ | (~Codaraxis@user/codaraxis) (Ping timeout: 256 seconds) |
2022-01-07 10:47:49 +0100 | <[exa]> | which gets really inconvenient "by default", but there's a lot of the helpers like <$> that magically make it more convenient and safer than in the languages where the action order is kinda implicit |
2022-01-07 10:48:47 +0100 | neurocyte091 | (~neurocyte@user/neurocyte) (Quit: The Lounge - https://thelounge.chat) |
2022-01-07 10:49:11 +0100 | Midjak | (~Midjak@may53-1-78-226-116-92.fbx.proxad.net) |
2022-01-07 10:49:18 +0100 | polyphem_ | (~rod@2a02:810d:640:776c:e450:3ca3:b389:687a) (Quit: WeeChat 3.3) |
2022-01-07 10:49:59 +0100 | neurocyte0917 | (~neurocyte@IP-046243081042.dynamic.medianet-world.de) |
2022-01-07 10:49:59 +0100 | neurocyte0917 | (~neurocyte@IP-046243081042.dynamic.medianet-world.de) (Changing host) |
2022-01-07 10:49:59 +0100 | neurocyte0917 | (~neurocyte@user/neurocyte) |
2022-01-07 10:50:57 +0100 | <cemguresci> | exa: thank you so much teaching some information in this short time. I will do more research |
2022-01-07 10:51:25 +0100 | <[exa]> | the main takeaway is that instead of "running commands" here you compose the "program descriptions" (with types such as `IO xxx`) to make larger program descriptions, and haskell runtime takes the program description in `main` and runs it for you |
2022-01-07 10:52:20 +0100 | <cemguresci> | yes, excatly thats what I feel :D |
2022-01-07 10:52:48 +0100 | Erutuon | (~Erutuon@user/erutuon) (Ping timeout: 256 seconds) |
2022-01-07 10:53:19 +0100 | <[exa]> | btw the `do` notation does just this, most commands are connected with >> (basically a semicolon in imperative languages) or >>= (a semicolon that carries the result) |
2022-01-07 10:53:26 +0100 | <[exa]> | :t putStrLn "a" |
2022-01-07 10:53:27 +0100 | <lambdabot> | IO () |
2022-01-07 10:53:31 +0100 | polyphem | (~rod@2a02:810d:640:776c:e450:3ca3:b389:687a) |
2022-01-07 10:53:47 +0100 | <[exa]> | (IO action that returns "empty type", ie nothing) |
2022-01-07 10:53:57 +0100 | <[exa]> | :t putStrLn "a" >> putStrLn "b" |
2022-01-07 10:53:58 +0100 | <lambdabot> | IO () |
2022-01-07 10:54:09 +0100 | <[exa]> | (2 IO actions combined into one) |
2022-01-07 10:54:22 +0100 | ubert | (~Thunderbi@2a02:8109:9880:303c:de3b:67d7:83e8:947e) |
2022-01-07 10:55:16 +0100 | <[exa]> | :t readLn >>= (\x -> print $ 2*x) |
2022-01-07 10:55:17 +0100 | <lambdabot> | IO () |
2022-01-07 10:55:56 +0100 | user0 | (~aj@154.0.137.32) |
2022-01-07 10:56:00 +0100 | spaceseller | (~spacesell@31.147.205.13) |
2022-01-07 10:56:03 +0100 | <[exa]> | (2 actions combined into one with carrying the result, this is what `do x<-readLn; print (2*x);` looks like without the fancy syntax ) |
2022-01-07 10:56:37 +0100 | user0 | (~aj@154.0.137.32) () |
2022-01-07 10:57:08 +0100 | <cemguresci> | cool stuff :D |
2022-01-07 10:58:22 +0100 | <[exa]> | and well, eventually someone will tell you that all stuff that can be combined in such way belongs to a wider, infamously named category of composable computations :D |
2022-01-07 10:58:23 +0100 | <juhp> | okay I made this to create stack program symlinks to Fedora ghc's: https://gist.github.com/juhp/a9c49281a8e478eb9af30a78a87ab0d7 |
2022-01-07 10:59:27 +0100 | nhatanh02 | (~satori@123.24.172.30) (Ping timeout: 256 seconds) |
2022-01-07 10:59:43 +0100 | <cemguresci> | exa: more theory of everything :D |
2022-01-07 10:59:58 +0100 | <cemguresci> | abstracting the abstraction :D |
2022-01-07 11:02:05 +0100 | spaceseller | (~spacesell@31.147.205.13) (Quit: Leaving) |
2022-01-07 11:02:09 +0100 | Everything | (~Everythin@37.115.210.35) |
2022-01-07 11:10:31 +0100 | <maerwald[m]> | juhp: why |
2022-01-07 11:11:17 +0100 | <juhp> | maerwald[m]: because I prefer to use the Fedora built ghc on Fedora |
2022-01-07 11:11:34 +0100 | <maerwald[m]> | juhp: https://docs.haskellstack.org/en/stable/yaml_configuration/#system-ghc |
2022-01-07 11:12:24 +0100 | <juhp> | maerwald[m]: yes I know but I have multiple Fedora ghc's (ghc8.10, ghc9.0, ghc9.2) |
2022-01-07 11:13:15 +0100 | <juhp> | Having an extra copy under ~/.stack is just a waste of diskspace :) |
2022-01-07 11:13:24 +0100 | <juhp> | copies |
2022-01-07 11:13:30 +0100 | <maerwald[m]> | juhp: then use a patched stack: https://github.com/commercialhaskell/stack/pull/5585 |
2022-01-07 11:14:36 +0100 | <maerwald[m]> | Here are prebuilt binaries https://downloads.haskell.org/~ghcup/unofficial-bindists/stack/2.7.3.1/ |
2022-01-07 11:14:37 +0100 | n3rdy1 | (~n3rdy1@2600:1700:4570:3480:1b88:50f:dae0:9293) (Ping timeout: 240 seconds) |
2022-01-07 11:15:37 +0100 | <juhp> | maerwald[m]: cool |
2022-01-07 11:15:47 +0100 | <juhp> | We have stack packaged in fedora too |
2022-01-07 11:16:05 +0100 | <maerwald[m]> | And? |
2022-01-07 11:17:31 +0100 | <juhp> | maerwald[m]: happy to use stack hooks once it is merged upstream :) |
2022-01-07 11:17:49 +0100 | mastarija | (~mastarija@2a05:4f46:e0e:5000:e9aa:f35a:429e:f1b8) |
2022-01-07 11:18:18 +0100 | <maerwald[m]> | juhp: it will never be |
2022-01-07 11:19:07 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) |
2022-01-07 11:19:07 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) (Changing host) |
2022-01-07 11:19:07 +0100 | wroathe | (~wroathe@user/wroathe) |
2022-01-07 11:19:18 +0100 | <juhp> | Well maybe I can apply your patch to Fedora stack then - would be nice indeed to automatically prefer or even install the Fedora build |
2022-01-07 11:20:25 +0100 | <juhp> | (Fedora ghcX.Y build) |
2022-01-07 11:20:29 +0100 | <maerwald[m]> | Since stack has stagnated, it should be easy to maintain the patch downstream |
2022-01-07 11:20:41 +0100 | <juhp> | Ya I suppose |
2022-01-07 11:20:51 +0100 | acidjnk | (~acidjnk@p200300d0c7271e249cd77df40fde183d.dip0.t-ipconnect.de) |
2022-01-07 11:20:51 +0100 | acidjnk_new3 | (~acidjnk@p200300d0c7271e249cd77df40fde183d.dip0.t-ipconnect.de) |
2022-01-07 11:24:23 +0100 | wroathe | (~wroathe@user/wroathe) (Ping timeout: 256 seconds) |
2022-01-07 11:28:45 +0100 | <juhp> | maerwald[m]: alright I parked your patch in my Fedora stack package directory - I may consider it for Fedora 36, thanks |
2022-01-07 11:29:46 +0100 | eggplantade | (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
2022-01-07 11:33:25 +0100 | <juhp> | Btw for those using Stackage Nightly: the next snapshot should be based on ghc-9.0.2 hopefully (thanks to Adam Bergmark) |
2022-01-07 11:33:57 +0100 | Lord_of_Life | (~Lord@user/lord-of-life/x-2819915) (Ping timeout: 240 seconds) |
2022-01-07 11:34:35 +0100 | eggplantade | (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 256 seconds) |
2022-01-07 11:34:42 +0100 | mastarija | (~mastarija@2a05:4f46:e0e:5000:e9aa:f35a:429e:f1b8) (Quit: Leaving) |
2022-01-07 11:35:10 +0100 | Lord_of_Life | (~Lord@user/lord-of-life/x-2819915) |
2022-01-07 11:38:16 +0100 | SummerSonw | (~The_viole@203.77.49.232) |
2022-01-07 11:39:29 +0100 | coot | (~coot@89-64-85-93.dynamic.chello.pl) (Quit: coot) |
2022-01-07 11:49:55 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) |
2022-01-07 11:49:55 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) (Changing host) |
2022-01-07 11:49:55 +0100 | wroathe | (~wroathe@user/wroathe) |
2022-01-07 11:51:17 +0100 | <[exa]> | cemguresci: actually these things are pretty concrete requirements, "do stuff in order based on some defined ordering logic" and "use results from earlier steps" |
2022-01-07 11:51:17 +0100 | Vajb | (~Vajb@2001:999:50:e6be:1e98:9376:d93e:4506) (Read error: Connection reset by peer) |
2022-01-07 11:53:06 +0100 | Vajb | (~Vajb@hag-jnsbng11-58c3a8-176.dhcp.inet.fi) |
2022-01-07 11:54:25 +0100 | Brumaire | (~quassel@37.166.249.26) (Ping timeout: 256 seconds) |
2022-01-07 11:54:47 +0100 | Brumaire | (~quassel@37.172.143.113) |
2022-01-07 11:54:59 +0100 | wroathe | (~wroathe@user/wroathe) (Ping timeout: 256 seconds) |
2022-01-07 11:55:33 +0100 | Akiva | (~Akiva@user/Akiva) (Ping timeout: 256 seconds) |
2022-01-07 11:56:18 +0100 | sub0 | (~bc8147f2@cerf.good1.com) |
2022-01-07 11:58:15 +0100 | coot | (~coot@89-64-85-93.dynamic.chello.pl) |
2022-01-07 12:01:28 +0100 | alx741 | (~alx741@157.100.93.160) |
2022-01-07 12:01:49 +0100 | burnsidesLlama | (~burnsides@dhcp168-021.wadham.ox.ac.uk) |
2022-01-07 12:07:04 +0100 | kjak | (~kjak@pool-108-45-56-21.washdc.fios.verizon.net) |
2022-01-07 12:07:54 +0100 | raehik | (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) |
2022-01-07 12:11:00 +0100 | benin | (~benin@183.82.176.241) (Ping timeout: 256 seconds) |
2022-01-07 12:15:03 +0100 | lavaman | (~lavaman@98.38.249.169) (Remote host closed the connection) |
2022-01-07 12:18:05 +0100 | puke | (~puke@user/puke) |
2022-01-07 12:18:57 +0100 | benin | (~benin@183.82.176.241) |
2022-01-07 12:20:42 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) |
2022-01-07 12:20:42 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) (Changing host) |
2022-01-07 12:20:42 +0100 | wroathe | (~wroathe@user/wroathe) |
2022-01-07 12:25:44 +0100 | wroathe | (~wroathe@user/wroathe) (Ping timeout: 256 seconds) |
2022-01-07 12:26:16 +0100 | jgeerds | (~jgeerds@55d4bbed.access.ecotel.net) |
2022-01-07 12:37:37 +0100 | Brumaire | (~quassel@37.172.143.113) (Ping timeout: 240 seconds) |
2022-01-07 12:38:26 +0100 | Brumaire | (~quassel@81-64-14-121.rev.numericable.fr) |
2022-01-07 12:41:05 +0100 | kupi | (uid212005@id-212005.hampstead.irccloud.com) |
2022-01-07 12:43:35 +0100 | DNH | (~DNH@2a02:8108:1100:16d8:ad26:5398:3e1f:d97d) |
2022-01-07 12:46:02 +0100 | nhatanh02 | (~satori@123.24.172.30) |
2022-01-07 12:48:43 +0100 | <cemguresci> | exa: right that makes sense |
2022-01-07 12:49:22 +0100 | <cemguresci> | exa: when I define these, `data Recipient = Recipient String | Nothing deriving Show` `data Amount = Amount Double | Nothing deriving Show` , I get this error "Multiple declarations of `Nothing'" Why it happens? |
2022-01-07 12:49:53 +0100 | <c_wraith> | constructors must be unique (per module) |
2022-01-07 12:50:10 +0100 | Hanicef | (~gustaf@81-229-9-108-no92.tbcn.telia.com) |
2022-01-07 12:50:14 +0100 | <c_wraith> | But the fact that you're using the name Nothing suggests a misunderstanding |
2022-01-07 12:50:39 +0100 | <c_wraith> | Those aren't the same Nothing as is defined in the Maybe type |
2022-01-07 12:50:52 +0100 | <c_wraith> | those are your own value named Nothing |
2022-01-07 12:50:57 +0100 | <cemguresci> | I am combining these with other data types and I want to construct the latest data type with nullable of this data types |
2022-01-07 12:51:32 +0100 | <c_wraith> | When you declare a data type, you declare constructors *for that type* |
2022-01-07 12:51:43 +0100 | <sub0> | your Nothing construct will conflict with Nothing from Maybe |
2022-01-07 12:51:48 +0100 | <sub0> | constructor* |
2022-01-07 12:52:16 +0100 | <sshine> | cemguresci, maybe you want: 'type Recipient = String; type Amount = Double' and then in your functions you can write 'Maybe Recipient' and 'Maybe Amount' types to signify values like 'Just "Bob" :: Maybe Recipient' and 'Nothing :: Maybe Recipient' and 'Just 42.0 :: Maybe Amount' and 'Nothing :: Maybe Amount'? |
2022-01-07 12:52:23 +0100 | <c_wraith> | sub0: not actually true. Maybe is defined in a different module. that error is coming from defining Nothing twice in the same module. There would be an ambiguity error using it, though |
2022-01-07 12:53:02 +0100 | <cemguresci> | c_wraith: you are right. it is not the same Nothing in Maybe :D |
2022-01-07 12:53:03 +0100 | <sshine> | cemguresci, it's not that creating your own nullable data type is necessarily bad. but maybe you want to consider using the existing Maybe type to describe whether or not there's a recipient/amount? |
2022-01-07 12:53:31 +0100 | <sub0> | c_wraith, Nothing is in Prelude. it will conflict with his name unless he took measures to prevent it |
2022-01-07 12:53:41 +0100 | <c_wraith> | sub0: but that's not what that error was reporting. |
2022-01-07 12:53:49 +0100 | <sub0> | I didn't comment on the error |
2022-01-07 12:54:11 +0100 | <c_wraith> | cemguresci: it is a requirement of Haskell's type inference that constructors always are unique to types. |
2022-01-07 12:54:47 +0100 | <c_wraith> | cemguresci: the fully-qualified names thereof, at least. |
2022-01-07 12:55:15 +0100 | <cemguresci> | I see, I confused how to use Nothing actually to make it nullable :D |
2022-01-07 12:55:18 +0100 | ubert | (~Thunderbi@2a02:8109:9880:303c:de3b:67d7:83e8:947e) (Remote host closed the connection) |
2022-01-07 12:55:31 +0100 | ubert | (~Thunderbi@2a02:8109:9880:303c:6bbe:db4a:c5b0:8e19) |
2022-01-07 12:56:29 +0100 | <cemguresci> | This is actually what I want, data Test = Test { |
2022-01-07 12:56:29 +0100 | <cemguresci> | amount :: Maybe Amount, |
2022-01-07 12:56:29 +0100 | <cemguresci> | recipient :: Maybe Recipient |
2022-01-07 12:56:29 +0100 | <cemguresci> | } deriving (Eq, Show, Generic) |
2022-01-07 12:56:29 +0100 | <[exa]> | cemguresci: better name it unambiguously as `NoRecipient` |
2022-01-07 12:56:56 +0100 | <[exa]> | I'd say that there you may go for `Maybe String` right away |
2022-01-07 12:57:07 +0100 | <[exa]> | or `Maybe Name` |
2022-01-07 12:57:28 +0100 | <[exa]> | naming the whole thing as Recipient sounds kinda like you also store the whole person there, with all organs etc :D |
2022-01-07 12:57:39 +0100 | <cemguresci> | haha :D |
2022-01-07 12:57:46 +0100 | <[exa]> | (hard-learned OOP lesson :D ) |
2022-01-07 12:57:56 +0100 | <sshine> | yea, Recipient does sound like a nested data type :) RecipientName or Name. but meh. |
2022-01-07 12:58:14 +0100 | <cemguresci> | you are right |
2022-01-07 12:58:16 +0100 | <[exa]> | `type Name=String` is a pretty common sight in packages |
2022-01-07 12:58:24 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) (Remote host closed the connection) |
2022-01-07 12:58:27 +0100 | <[exa]> | and yeah, meh. :D |
2022-01-07 12:58:42 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
2022-01-07 13:00:54 +0100 | ubert | (~Thunderbi@2a02:8109:9880:303c:6bbe:db4a:c5b0:8e19) (Remote host closed the connection) |
2022-01-07 13:01:06 +0100 | ubert | (~Thunderbi@2a02:8109:9880:303c:2e0:44f:2ede:1485) |
2022-01-07 13:01:24 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) (Remote host closed the connection) |
2022-01-07 13:01:42 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
2022-01-07 13:06:10 +0100 | jespada | (~jespada@87.74.36.188) |
2022-01-07 13:16:34 +0100 | slack1256 | (~slack1256@191.126.99.72) |
2022-01-07 13:16:37 +0100 | slack1256 | (~slack1256@191.126.99.72) (Remote host closed the connection) |
2022-01-07 13:25:00 +0100 | geranim0 | (~geranim0@modemcable242.171-178-173.mc.videotron.ca) |
2022-01-07 13:25:47 +0100 | simendsjo | (~user@2a02:2121:2c5:187:eedf:c36:9193:ad44) |
2022-01-07 13:25:47 +0100 | bitdex | (~bitdex@gateway/tor-sasl/bitdex) (Quit: = "") |
2022-01-07 13:26:11 +0100 | califax- | (~califax@user/califx) |
2022-01-07 13:30:33 +0100 | califax | (~califax@user/califx) (Ping timeout: 276 seconds) |
2022-01-07 13:30:33 +0100 | califax- | califax |
2022-01-07 13:32:30 +0100 | eggplantade | (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
2022-01-07 13:34:43 +0100 | benin | (~benin@183.82.176.241) (Ping timeout: 256 seconds) |
2022-01-07 13:35:37 +0100 | mvk | (~mvk@2607:fea8:5cdd:f000::45db) (Ping timeout: 240 seconds) |
2022-01-07 13:36:37 +0100 | eggplantade | (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 240 seconds) |
2022-01-07 13:40:53 +0100 | <joel135> | I just found the word Haskalah. Sounds like haskell :P |
2022-01-07 13:46:52 +0100 | Rum | (~bourbon@user/rum) |
2022-01-07 13:48:05 +0100 | <Hecate> | Haskallah Al-Rahman Al-Raheem? :P |
2022-01-07 13:49:09 +0100 | benin | (~benin@183.82.176.241) |
2022-01-07 13:50:34 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) |
2022-01-07 13:50:34 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) (Changing host) |
2022-01-07 13:50:34 +0100 | wroathe | (~wroathe@user/wroathe) |
2022-01-07 13:51:50 +0100 | benin | (~benin@183.82.176.241) (Client Quit) |
2022-01-07 13:55:50 +0100 | wroathe | (~wroathe@user/wroathe) (Ping timeout: 256 seconds) |
2022-01-07 13:56:08 +0100 | max22- | (~maxime@2a01cb088335980037d8471a1d5e7a78.ipv6.abo.wanadoo.fr) (Ping timeout: 252 seconds) |
2022-01-07 13:57:48 +0100 | Everything | (~Everythin@37.115.210.35) (Quit: leaving) |
2022-01-07 13:58:51 +0100 | Rum | (~bourbon@user/rum) (Quit: WeeChat 3.4) |
2022-01-07 14:06:36 +0100 | mmhat | (~mmh@55d459b4.access.ecotel.net) (Ping timeout: 256 seconds) |
2022-01-07 14:06:41 +0100 | <absence> | can cabal use a "resolver" from stack/stackage to decide which package versions to use? |
2022-01-07 14:09:29 +0100 | <geekosaur> | not yet |
2022-01-07 14:10:17 +0100 | <absence> | yet? is it planned or being worked on? |
2022-01-07 14:10:27 +0100 | <geekosaur> | yes |
2022-01-07 14:11:28 +0100 | <absence> | cool, is there somewhere i can read about it and/or follow the progress? |
2022-01-07 14:11:57 +0100 | cosimone | (~user@2001:b07:ae5:db26:c24a:d20:4d91:1e20) (Remote host closed the connection) |
2022-01-07 14:12:31 +0100 | cosimone | (~user@2001:b07:ae5:db26:c24a:d20:4d91:1e20) |
2022-01-07 14:14:16 +0100 | <geekosaur> | lemme see if I can find the ticket again |
2022-01-07 14:14:37 +0100 | nhatanh02 | (~satori@123.24.172.30) (Ping timeout: 240 seconds) |
2022-01-07 14:15:30 +0100 | ubert | (~Thunderbi@2a02:8109:9880:303c:2e0:44f:2ede:1485) (Remote host closed the connection) |
2022-01-07 14:15:49 +0100 | ubert | (~Thunderbi@2a02:8109:9880:303c:816c:2f7:b4df:2063) |
2022-01-07 14:18:00 +0100 | <geekosaur> | https://github.com/haskell/cabal/issues/7556 |
2022-01-07 14:19:35 +0100 | mmhat | (~mmh@55d45069.access.ecotel.net) |
2022-01-07 14:20:56 +0100 | <absence> | looks promising, thanks! |
2022-01-07 14:22:37 +0100 | acidjnk | (~acidjnk@p200300d0c7271e249cd77df40fde183d.dip0.t-ipconnect.de) (Ping timeout: 240 seconds) |
2022-01-07 14:22:37 +0100 | acidjnk_new3 | (~acidjnk@p200300d0c7271e249cd77df40fde183d.dip0.t-ipconnect.de) (Ping timeout: 240 seconds) |
2022-01-07 14:24:57 +0100 | simendsjo | (~user@2a02:2121:2c5:187:eedf:c36:9193:ad44) (Ping timeout: 240 seconds) |
2022-01-07 14:25:04 +0100 | vpan | (~0@212.117.1.172) (Quit: Leaving.) |
2022-01-07 14:27:30 +0100 | waleee | (~waleee@2001:9b0:21d:fc00:398f:b003:b90d:acf4) |
2022-01-07 14:28:45 +0100 | Hanicef | (~gustaf@81-229-9-108-no92.tbcn.telia.com) (Quit: leaving) |
2022-01-07 14:31:03 +0100 | SummerSonw | (~The_viole@203.77.49.232) (Remote host closed the connection) |
2022-01-07 14:31:23 +0100 | SummerSonw | (~The_viole@203.77.49.232) |
2022-01-07 14:43:21 +0100 | burnsidesLlama | (~burnsides@dhcp168-021.wadham.ox.ac.uk) (Remote host closed the connection) |
2022-01-07 14:43:53 +0100 | burnsidesLlama | (~burnsides@client-8-64.eduroam.oxuni.org.uk) |
2022-01-07 14:44:06 +0100 | geekosaur | wonders how close one could get to this by translating a resolver into an incomplete freeze file |
2022-01-07 14:44:59 +0100 | jgeerds | (~jgeerds@55d4bbed.access.ecotel.net) (Ping timeout: 256 seconds) |
2022-01-07 14:45:57 +0100 | <fendor[m]> | iirc, the issue describes how far you can get with freeze files and what the limitations are |
2022-01-07 14:46:26 +0100 | lavaman | (~lavaman@98.38.249.169) |
2022-01-07 14:48:23 +0100 | burnsidesLlama | (~burnsides@client-8-64.eduroam.oxuni.org.uk) (Ping timeout: 256 seconds) |
2022-01-07 14:50:48 +0100 | lavaman | (~lavaman@98.38.249.169) (Ping timeout: 256 seconds) |
2022-01-07 14:51:54 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) (Remote host closed the connection) |
2022-01-07 14:51:59 +0100 | mjacob_ | mjacob |
2022-01-07 14:52:13 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
2022-01-07 14:52:13 +0100 | alx741 | (~alx741@157.100.93.160) (Read error: Connection reset by peer) |
2022-01-07 14:55:37 +0100 | SummerSonw | (~The_viole@203.77.49.232) (Ping timeout: 240 seconds) |
2022-01-07 15:00:04 +0100 | nhatanh02 | (~satori@123.24.172.30) |
2022-01-07 15:00:48 +0100 | kupi | (uid212005@id-212005.hampstead.irccloud.com) (Quit: Connection closed for inactivity) |
2022-01-07 15:01:27 +0100 | coot | (~coot@89-64-85-93.dynamic.chello.pl) (Quit: coot) |
2022-01-07 15:05:09 +0100 | SummerSonw | (~The_viole@203.77.49.232) |
2022-01-07 15:09:11 +0100 | kupi | (uid212005@id-212005.hampstead.irccloud.com) |
2022-01-07 15:10:01 +0100 | alx741 | (~alx741@157.100.93.160) |
2022-01-07 15:12:49 +0100 | xkuru | (~xkuru@user/xkuru) |
2022-01-07 15:14:25 +0100 | alx741 | (~alx741@157.100.93.160) (Read error: Connection reset by peer) |
2022-01-07 15:16:13 +0100 | CiaoSen | (~Jura@p200300c957347b002a3a4dfffe84dbd5.dip0.t-ipconnect.de) |
2022-01-07 15:19:47 +0100 | DNH | (~DNH@2a02:8108:1100:16d8:ad26:5398:3e1f:d97d) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
2022-01-07 15:19:48 +0100 | sub0 | (~bc8147f2@cerf.good1.com) (Quit: CGI:IRC (Ping timeout)) |
2022-01-07 15:20:04 +0100 | bontaq | (~user@ool-45779fe5.dyn.optonline.net) |
2022-01-07 15:22:27 +0100 | DNH | (~DNH@2a02:8108:1100:16d8:ad26:5398:3e1f:d97d) |
2022-01-07 15:27:56 +0100 | geekosaur | (~geekosaur@xmonad/geekosaur) (Remote host closed the connection) |
2022-01-07 15:29:37 +0100 | geekosaur | (~geekosaur@xmonad/geekosaur) |
2022-01-07 15:30:57 +0100 | alx741 | (~alx741@157.100.93.160) |
2022-01-07 15:31:16 +0100 | shriekingnoise | (~shrieking@186.137.144.80) |
2022-01-07 15:32:24 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) (Remote host closed the connection) |
2022-01-07 15:32:44 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
2022-01-07 15:35:56 +0100 | alx741 | (~alx741@157.100.93.160) (Read error: Connection reset by peer) |
2022-01-07 15:37:44 +0100 | stef204 | (~stef204@user/stef204) |
2022-01-07 15:38:23 +0100 | antony | (~The_viole@203.77.49.232) |
2022-01-07 15:38:36 +0100 | antony | (~The_viole@203.77.49.232) (Client Quit) |
2022-01-07 15:39:23 +0100 | cemguresci | (~cemguresc@2001:a61:11ff:a001:2dad:6df8:999e:4708) (Remote host closed the connection) |
2022-01-07 15:39:35 +0100 | cemguresci | (~cemguresc@2001:a61:11ff:a001:2dad:6df8:999e:4708) |
2022-01-07 15:43:52 +0100 | o-90 | (~o-90@gateway/tor-sasl/o-90) |
2022-01-07 15:46:30 +0100 | wroathe | (~wroathe@user/wroathe) |
2022-01-07 15:53:42 +0100 | Inst | (~delicacie@c-98-208-218-119.hsd1.fl.comcast.net) (Ping timeout: 256 seconds) |
2022-01-07 15:54:37 +0100 | alx741 | (~alx741@157.100.93.160) |
2022-01-07 15:54:41 +0100 | noddy | (~user@user/noddy) (Quit: WeeChat 3.4) |
2022-01-07 15:54:54 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) (Remote host closed the connection) |
2022-01-07 15:55:12 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
2022-01-07 15:56:25 +0100 | noddy | (~user@user/noddy) |
2022-01-07 15:57:43 +0100 | xb0o2 | (~xb0o2@user/xb0o2) |
2022-01-07 15:59:22 +0100 | alx741 | (~alx741@157.100.93.160) (Read error: Connection reset by peer) |
2022-01-07 16:00:57 +0100 | notzmv | (~zmv@user/notzmv) (Ping timeout: 240 seconds) |
2022-01-07 16:00:57 +0100 | jakalx | (~jakalx@base.jakalx.net) () |
2022-01-07 16:01:20 +0100 | SummerSonw | (~The_viole@203.77.49.232) (Remote host closed the connection) |
2022-01-07 16:01:42 +0100 | SummerSonw | (~The_viole@203.77.49.232) |
2022-01-07 16:02:33 +0100 | geekosaur | (~geekosaur@xmonad/geekosaur) (Quit: Leaving) |
2022-01-07 16:03:55 +0100 | geekosaur | (~geekosaur@xmonad/geekosaur) |
2022-01-07 16:04:52 +0100 | burnsidesLlama | (~burnsides@dhcp168-021.wadham.ox.ac.uk) |
2022-01-07 16:05:57 +0100 | wroathe | (~wroathe@user/wroathe) (Ping timeout: 240 seconds) |
2022-01-07 16:06:04 +0100 | atmunr | (~atmunr@181.199.145.102) |
2022-01-07 16:06:06 +0100 | jakalx | (~jakalx@base.jakalx.net) |
2022-01-07 16:07:31 +0100 | atmunr | (~atmunr@181.199.145.102) (Client Quit) |
2022-01-07 16:07:55 +0100 | Feuermagier | (~Feuermagi@user/feuermagier) |
2022-01-07 16:10:34 +0100 | SummerSonw | (~The_viole@203.77.49.232) (Quit: Leaving) |
2022-01-07 16:10:41 +0100 | max22- | (~maxime@2a01cb088335980011bb54fd9cdf5176.ipv6.abo.wanadoo.fr) |
2022-01-07 16:12:57 +0100 | wyrd | (~wyrd@gateway/tor-sasl/wyrd) (Quit: leaving) |
2022-01-07 16:15:21 +0100 | <sclv> | absence, geekosaur stackage already provides those freeze files: https://www.stackage.org/lts-18.5/cabal.config |
2022-01-07 16:15:45 +0100 | <geekosaur> | so I saw when I read the ticket |
2022-01-07 16:15:58 +0100 | <sclv> | there's no link anywhere from the stackage page itself (its an "easter egg feature") because they decided they didn't like promoting it, ostensibly because those don't handle revisions |
2022-01-07 16:16:51 +0100 | <sclv> | the feature i've been working on would let you add a line "import https://foo/cabal.config" directly to a project file |
2022-01-07 16:17:06 +0100 | jkaye | (~jkaye@2601:281:8300:7530:960c:6e00:5eeb:eb5a) |
2022-01-07 16:17:10 +0100 | alx741 | (~alx741@157.100.93.160) |
2022-01-07 16:17:35 +0100 | <sclv> | and the main issue is merge constraint semantics are not useful right now |
2022-01-07 16:17:46 +0100 | <sclv> | it just picks up all constraints and applies them all. |
2022-01-07 16:17:55 +0100 | <sclv> | so you can't ever "override" a resolver |
2022-01-07 16:18:49 +0100 | Sgeo | (~Sgeo@user/sgeo) |
2022-01-07 16:20:30 +0100 | alx741 | (~alx741@157.100.93.160) (Read error: Connection reset by peer) |
2022-01-07 16:23:24 +0100 | sirlensalot | (~sirlensal@ool-44c5f8c9.dyn.optonline.net) |
2022-01-07 16:24:07 +0100 | ProfSimm | (~ProfSimm@87.227.196.109) |
2022-01-07 16:26:11 +0100 | off^ | (~off@207.5.21.20) (Remote host closed the connection) |
2022-01-07 16:29:43 +0100 | coot | (~coot@89-64-85-93.dynamic.chello.pl) |
2022-01-07 16:33:08 +0100 | DNH | (~DNH@2a02:8108:1100:16d8:ad26:5398:3e1f:d97d) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
2022-01-07 16:34:38 +0100 | eggplantade | (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
2022-01-07 16:37:24 +0100 | alx741 | (~alx741@157.100.93.160) |
2022-01-07 16:38:54 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) (Remote host closed the connection) |
2022-01-07 16:38:57 +0100 | eggplantade | (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 240 seconds) |
2022-01-07 16:39:12 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
2022-01-07 16:39:24 +0100 | stef204 | (~stef204@user/stef204) (Quit: WeeChat 3.4) |
2022-01-07 16:40:08 +0100 | alx741 | (~alx741@157.100.93.160) (Client Quit) |
2022-01-07 16:50:55 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
2022-01-07 16:51:48 +0100 | mmhat | (~mmh@55d45069.access.ecotel.net) (Quit: WeeChat 3.4) |
2022-01-07 16:52:42 +0100 | DNH | (~DNH@2a02:8108:1100:16d8:ad26:5398:3e1f:d97d) |
2022-01-07 16:56:12 +0100 | Hafydd | (~Hafydd@user/hafydd) (Quit: WeeChat 3.3) |
2022-01-07 16:56:19 +0100 | Vajb | (~Vajb@hag-jnsbng11-58c3a8-176.dhcp.inet.fi) (Read error: Connection reset by peer) |
2022-01-07 16:56:27 +0100 | nhatanh02 | (~satori@123.24.172.30) (Ping timeout: 256 seconds) |
2022-01-07 16:56:58 +0100 | Jing | (~hedgehog@2604:a840:3::103c) (Remote host closed the connection) |
2022-01-07 16:57:37 +0100 | Jing | (~hedgehog@2604:a840:3::103c) |
2022-01-07 16:57:50 +0100 | nf | (~n@monade.li) (Quit: Fairfarren.) |
2022-01-07 16:59:16 +0100 | Hafydd | (~Hafydd@user/hafydd) |
2022-01-07 17:00:03 +0100 | Hafydd | (~Hafydd@user/hafydd) (Client Quit) |
2022-01-07 17:00:47 +0100 | zmt00 | (~zmt00@user/zmt00) |
2022-01-07 17:02:07 +0100 | jumper149 | (~jumper149@base.felixspringer.xyz) (Quit: WeeChat 3.3) |
2022-01-07 17:04:24 +0100 | ubert | (~Thunderbi@2a02:8109:9880:303c:816c:2f7:b4df:2063) (Remote host closed the connection) |
2022-01-07 17:05:05 +0100 | wyrd | (~wyrd@gateway/tor-sasl/wyrd) |
2022-01-07 17:07:20 +0100 | shapr | (~user@2601:7c0:c202:5190:1c89:9f27:44af:85b3) |
2022-01-07 17:07:31 +0100 | nf | (~n@monade.li) |
2022-01-07 17:09:01 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) |
2022-01-07 17:11:02 +0100 | jkaye | (~jkaye@2601:281:8300:7530:960c:6e00:5eeb:eb5a) (Ping timeout: 240 seconds) |
2022-01-07 17:17:15 +0100 | zebrag | (~chris@user/zebrag) |
2022-01-07 17:17:24 +0100 | wyrd | (~wyrd@gateway/tor-sasl/wyrd) (Ping timeout: 276 seconds) |
2022-01-07 17:18:07 +0100 | [itchyjunk] | (~itchyjunk@user/itchyjunk/x-7353470) |
2022-01-07 17:19:26 +0100 | wyrd | (~wyrd@gateway/tor-sasl/wyrd) |
2022-01-07 17:20:42 +0100 | jkaye | (~jkaye@2601:281:8300:7530:89aa:29d4:1f39:3e9) |
2022-01-07 17:20:55 +0100 | rekahsoft | (~rekahsoft@cpe0008a20f982f-cm64777d666260.cpe.net.cable.rogers.com) |
2022-01-07 17:21:57 +0100 | jpds | (~jpds@gateway/tor-sasl/jpds) (Ping timeout: 276 seconds) |
2022-01-07 17:23:09 +0100 | jpds | (~jpds@gateway/tor-sasl/jpds) |
2022-01-07 17:24:57 +0100 | cheater | (~Username@user/cheater) (Ping timeout: 240 seconds) |
2022-01-07 17:30:03 +0100 | coolnickname | (uid531864@user/coolnickname) (Quit: Connection closed for inactivity) |
2022-01-07 17:30:32 +0100 | pavonia | (~user@user/siracusa) (Quit: Bye!) |
2022-01-07 17:36:00 +0100 | cosimone | (~user@2001:b07:ae5:db26:c24a:d20:4d91:1e20) (Remote host closed the connection) |
2022-01-07 17:36:42 +0100 | cosimone | (~user@2001:b07:ae5:db26:c24a:d20:4d91:1e20) |
2022-01-07 17:42:08 +0100 | CiaoSen | (~Jura@p200300c957347b002a3a4dfffe84dbd5.dip0.t-ipconnect.de) (Ping timeout: 268 seconds) |
2022-01-07 17:43:24 +0100 | o-90 | (~o-90@gateway/tor-sasl/o-90) (Ping timeout: 276 seconds) |
2022-01-07 17:43:33 +0100 | Vajb | (~Vajb@hag-jnsbng11-58c3a8-176.dhcp.inet.fi) |
2022-01-07 17:45:14 +0100 | <cemguresci> | Hi guys, why this function errors stack overfow, i dont understand. ppow abc a = xx |
2022-01-07 17:45:14 +0100 | <cemguresci> | where fd = read (take 4 . reverse $ show(hashWithSalt a abc)) :: Integer |
2022-01-07 17:45:14 +0100 | <cemguresci> | xx = if fd < 5999 |
2022-01-07 17:45:14 +0100 | <cemguresci> | then a |
2022-01-07 17:45:14 +0100 | <cemguresci> | else (ppow abc a+1) |
2022-01-07 17:45:20 +0100 | slowButPresent | (~slowButPr@user/slowbutpresent) |
2022-01-07 17:45:23 +0100 | <EvanR> | @where paste |
2022-01-07 17:45:23 +0100 | <lambdabot> | Help us help you: please paste full code, input and/or output at e.g. https://paste.tomsmeding.com |
2022-01-07 17:45:27 +0100 | <EvanR> | dang that's handy |
2022-01-07 17:46:21 +0100 | <cemguresci> | all right. https://paste.tomsmeding.com/xrs11gGJ |
2022-01-07 17:46:40 +0100 | <cemguresci> | this works, *Main Data.Hashable Data.Hashable.Time Data.Int> ppow z 33 |
2022-01-07 17:46:40 +0100 | <cemguresci> | 33 |
2022-01-07 17:46:50 +0100 | <EvanR> | did you want to do (ppow abc (a + 1)) at the end |
2022-01-07 17:47:12 +0100 | Akiva | (~Akiva@user/Akiva) |
2022-01-07 17:47:12 +0100 | <EvanR> | or (ppow abc a) + 1 |
2022-01-07 17:47:15 +0100 | <cemguresci> | *Main Data.Hashable Data.Hashable.Time Data.Int> ppow z 32 |
2022-01-07 17:47:15 +0100 | <cemguresci> | *** Exception: stack overflow |
2022-01-07 17:47:15 +0100 | <cemguresci> | this doesnt |
2022-01-07 17:48:09 +0100 | <EvanR> | note how the second understanding leads to an infinite loop |
2022-01-07 17:48:24 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) (Remote host closed the connection) |
2022-01-07 17:48:28 +0100 | <cemguresci> | now it owkrs :D |
2022-01-07 17:48:35 +0100 | <cemguresci> | works :D |
2022-01-07 17:48:46 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
2022-01-07 17:49:34 +0100 | <EvanR> | rather if fd starts < 5999 it remains so forever because the same question gets repeated infinitely |
2022-01-07 17:50:21 +0100 | <cemguresci> | i thought making a+1 will act like (a + 1), never assume that, right |
2022-01-07 17:50:45 +0100 | Inst | (~delicacie@c-98-208-218-119.hsd1.fl.comcast.net) |
2022-01-07 17:50:51 +0100 | chele | (~chele@user/chele) (Remote host closed the connection) |
2022-01-07 17:50:55 +0100 | <EvanR> | + just has lower parsing precedence than the space in 'f x' |
2022-01-07 17:51:10 +0100 | <EvanR> | function application binds tighter |
2022-01-07 17:51:43 +0100 | <EvanR> | similar to 'times' in algebra xy + ab |
2022-01-07 17:52:10 +0100 | <EvanR> | but it also binds tighter than * |
2022-01-07 17:52:45 +0100 | nhatanh02 | (~satori@123.24.172.30) |
2022-01-07 17:53:29 +0100 | stefan-_ | (~cri@42dots.de) (Ping timeout: 250 seconds) |
2022-01-07 17:56:39 +0100 | <Hecate> | Hello, I'm doing user research regarding a feature I'm hoping to get into Cabal, that would allow people to seamlessly integrate native compiled languages (read: rust/zig/C) in their Cabal project |
2022-01-07 17:56:46 +0100 | <Hecate> | Based on the ideas in https://gist.github.com/Kleidukos/729fd6a091307e0929f7519126b4a6c8 |
2022-01-07 17:56:57 +0100 | mbuf | (~Shakthi@122.178.240.232) (Quit: Leaving) |
2022-01-07 17:57:17 +0100 | stefan-_ | (~cri@42dots.de) |
2022-01-07 17:58:28 +0100 | <Hecate> | long story short I'm gathering your testimonials in order to know how I can best serve you |
2022-01-07 17:58:38 +0100 | <sclv> | Hecate: i don't understand your reference to hackage builders there at all |
2022-01-07 17:58:39 +0100 | <Hecate> | the idea is to provide an alternative to custom Setup.hs |
2022-01-07 17:58:58 +0100 | <cemguresci> | thanks EvanR |
2022-01-07 17:59:00 +0100 | nunggu | (~q@gateway/tor-sasl/nunggu) |
2022-01-07 17:59:04 +0100 | <Hecate> | sclv: When you upload a library to Hackage, isn't it impossible to specify a custom command to have them run? |
2022-01-07 17:59:12 +0100 | cemguresci | cemg |
2022-01-07 17:59:17 +0100 | <sclv> | no hackage uses a standard cabal build |
2022-01-07 17:59:37 +0100 | Inst | (~delicacie@c-98-208-218-119.hsd1.fl.comcast.net) (Ping timeout: 240 seconds) |
2022-01-07 17:59:42 +0100 | <sclv> | but standard cabal builds can use custom setup.hs |
2022-01-07 18:00:01 +0100 | waleee | (~waleee@2001:9b0:21d:fc00:398f:b003:b90d:acf4) (Ping timeout: 268 seconds) |
2022-01-07 18:00:09 +0100 | <Hecate> | yes but we're actively trying to get rid of those ;) |
2022-01-07 18:00:14 +0100 | eggplantade | (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
2022-01-07 18:00:23 +0100 | <sclv> | right but the reference to hackage makes no sense |
2022-01-07 18:00:27 +0100 | <EvanR> | cemguresci, worth understanding precedence in haskell because 1. it's relevant to stuff like a -> b -> c, which is understood as a -> (b -> c), 2. people sprinkle $ everywhere, often gratuitously, to adjust precedence and 3. you can define the precedence of custom operators |
2022-01-07 18:00:30 +0100 | <sclv> | its just one of many systems that uses cabal build |
2022-01-07 18:00:31 +0100 | <Hecate> | wait wait let me finish |
2022-01-07 18:00:34 +0100 | <sclv> | there's nothing special about it |
2022-01-07 18:01:04 +0100 | <Hecate> | one of the critics I've received is: Why don't you use $other_tool or just run commands in the right order? |
2022-01-07 18:01:16 +0100 | <Hecate> | and my answer was "there are systems that only run standard cabal builds" |
2022-01-07 18:01:19 +0100 | <Hecate> | like Hackage runners |
2022-01-07 18:01:28 +0100 | <sclv> | you can make that argument more generally |
2022-01-07 18:01:30 +0100 | <Hecate> | where you can't specify a custom command to run |
2022-01-07 18:01:40 +0100 | <Hecate> | yup' but I thought an example would be more speaking? |
2022-01-07 18:01:44 +0100 | <sclv> | any time package X wants to depend on package Y then cabal will build package Y with a standard cabal build |
2022-01-07 18:01:49 +0100 | <Hecate> | but yes it's more general than just Hackage |
2022-01-07 18:01:56 +0100 | <Hecate> | great, thank you :) |
2022-01-07 18:02:26 +0100 | <sclv> | that said, I think you can do 95% of this with build-tool-depends and not needing any changes to cabal grammar |
2022-01-07 18:03:19 +0100 | <sclv> | you _might_ not be able to do it with custom stanzas per tool in the cabal grammar (not sure about nested syntax of x-fields) but you could just put that config in a distinct file |
2022-01-07 18:03:43 +0100 | <sclv> | so i really would encourage you to try build-tool-depends for this, and document what if any limitations that has |
2022-01-07 18:03:50 +0100 | <sclv> | and maybe that could just be mildly fixed or extended |
2022-01-07 18:04:41 +0100 | <Hecate> | sclv: I have a hard time understanding the operational semantics of build-tool-depends, does it run anything? Does it add anything to the pipeline? |
2022-01-07 18:05:02 +0100 | vysn | (~vysn@user/vysn) (Ping timeout: 240 seconds) |
2022-01-07 18:05:40 +0100 | <Hecate> | I'm understanding that it provides executables in the scope (PATH?) during the duration of the component |
2022-01-07 18:06:56 +0100 | <Hecate> | sclv: you're right in that I can declare the necssity of having the cargo-driver (for instance) in the $PATH, this does the majority of the job I think |
2022-01-07 18:07:14 +0100 | <sclv> | fair point it doesn't actually run it |
2022-01-07 18:07:22 +0100 | <Hecate> | but then I'd have to register the driver to run before the component is built |
2022-01-07 18:07:46 +0100 | <Hecate> | sclv: that being said the code behind build-tool-depends can absolutely be reused! :) |
2022-01-07 18:08:12 +0100 | <sclv> | actually wait, i have an open pr that almost does this: https://github.com/haskell/cabal/pull/7688 |
2022-01-07 18:08:18 +0100 | <sclv> | its just limited to test suites only now |
2022-01-07 18:08:48 +0100 | <sclv> | i think i didn't want it in main stanzas because it can generate new hs modules and we want the cabal file to have a manifest of all exposed cabal modules |
2022-01-07 18:08:58 +0100 | tzh | (~tzh@c-24-21-73-154.hsd1.wa.comcast.net) |
2022-01-07 18:08:58 +0100 | <sclv> | so i don't think we want that |
2022-01-07 18:08:59 +0100 | Akiva | (~Akiva@user/Akiva) (Ping timeout: 256 seconds) |
2022-01-07 18:09:39 +0100 | <sclv> | but arguably i'd just want one new field, "build-tools-pipeline" that runs a list of executables in order |
2022-01-07 18:09:47 +0100 | <sclv> | (with build-tools-depends used to bring them into scope) |
2022-01-07 18:10:36 +0100 | <sclv> | which is almost exactly your build-drivers field, but i'm leaning against having the x- fields in the cabal file get passed in |
2022-01-07 18:10:39 +0100 | <Hecate> | sclv: don't we have autogen-modules for those? |
2022-01-07 18:10:44 +0100 | <sclv> | i think it confuses the grammar to make that extensible |
2022-01-07 18:11:14 +0100 | <Hecate> | sclv: when you say "get passed in" I'm not sure to fully understand |
2022-01-07 18:11:57 +0100 | <sclv> | well i'm given to understand if you say build-driver: cargo-driver then the x-cargo-driver stanza somehow gets passed to cargo-driver |
2022-01-07 18:12:14 +0100 | <sclv> | i'd rather you just call "cargo-driver" and it finds its settings like in some other file or something |
2022-01-07 18:12:38 +0100 | <Hecate> | sclv: oh no it doesn't get passed-in to the driver |
2022-01-07 18:12:45 +0100 | <sclv> | ok then what does it do |
2022-01-07 18:12:47 +0100 | <Hecate> | I'd have the cargo-driver parse the Cabal file |
2022-01-07 18:12:51 +0100 | <Hecate> | get its stanza |
2022-01-07 18:12:57 +0100 | <Hecate> | this is low-tech enough |
2022-01-07 18:13:10 +0100 | <sclv> | as i said idk if we can have x-stanzas or just x-fields |
2022-01-07 18:13:22 +0100 | <Hecate> | aaaah ok I understand now |
2022-01-07 18:13:39 +0100 | notzmv | (~zmv@user/notzmv) |
2022-01-07 18:14:06 +0100 | <sclv> | the minimal proposal i'd support would be just build-drivers (but i'd prefer it called build-tools-pipeline or the like for uniformity, though that's totally something people can argue about on a ticket, etc) |
2022-01-07 18:15:06 +0100 | <Hecate> | > Notice that you can create custom stanzas in your foo.cabal. I have provided the code to support a stanza something like: |
2022-01-07 18:15:07 +0100 | <lambdabot> | <hint>:1:43: error: parse error on input ‘in’ |
2022-01-07 18:15:09 +0100 | <Hecate> | https://webcache.googleusercontent.com/search?q=cache:ug9swepTVJoJ:https://www.py4u.net/discuss/19… |
2022-01-07 18:16:19 +0100 | <sclv> | not sure that's accurate let me check |
2022-01-07 18:17:06 +0100 | <geekosaur> | iirc it at least used to be possible |
2022-01-07 18:17:50 +0100 | <sclv> | yeah, it works as is |
2022-01-07 18:18:06 +0100 | <Hecate> | hurray :D |
2022-01-07 18:18:19 +0100 | <Hecate> | this saves the x-$driver stanza |
2022-01-07 18:18:22 +0100 | <sclv> | ok, so drivers can read custom stanzas or other files or whatever its up to them :-) |
2022-01-07 18:18:29 +0100 | <Hecate> | sclv: :D yes! |
2022-01-07 18:18:47 +0100 | <Hecate> | ah man this makes me so happy |
2022-01-07 18:18:48 +0100 | <sclv> | again this means the minimal proposal is just a single new field that adds executables to a preprocessor pipeline |
2022-01-07 18:19:18 +0100 | <sclv> | there might be some prior tickets on this lying around, but imho it makes a lot of sense |
2022-01-07 18:19:19 +0100 | <Hecate> | yup', as advertised in the FAQ I want this to be minimally invasive for Cabal |
2022-01-07 18:19:50 +0100 | <Hecate> | And this is a step forward getting rid of a legitimate usage of Setup.hs |
2022-01-07 18:19:52 +0100 | <sclv> | it might be worth trying to figure out how many current uses of custom Setup.hs can be obviated by this |
2022-01-07 18:19:53 +0100 | <sclv> | yep |
2022-01-07 18:20:23 +0100 | <Hecate> | sclv: speaking of which, I've been contacted with someone that has quite a horrific situation: https://twitter.com/marunarh/status/1479496482063589376 |
2022-01-07 18:20:46 +0100 | <Hecate> | you said that generated .hs modules in Setup.hs are Not Good™, would it be better if they were registered in autogen-modules? |
2022-01-07 18:20:46 +0100 | Jing | (~hedgehog@2604:a840:3::103c) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
2022-01-07 18:20:49 +0100 | CiaoSen | (~Jura@p200300c957347b002a3a4dfffe84dbd5.dip0.t-ipconnect.de) |
2022-01-07 18:21:37 +0100 | <sclv> | right, we really want the cabal file to statically list all modules a package can provide |
2022-01-07 18:21:42 +0100 | waleee | (~waleee@2001:9b0:21d:fc00:398f:b003:b90d:acf4) |
2022-01-07 18:22:19 +0100 | <Hecate> | perfect, so I can tell people to do this then |
2022-01-07 18:22:23 +0100 | <Hecate> | 👍* |
2022-01-07 18:27:04 +0100 | econo | (uid147250@user/econo) |
2022-01-07 18:28:50 +0100 | <[itchyjunk]> | When it says "define your own list type", am i supposed to create a new datastructure somehow? |
2022-01-07 18:29:16 +0100 | <[itchyjunk]> | "define your own list type and then implement your own version of the following functions : " it says |
2022-01-07 18:30:03 +0100 | <geekosaur> | yes |
2022-01-07 18:30:14 +0100 | <geekosaur> | it's not even particularly difficult |
2022-01-07 18:30:24 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) (Remote host closed the connection) |
2022-01-07 18:30:41 +0100 | <[itchyjunk]> | hmmmmm |
2022-01-07 18:31:00 +0100 | Hafydd | (~Hafydd@user/hafydd) |
2022-01-07 18:31:10 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
2022-01-07 18:33:37 +0100 | <geekosaur> | the one thing you can't readily do is use [x,y,z] syntax with it |
2022-01-07 18:34:07 +0100 | <geekosaur> | (there's a way around that but I'm pretty sure they don't want you to do that now) |
2022-01-07 18:35:24 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) (Remote host closed the connection) |
2022-01-07 18:35:41 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
2022-01-07 18:42:59 +0100 | doyougnu | (~doyougnu@c-73-25-202-122.hsd1.or.comcast.net) (Ping timeout: 256 seconds) |
2022-01-07 18:44:53 +0100 | cemg | (~cemguresc@2001:a61:11ff:a001:2dad:6df8:999e:4708) (Ping timeout: 252 seconds) |
2022-01-07 18:48:06 +0100 | <[itchyjunk]> | hmm |
2022-01-07 18:48:13 +0100 | lavaman | (~lavaman@98.38.249.169) |
2022-01-07 18:48:35 +0100 | <EvanR> | remind me why it would be a bad idea to have a default instance of some class that select types "reimplement" OOP style |
2022-01-07 18:48:56 +0100 | <EvanR> | it breaks separate compilation or |
2022-01-07 18:49:30 +0100 | <geekosaur> | separate compilation has to be able to find instances by fixed names |
2022-01-07 18:49:45 +0100 | <geekosaur> | which then become global across the entire program |
2022-01-07 18:49:57 +0100 | <[itchyjunk]> | I want a `data List a = someConstructorHere variable | someOtherCons moreVariables |
2022-01-07 18:49:58 +0100 | <[itchyjunk]> | ` |
2022-01-07 18:50:27 +0100 | <geekosaur> | that said, you can do this with default implementations in the class head, depending on what you really need |
2022-01-07 18:50:48 +0100 | <EvanR> | just curious, don't need it! |
2022-01-07 18:52:35 +0100 | <[itchyjunk]> | I suppose i want my type to be deriving Num |
2022-01-07 18:52:37 +0100 | lavaman | (~lavaman@98.38.249.169) (Ping timeout: 256 seconds) |
2022-01-07 18:52:56 +0100 | <geekosaur> | [itchyjunk], not if you're reimplementing a list, no |
2022-01-07 18:52:58 +0100 | <EvanR> | [itchyjunk], are you throwing spaghetti at a wall now |
2022-01-07 18:53:22 +0100 | <[itchyjunk]> | Always have been! |
2022-01-07 18:53:26 +0100 | Erutuon | (~Erutuon@user/erutuon) |
2022-01-07 18:53:54 +0100 | <[itchyjunk]> | yeah i am trying to implement list where i can define a mySum and sum all the elements of the list |
2022-01-07 18:54:24 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) (Read error: Connection reset by peer) |
2022-01-07 18:54:29 +0100 | <EvanR> | that requires Num support on elements and not the list |
2022-01-07 18:54:42 +0100 | <[itchyjunk]> | hmm right |
2022-01-07 18:55:33 +0100 | jonathanx | (~jonathan@h-178-174-176-109.a357.priv.bahnhof.se) |
2022-01-07 18:55:46 +0100 | <[itchyjunk]> | define a list containing a, where a is constrained to the Num interface like thingy |
2022-01-07 18:55:59 +0100 | <[itchyjunk]> | `data List a = ?` |
2022-01-07 18:56:48 +0100 | coot | (~coot@89-64-85-93.dynamic.chello.pl) (Quit: coot) |
2022-01-07 18:56:57 +0100 | <[itchyjunk]> | not the `a` either, apparently |
2022-01-07 18:57:02 +0100 | <c_wraith> | GHC has disabled the functionality that used to allow that, because.. it turned out to not be useful. |
2022-01-07 18:57:18 +0100 | <c_wraith> | Just put constraints on the places that need them. the data constructor does not need them |
2022-01-07 18:58:09 +0100 | <geekosaur> | is there anything else you're supposed to define? |
2022-01-07 18:58:22 +0100 | Hayek | (~xxx@rrcs-173-196-3-254.west.biz.rr.com) |
2022-01-07 18:58:27 +0100 | <geekosaur> | :t sum -- note we put the constraint on the function, not the list |
2022-01-07 18:58:27 +0100 | <lambdabot> | (Foldable t, Num a) => t a -> a |
2022-01-07 18:58:34 +0100 | <geekosaur> | meh |
2022-01-07 18:58:42 +0100 | <geekosaur> | % :t sum @[] |
2022-01-07 18:58:42 +0100 | <yahb> | geekosaur: Num a => [a] -> a |
2022-01-07 18:58:43 +0100 | <Hayek> | src sum |
2022-01-07 18:58:47 +0100 | <[itchyjunk]> | the full problem is here :http://www.cas.mcmaster.ca/~dalvescb/LH_Week05_Exercises.pdf |
2022-01-07 18:58:58 +0100 | <Hayek> | % :t sum |
2022-01-07 18:58:58 +0100 | <yahb> | Hayek: (Foldable t, Num a) => t a -> a |
2022-01-07 18:59:00 +0100 | <[itchyjunk]> | problem 3), mySum, ++, myReverse |
2022-01-07 18:59:20 +0100 | <geekosaur> | right, I'd put the Num part on mySum because the others don't need it |
2022-01-07 18:59:55 +0100 | <geekosaur> | and myReverse would be pretty limited if it only worked on lists of numbers |
2022-01-07 19:00:12 +0100 | nurupo | (~nurupo.ga@user/nurupo) (Quit: nurupo.ga) |
2022-01-07 19:00:25 +0100 | nurupo | (~nurupo.ga@user/nurupo) |
2022-01-07 19:00:28 +0100 | <[itchyjunk]> | i see what you mean. i only want it to be numbers when i need to add then, not always. |
2022-01-07 19:01:04 +0100 | <c_wraith> | The problem even gives you types for each - only one of which has a constraint |
2022-01-07 19:01:32 +0100 | <[itchyjunk]> | Right :x |
2022-01-07 19:01:41 +0100 | waleee | (~waleee@2001:9b0:21d:fc00:398f:b003:b90d:acf4) (Ping timeout: 268 seconds) |
2022-01-07 19:01:57 +0100 | <[itchyjunk]> | I don't grasp the purpose of type constructors |
2022-01-07 19:02:01 +0100 | eggplantade | (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
2022-01-07 19:02:23 +0100 | <[itchyjunk]> | here they say data FightMove = Punch | Kick | Block |
2022-01-07 19:02:24 +0100 | <[itchyjunk]> | https://mmhaskell.com/blog/2016/12/17/making-your-own-data-types-in-haskell |
2022-01-07 19:02:31 +0100 | <[itchyjunk]> | So it's the things that type can do |
2022-01-07 19:02:51 +0100 | <monochrom> | But you need a parametrized type now. |
2022-01-07 19:02:53 +0100 | <[itchyjunk]> | so for my list, would the constructors be the type of things the list can do like produce of sum of elements? |
2022-01-07 19:02:56 +0100 | <geekosaur> | those are data constructors, not type constructors |
2022-01-07 19:02:57 +0100 | <[itchyjunk]> | hmm |
2022-01-07 19:03:05 +0100 | <geekosaur> | consider data Bool = False | True |
2022-01-07 19:03:05 +0100 | [itchyjunk] | scrolls down to parametrized types to read |
2022-01-07 19:03:16 +0100 | <glguy> | [itchyjunk]: In your data FightMove ... , FightMove was the type constructor |
2022-01-07 19:03:19 +0100 | <[itchyjunk]> | ah |
2022-01-07 19:03:27 +0100 | <geekosaur> | Bool is the type constructor, False and True are the data constructors |
2022-01-07 19:03:28 +0100 | waleee | (~waleee@h-98-128-229-110.na.cust.bahnhof.se) |
2022-01-07 19:03:40 +0100 | <geekosaur> | they are values just like 1 or "foo" |
2022-01-07 19:07:32 +0100 | <geekosaur> | in data Maybe a = Nothing | Just a, Maybe is a type constructor which takes a type parameter; Nothing is a value, Just is a data constructor which takes a value of the type you specified with the type constructor |
2022-01-07 19:07:36 +0100 | eggplantade | (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
2022-01-07 19:07:51 +0100 | <geekosaur> | so Just 'a' is a value whose type is Maybe Char |
2022-01-07 19:08:36 +0100 | <glguy> | [itchyjunk]: the cool thing about data constructors is that you can case on them. When you see capitalized identifiers in patterns you know they only match values created with that constructor |
2022-01-07 19:08:44 +0100 | cheater | (~Username@user/cheater) |
2022-01-07 19:09:22 +0100 | <[itchyjunk]> | I get the Maybe being a type constructor but why isn't Just a type constructor but a data constructor? |
2022-01-07 19:09:33 +0100 | <[itchyjunk]> | because of its appearence in RHS there? |
2022-01-07 19:09:41 +0100 | <geekosaur> | because it constructs data instead of constructing types |
2022-01-07 19:10:12 +0100 | <glguy> | [itchyjunk]: there are two distinct levels. Type-level and value-level. |
2022-01-07 19:10:20 +0100 | <[itchyjunk]> | so `Just a` is a value whose type is `Maybe` ? |
2022-01-07 19:10:25 +0100 | <[itchyjunk]> | Why is it `Maybe Char` ? |
2022-01-07 19:10:34 +0100 | <geekosaur> | because I applied Just to a Char |
2022-01-07 19:10:42 +0100 | <geekosaur> | :t 'a' |
2022-01-07 19:10:43 +0100 | <lambdabot> | Char |
2022-01-07 19:10:43 +0100 | <[itchyjunk]> | ahh Just 'a' right |
2022-01-07 19:11:25 +0100 | <[itchyjunk]> | Why is it `Nothing` and not `Nothing a` ? |
2022-01-07 19:11:47 +0100 | <monochrom> | Because "Nothing 5" makes no sense. |
2022-01-07 19:11:49 +0100 | <Michal[m]> | the type is 'Maybe a' not Maybe |
2022-01-07 19:11:50 +0100 | <[itchyjunk]> | Nothing represents when the parameter is left empty right? |
2022-01-07 19:11:59 +0100 | <geekosaur> | because it doesn't take a parameter |
2022-01-07 19:12:00 +0100 | <[itchyjunk]> | Michal[m], oh |
2022-01-07 19:12:03 +0100 | <geekosaur> | :t Just |
2022-01-07 19:12:03 +0100 | <lambdabot> | a -> Maybe a |
2022-01-07 19:12:12 +0100 | <geekosaur> | :t Nothing |
2022-01-07 19:12:13 +0100 | <lambdabot> | Maybe a |
2022-01-07 19:12:25 +0100 | <geekosaur> | this is like the empty list, which can be of any list type |
2022-01-07 19:12:27 +0100 | <geekosaur> | :t [] |
2022-01-07 19:12:28 +0100 | <lambdabot> | [a] |
2022-01-07 19:12:44 +0100 | <geekosaur> | but a list ['c'] is necessarily a list of Char |
2022-01-07 19:12:51 +0100 | <[itchyjunk]> | `data List a = Nothing | ?` so here, i have accounted for my type `List a` to be empty ? |
2022-01-07 19:13:12 +0100 | <geekosaur> | you can't reuse Nothing, unfortunately, it's already associated with Maybe |
2022-01-07 19:13:20 +0100 | <[itchyjunk]> | ah |
2022-01-07 19:13:42 +0100 | <geekosaur> | for historical reasons we often call that Nil |
2022-01-07 19:13:46 +0100 | <[itchyjunk]> | `data List a = EmptyList | ? ` |
2022-01-07 19:13:55 +0100 | <[itchyjunk]> | oh i see `data List a = Nil | ? ` |
2022-01-07 19:14:25 +0100 | <geekosaur> | now think about how a list works. not the [x,y,z] form but the other one which you'll mostly have seen as (x:xs) |
2022-01-07 19:14:40 +0100 | DNH | (~DNH@2a02:8108:1100:16d8:ad26:5398:3e1f:d97d) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
2022-01-07 19:15:26 +0100 | <[itchyjunk]> | a : data List xs 'ish |
2022-01-07 19:15:32 +0100 | <[itchyjunk]> | oops |
2022-01-07 19:15:39 +0100 | <[itchyjunk]> | x : data List xs, maybe? |
2022-01-07 19:15:52 +0100 | <[itchyjunk]> | Wait no, idk what i am saying |
2022-01-07 19:16:09 +0100 | <Michal[m]> | you can construct a list by taking an existing list and adding an element to it |
2022-01-07 19:16:19 +0100 | mikko | (~mikko@2a02:7b40:d418:6a61::1) (Quit: WeeChat 2.7.1) |
2022-01-07 19:16:20 +0100 | <geekosaur> | you can't reuse : for the same reason you can't reuse Nothing |
2022-01-07 19:16:28 +0100 | <Michal[m]> | this should give you the second constructor, beside Nil |
2022-01-07 19:16:29 +0100 | <[itchyjunk]> | Oh :< |
2022-01-07 19:16:34 +0100 | <int-e> | @src [] |
2022-01-07 19:16:34 +0100 | <lambdabot> | data [] a = [] | a : [a] |
2022-01-07 19:17:00 +0100 | <geekosaur> | I was hoping not to give them the answer right out :) |
2022-01-07 19:17:34 +0100 | <int-e> | (this is a lie, you can't actually write that in Haskell (except that's literally how GHC.Types does it)) |
2022-01-07 19:17:36 +0100 | <geekosaur> | should be able to figure that out from how theyve been recursing on the RHS of a list |
2022-01-07 19:18:33 +0100 | <int-e> | we seemed to be a little too far off the correct syntax though :-/ |
2022-01-07 19:18:54 +0100 | <geekosaur> | they're supposed to be building their own list type and defining some functions on it |
2022-01-07 19:19:19 +0100 | <int-e> | (And we still have to figure out what that looks like with different type and constructor names) |
2022-01-07 19:19:28 +0100 | <[itchyjunk]> | hmm |
2022-01-07 19:19:36 +0100 | gehmehgeh | (~user@user/gehmehgeh) (Ping timeout: 276 seconds) |
2022-01-07 19:20:00 +0100 | ProfSimm | (~ProfSimm@87.227.196.109) (Remote host closed the connection) |
2022-01-07 19:21:40 +0100 | <[itchyjunk]> | i need to recursively define it as first element plus rest of List xs and it does down all the way to Nil condition.. i think that is the idea? |
2022-01-07 19:22:08 +0100 | dyeplexer | (~dyeplexer@user/dyeplexer) |
2022-01-07 19:22:26 +0100 | <geekosaur> | yes |
2022-01-07 19:22:41 +0100 | <geekosaur> | the same way you've been recursing on real lists |
2022-01-07 19:23:54 +0100 | jonathanx | (~jonathan@h-178-174-176-109.a357.priv.bahnhof.se) (Remote host closed the connection) |
2022-01-07 19:24:12 +0100 | ProfSimm | (~ProfSimm@87.227.196.109) |
2022-01-07 19:24:17 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
2022-01-07 19:24:59 +0100 | <geekosaur> | I was hoping I could coach you through using how you had been recursing on real lists to realize how they must be defined, and thereby how you would need to define your own |
2022-01-07 19:25:18 +0100 | <geekosaur> | since understanding this is key to understanding how lists work |
2022-01-07 19:25:28 +0100 | <[itchyjunk]> | `data List a = Nil | List a` ish .. |
2022-01-07 19:25:44 +0100 | <geekosaur> | not quite. remember (x:xs) |
2022-01-07 19:25:53 +0100 | <geekosaur> | you only have xs there |
2022-01-07 19:26:28 +0100 | <[itchyjunk]> | `data List a = Nil | a along with List a` |
2022-01-07 19:26:40 +0100 | <geekosaur> | well, actually as written you have x with a data constructor name List |
2022-01-07 19:27:03 +0100 | <geekosaur> | right, now you need to work out how to write that "along with" |
2022-01-07 19:27:08 +0100 | <monochrom> | I happen to think that this is a poor exercise. Be it unpopular opinion. |
2022-01-07 19:27:23 +0100 | gehmehgeh | (~user@user/gehmehgeh) |
2022-01-07 19:27:31 +0100 | <monochrom> | Case 1. If you have taught the [] type properly, then this exercise is too trivial. |
2022-01-07 19:27:47 +0100 | <geekosaur> | you have a better idea for an introduction to recursive data types? |
2022-01-07 19:28:06 +0100 | <monochrom> | Case 2. If you have taught the [] type improperly, then this exercise punishes the good students and rewards the bad students. Here is why: |
2022-01-07 19:28:12 +0100 | jrm | (~jrm@156.34.249.199) (Read error: Connection reset by peer) |
2022-01-07 19:28:32 +0100 | jrm | (~jrm@156.34.249.199) |
2022-01-07 19:29:12 +0100 | <monochrom> | For student who want to understand: Since you taught [] improperly, they don't know where to start for understanding, hell, you probably taught them wrong ideas to start. There is nothing to chew on. |
2022-01-07 19:29:55 +0100 | <monochrom> | For student who want to cargo-cult: They can just look at "data [a] = [] | a : [a]" and change syntax. This still does not need understanding. |
2022-01-07 19:30:05 +0100 | <[itchyjunk]> | How does the : look like without sugar syntax? |
2022-01-07 19:30:25 +0100 | <geekosaur> | it's not sugar, it's just an operator-style data constructor |
2022-01-07 19:30:45 +0100 | <geekosaur> | these all start with : which is arbitrarily considered an "uppercase" symbol character |
2022-01-07 19:31:02 +0100 | enikar | suggest renamed : as cons |
2022-01-07 19:31:15 +0100 | <c_wraith> | the [] case is sugar though. That one is a totally special case. |
2022-01-07 19:31:49 +0100 | <c_wraith> | monochrom: I think there's value in showing people they can reimplement what [] does - the only magical things are the names. |
2022-01-07 19:31:58 +0100 | lavaman | (~lavaman@98.38.249.169) |
2022-01-07 19:32:01 +0100 | <geekosaur> | we also have data NonEmpty a = a :| [a] |
2022-01-07 19:32:02 +0100 | <[itchyjunk]> | `data List (x:xs) = Nil| x : List xs` conceptually but i don't get to use : because it's already used ? |
2022-01-07 19:32:22 +0100 | <geekosaur> | where :| is the constructor |
2022-01-07 19:32:30 +0100 | <monochrom> | Yes, therefore I don't pose it as an exercise, I give it as an example. |
2022-01-07 19:32:57 +0100 | raehik | (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 240 seconds) |
2022-01-07 19:33:03 +0100 | <[itchyjunk]> | hmm |
2022-01-07 19:33:21 +0100 | <monochrom> | A good exercise is not to ask students to reinvent list but to design variations. |
2022-01-07 19:33:40 +0100 | zer0bitz | (~zer0bitz@196.244.192.57) |
2022-01-07 19:36:13 +0100 | <EvanR> | reinventing the let wheel = "roll... " : wheel in wheel |
2022-01-07 19:39:00 +0100 | jgeerds | (~jgeerds@55d4bbed.access.ecotel.net) |
2022-01-07 19:40:24 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) (Remote host closed the connection) |
2022-01-07 19:42:30 +0100 | <[itchyjunk]> | I don't think i've managed to reinvent this wheel yet though. hopefully this clicks soon.. |
2022-01-07 19:42:37 +0100 | dyeplexer | (~dyeplexer@user/dyeplexer) (Remote host closed the connection) |
2022-01-07 19:44:17 +0100 | jrm | (~jrm@156.34.249.199) (Ping timeout: 240 seconds) |
2022-01-07 19:47:01 +0100 | eggplantade | (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
2022-01-07 19:47:03 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
2022-01-07 19:51:38 +0100 | <geekosaur> | all you need to do is pick some other operator name that starts with a colon. :| and :+ are taken, and comma is reserved so :, won't work |
2022-01-07 19:51:58 +0100 | <geekosaur> | or you can define it with a prefix name instead of an infix operator |
2022-01-07 19:52:58 +0100 | <c_wraith> | oh, huh. It never occurred to me that , is too reserved to use in an operator. I guess [ and ] are, too. |
2022-01-07 19:53:23 +0100 | <geekosaur> | I thought it might work until I considered (:,) |
2022-01-07 19:56:27 +0100 | DNH | (~DNH@2a02:8108:1100:16d8:ad26:5398:3e1f:d97d) |
2022-01-07 19:56:38 +0100 | <geekosaur> | it does raise an interesting parse error if you attempt it |
2022-01-07 19:59:09 +0100 | <[itchyjunk]> | Right, i think i solved the mystery. When you said pick an operator, that was a strong hint that i wasn't internalizing |
2022-01-07 19:59:19 +0100 | <[itchyjunk]> | data constructor is an actual operator |
2022-01-07 19:59:35 +0100 | <[itchyjunk]> | `data List a = Nil | Cons a (List a)` |
2022-01-07 20:00:59 +0100 | <geekosaur> | there you go |
2022-01-07 20:01:19 +0100 | <geekosaur> | you could also choose an operator like ::: although it'd be a PITA |
2022-01-07 20:01:25 +0100 | <EvanR> | data I'mCool a = Shade :~!#$? Shade |
2022-01-07 20:01:29 +0100 | <geekosaur> | (:: is taken) |
2022-01-07 20:02:14 +0100 | eggplantade | (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
2022-01-07 20:02:17 +0100 | eastbillie | (~gallup@192-222-138-215.qc.cable.ebox.net) |
2022-01-07 20:02:18 +0100 | abarbu | (~user@c-66-31-23-28.hsd1.ma.comcast.net) (Read error: Connection reset by peer) |
2022-01-07 20:02:23 +0100 | eastbillie | (~gallup@192-222-138-215.qc.cable.ebox.net) (Client Quit) |
2022-01-07 20:02:51 +0100 | <c_wraith> | I'd probably pretend I don't know Cofree exists and just use :< |
2022-01-07 20:02:52 +0100 | ouestbillie | (~gallup@192-222-138-215.qc.cable.ebox.net) |
2022-01-07 20:03:09 +0100 | <monochrom> | I use :> |
2022-01-07 20:03:16 +0100 | <[itchyjunk]> | so `I'mCool` is a type constructor and `a` is a parameter. this only has one data constructor called `Shade` that takes 2 parameter `:~!#$?` and `Shade` ? |
2022-01-07 20:03:28 +0100 | <geekosaur> | nope |
2022-01-07 20:03:32 +0100 | <EvanR> | no :~!#$? is the constructor |
2022-01-07 20:03:33 +0100 | <[itchyjunk]> | :( |
2022-01-07 20:03:44 +0100 | <EvanR> | just like in [] |
2022-01-07 20:03:47 +0100 | <geekosaur> | remember iniitial : is an operator-style constructor |
2022-01-07 20:03:49 +0100 | <EvanR> | starts with a colon |
2022-01-07 20:04:23 +0100 | <EvanR> | haskell is cool for having this but now I'm questioning if it's quite counterintuitive xD |
2022-01-07 20:04:25 +0100 | <geekosaur> | so you have a constructor :-!#$? with two Shade parameters |
2022-01-07 20:04:31 +0100 | <c_wraith> | and since no one else has called it out, I will. you can be cool if you have a pair of shades |
2022-01-07 20:04:51 +0100 | simendsjo | (~user@84.211.91.241) |
2022-01-07 20:05:34 +0100 | <monochrom> | BTW if you have "data List a = Nil | a `Cons` List a deriving Show" or "data I'mCool a = (:~!#$?) Shade Shade deriving Show", the derived Show instances will actually respect your non-default choice of fixity. |
2022-01-07 20:06:04 +0100 | <EvanR> | did not know that |
2022-01-07 20:06:19 +0100 | qwertyasda | (~Qwerty@wsip-174-71-193-82.lv.lv.cox.net) |
2022-01-07 20:07:00 +0100 | justsomeguy | (~justsomeg@user/justsomeguy) |
2022-01-07 20:07:19 +0100 | <EvanR> | @let data Int2 = Int `I2` Int |
2022-01-07 20:07:20 +0100 | <lambdabot> | Defined. |
2022-01-07 20:07:26 +0100 | <EvanR> | > I2 1 2 |
2022-01-07 20:07:28 +0100 | <lambdabot> | error: |
2022-01-07 20:07:28 +0100 | <lambdabot> | • No instance for (Show Int2) |
2022-01-07 20:07:28 +0100 | <lambdabot> | arising from a use of ‘show_M59481879713528625638’ |
2022-01-07 20:07:33 +0100 | <EvanR> | @undefined |
2022-01-07 20:07:33 +0100 | <lambdabot> | Undefined. |
2022-01-07 20:07:36 +0100 | <EvanR> | @let data Int2 = Int `I2` Int deriving Show |
2022-01-07 20:07:37 +0100 | <lambdabot> | Defined. |
2022-01-07 20:07:38 +0100 | <EvanR> | > I2 1 2 |
2022-01-07 20:07:40 +0100 | <lambdabot> | 1 `I2` 2 |
2022-01-07 20:07:41 +0100 | qwertyasda | (~Qwerty@wsip-174-71-193-82.lv.lv.cox.net) (Quit: Leaving) |
2022-01-07 20:08:32 +0100 | <EvanR> | next time I'm at a loss at a party I'll bring that up |
2022-01-07 20:09:46 +0100 | <c_wraith> | I seem to recall derived show not respecting fixity declarations on punctuation operator constructors, though |
2022-01-07 20:11:06 +0100 | <geekosaur> | I recall thatr being raised as a bug several years ago but don't know if it's been fixed |
2022-01-07 20:11:49 +0100 | jgeerds | (~jgeerds@55d4bbed.access.ecotel.net) (Ping timeout: 240 seconds) |
2022-01-07 20:16:45 +0100 | <glguy> | @let data Example = Int :* Example | End deriving Show; infixr 5 :* |
2022-01-07 20:16:46 +0100 | <lambdabot> | Defined. |
2022-01-07 20:16:46 +0100 | <glguy> | 1 :* 2 :* 3 :* End |
2022-01-07 20:16:51 +0100 | <glguy> | > 1 :* 2 :* 3 :* End |
2022-01-07 20:16:52 +0100 | <lambdabot> | 1 :* (2 :* (3 :* End)) |
2022-01-07 20:17:29 +0100 | <geekosaur> | mm, the one I recall is where it omits necessary parens, such that the result isn't parsable |
2022-01-07 20:17:45 +0100 | <geekosaur> | that one's just a little unfortunate but still works |
2022-01-07 20:18:06 +0100 | <glguy> | > Just (1 :* 2 :* 3 :* End) |
2022-01-07 20:18:07 +0100 | <lambdabot> | Just (1 :* (2 :* (3 :* End))) |
2022-01-07 20:18:33 +0100 | <glguy> | I don't know about the unparsable issue |
2022-01-07 20:19:04 +0100 | <geekosaur> | I didn't find it on a quick search so that one may have been fixed already |
2022-01-07 20:24:40 +0100 | justsomeguy | (~justsomeg@user/justsomeguy) (Quit: WeeChat 3.3) |
2022-01-07 20:31:24 +0100 | burnsidesLlama | (~burnsides@dhcp168-021.wadham.ox.ac.uk) (Remote host closed the connection) |
2022-01-07 20:33:57 +0100 | lavaman | (~lavaman@98.38.249.169) (Ping timeout: 240 seconds) |
2022-01-07 20:35:56 +0100 | <c_wraith> | what's odd is that showsPrec is so mechanical to implement respecting fixity, it seems like it would be feasible to have the deriving mechanism do it. |
2022-01-07 20:36:42 +0100 | <glguy> | I think the trouble is that showsPrec doesn't know about fixity, only precedence, so it has to make a worst case assumption |
2022-01-07 20:37:55 +0100 | coot | (~coot@89-64-85-93.dynamic.chello.pl) |
2022-01-07 20:44:23 +0100 | johnw | (~johnw@2607:f6f0:3004:1:c8b4:50ff:fef8:6bf0) |
2022-01-07 20:48:52 +0100 | cosimone | (~user@2001:b07:ae5:db26:c24a:d20:4d91:1e20) (Remote host closed the connection) |
2022-01-07 20:49:10 +0100 | mvk | (~mvk@2607:fea8:5cdd:f000::45db) |
2022-01-07 20:51:21 +0100 | doyougnu | (~doyougnu@c-73-25-202-122.hsd1.or.comcast.net) |
2022-01-07 20:51:45 +0100 | cosimone | (~user@2001:b07:ae5:db26:c24a:d20:4d91:1e20) |
2022-01-07 20:53:17 +0100 | jgeerds | (~jgeerds@55d4bbed.access.ecotel.net) |
2022-01-07 20:53:30 +0100 | xmyst | (~xmyst@ip5f5ac363.dynamic.kabel-deutschland.de) |
2022-01-07 20:54:28 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) |
2022-01-07 20:54:57 +0100 | Feuermagier | (~Feuermagi@user/feuermagier) (Ping timeout: 240 seconds) |
2022-01-07 20:55:17 +0100 | jgeerds | (~jgeerds@55d4bbed.access.ecotel.net) (Remote host closed the connection) |
2022-01-07 20:57:55 +0100 | cheater | (~Username@user/cheater) (Quit: (BitchX) Bob Barker uses BitchX. Have your BitchX spayed or neutered.) |
2022-01-07 21:04:35 +0100 | cheater | (~Username@user/cheater) |
2022-01-07 21:05:13 +0100 | juhp | (~juhp@128.106.188.82) (Ping timeout: 256 seconds) |
2022-01-07 21:05:42 +0100 | jrm | (~jrm@156.34.249.199) |
2022-01-07 21:08:04 +0100 | juhp | (~juhp@128.106.188.82) |
2022-01-07 21:09:15 +0100 | burnsidesLlama | (~burnsides@dhcp168-021.wadham.ox.ac.uk) |
2022-01-07 21:14:51 +0100 | burnsidesLlama | (~burnsides@dhcp168-021.wadham.ox.ac.uk) (Ping timeout: 256 seconds) |
2022-01-07 21:16:19 +0100 | coolnickname | (uid531864@user/coolnickname) |
2022-01-07 21:36:28 +0100 | motherfsck | (~motherfsc@user/motherfsck) (Remote host closed the connection) |
2022-01-07 21:37:33 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
2022-01-07 21:38:39 +0100 | Hayek | (~xxx@rrcs-173-196-3-254.west.biz.rr.com) (Ping timeout: 256 seconds) |
2022-01-07 21:46:35 +0100 | ouestbillie | (~gallup@192-222-138-215.qc.cable.ebox.net) (Ping timeout: 256 seconds) |
2022-01-07 21:46:59 +0100 | <dmj`> | almost started funding the wrong haskell foundation https://www.haskellfoundation.org/donate/ |
2022-01-07 21:47:21 +0100 | vysn | (~vysn@user/vysn) |
2022-01-07 21:49:36 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) |
2022-01-07 21:49:56 +0100 | <Hecate> | hahahahahaha |
2022-01-07 21:51:21 +0100 | burnsidesLlama | (~burnsides@dhcp168-021.wadham.ox.ac.uk) |
2022-01-07 21:51:50 +0100 | <dmj`> | saw "tribal affiliation" and was like "Is this related to the burning bridges proposal?" |
2022-01-07 21:53:02 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
2022-01-07 21:55:12 +0100 | Shiranai | (~Shiranai@190.237.13.79) |
2022-01-07 21:55:39 +0100 | burnsidesLlama | (~burnsides@dhcp168-021.wadham.ox.ac.uk) (Ping timeout: 256 seconds) |
2022-01-07 21:55:57 +0100 | pavonia | (~user@user/siracusa) |
2022-01-07 22:01:13 +0100 | Inst | (~delicacie@c-98-208-218-119.hsd1.fl.comcast.net) |
2022-01-07 22:02:32 +0100 | eggplantade | (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
2022-01-07 22:02:44 +0100 | <Shiranai> | Hello, I'm writing a function with signature `(Int, Bool) -> Command -> Just (Int, Bool)` for use in a foldM. I want Bool to be used as a flag for shortcircuiting the loop, I tried `myFunc (val, True)=Just (val, True)` but does not seem to shortcircuit as I expected |
2022-01-07 22:03:26 +0100 | cosimone | (~user@2001:b07:ae5:db26:c24a:d20:4d91:1e20) (Ping timeout: 252 seconds) |
2022-01-07 22:03:31 +0100 | <Shiranai> | I meant `myFunc (val, True) _ = Just (val, True)` |
2022-01-07 22:03:38 +0100 | takuan | (~takuan@178-116-218-225.access.telenet.be) (Remote host closed the connection) |
2022-01-07 22:04:07 +0100 | <xerox> | @src foldM |
2022-01-07 22:04:07 +0100 | <lambdabot> | foldM _ a [] = return a |
2022-01-07 22:04:07 +0100 | <lambdabot> | foldM f a (x:xs) = f a x >>= \fax -> foldM f fax xs |
2022-01-07 22:04:07 +0100 | <Shiranai> | how do shortcircuit correctly? |
2022-01-07 22:04:21 +0100 | <xerox> | looks like f can't decide to shortcut |
2022-01-07 22:04:22 +0100 | raehik | (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) |
2022-01-07 22:05:01 +0100 | <xerox> | >>= is happening no matter what f uses of its arguments |
2022-01-07 22:05:24 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) (Remote host closed the connection) |
2022-01-07 22:05:44 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
2022-01-07 22:05:51 +0100 | <Shiranai> | hmmm thanks, any idea how to shortcut through other means? |
2022-01-07 22:06:16 +0100 | <xerox> | @src foldr |
2022-01-07 22:06:16 +0100 | <lambdabot> | foldr f z [] = z |
2022-01-07 22:06:16 +0100 | <lambdabot> | foldr f z (x:xs) = f x (foldr f z xs) |
2022-01-07 22:06:27 +0100 | <xerox> | this one can because f can ignore the rest of the fold, it's second argument |
2022-01-07 22:06:43 +0100 | eggplantade | (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
2022-01-07 22:07:06 +0100 | <Shiranai> | is there a monadic version though? I need to use Maybe |
2022-01-07 22:08:02 +0100 | <sshine> | use Maybe where? |
2022-01-07 22:09:28 +0100 | <dmj`> | why use Bool to short circuit when Maybe automatically short circuits |
2022-01-07 22:09:29 +0100 | <Shiranai> | I'm parsing a list of commands so I need to use something like foldM and Maybe |
2022-01-07 22:10:18 +0100 | <Shiranai> | because I want to rescue the other value in the pair (Int, Maybe) |
2022-01-07 22:10:19 +0100 | <EvanR> | you can also use direct recursion to short circuit |
2022-01-07 22:11:18 +0100 | <Shiranai> | (Int, Bool)* I meant |
2022-01-07 22:11:19 +0100 | <EvanR> | I suspect there is a more elegant way for you to write it without the Bool flag in a pair |
2022-01-07 22:11:27 +0100 | <Shiranai> | agree |
2022-01-07 22:11:31 +0100 | <xerox> | what does the fold do? |
2022-01-07 22:11:48 +0100 | <Shiranai> | I have no idea what it may be though |
2022-01-07 22:12:14 +0100 | <EvanR> | what is the Just for |
2022-01-07 22:12:20 +0100 | <EvanR> | I mean, Maybe |
2022-01-07 22:12:37 +0100 | <EvanR> | that also can short circuit |
2022-01-07 22:13:16 +0100 | <c_wraith> | You probably want Either instead of Maybe, in this case |
2022-01-07 22:13:35 +0100 | <c_wraith> | Either Int Int short-circuits and actually returns the result. :) |
2022-01-07 22:14:02 +0100 | <xerox> | ah nice the left interrupts >>= ! |
2022-01-07 22:14:13 +0100 | <c_wraith> | yes it does! |
2022-01-07 22:15:04 +0100 | <Shiranai> | the fold parses a list of comments, most of the commands change the value of an Int, but the return command implies that there is no need for keep reading the rest of the commands, so that's why I thought of using (Int, Bool) as the accumulator |
2022-01-07 22:15:06 +0100 | <EvanR> | then there's the awkward use of Either ErrorMsg () which is like reversed use of Maybe |
2022-01-07 22:17:11 +0100 | simendsjo | (~user@84.211.91.241) (Ping timeout: 256 seconds) |
2022-01-07 22:17:49 +0100 | <dmj`> | Shiranai: can you paste your code? |
2022-01-07 22:17:52 +0100 | <EvanR> | when it comes to "complicated" monadic loops, I often write the loop logic as a new combinator and use that |
2022-01-07 22:18:07 +0100 | <EvanR> | instead of trying to use a premade loop (from a package) or foldM |
2022-01-07 22:18:17 +0100 | nhatanh02 | (~satori@123.24.172.30) (Ping timeout: 240 seconds) |
2022-01-07 22:18:28 +0100 | <EvanR> | Control.Monad.Loops has like 30 loops and often none of them fit |
2022-01-07 22:18:48 +0100 | <Shiranai> | dmj` I probably shouldn't since it's some kind of assignment, that's why I'm being vague, sorry about that |
2022-01-07 22:19:17 +0100 | raehik | (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 240 seconds) |
2022-01-07 22:19:40 +0100 | <Shiranai> | yeah I think doing a custom loop is the way to go without refactoring a lot of a code, thanks! |
2022-01-07 22:20:21 +0100 | <EvanR> | but c_wraith idea sounded likely |
2022-01-07 22:21:09 +0100 | _ht | (~quassel@82-169-194-8.biz.kpn.net) (Remote host closed the connection) |
2022-01-07 22:21:42 +0100 | Franciman | (~Franciman@mx1.fracta.dev) |
2022-01-07 22:21:54 +0100 | Franciman | (~Franciman@mx1.fracta.dev) (haskell is cringe) |
2022-01-07 22:23:57 +0100 | Inst | (~delicacie@c-98-208-218-119.hsd1.fl.comcast.net) (Ping timeout: 240 seconds) |
2022-01-07 22:25:24 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) (Remote host closed the connection) |
2022-01-07 22:25:46 +0100 | Franciman | (~Franciman@mx1.fracta.dev) |
2022-01-07 22:25:49 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
2022-01-07 22:25:57 +0100 | <Franciman> | hello, what's the difference between the native code generator of haskell |
2022-01-07 22:26:01 +0100 | <Franciman> | and the llvm based one? |
2022-01-07 22:26:10 +0100 | <Franciman> | and why is the llvm based one known to be better even if slower? |
2022-01-07 22:26:17 +0100 | <Franciman> | what's the use of a native code generator of haskell? |
2022-01-07 22:26:22 +0100 | <Franciman> | why would i need it? |
2022-01-07 22:26:23 +0100 | f-a | (f2a@f2a.jujube.ircnow.org) |
2022-01-07 22:26:35 +0100 | <Franciman> | is it to have a sort of autarchy? |
2022-01-07 22:26:39 +0100 | <Franciman> | having a self contained system? |
2022-01-07 22:26:49 +0100 | <geekosaur> | llvm is slower because we can't pass it information it needs to optimize and they have no interest in adding ghc-specific support that would be needed |
2022-01-07 22:27:24 +0100 | <geekosaur> | you can get significantly better code natively |
2022-01-07 22:27:36 +0100 | <Franciman> | yet i seem to understand it produce at least as good code as the native code generator |
2022-01-07 22:27:40 +0100 | <Franciman> | that's what the docs report |
2022-01-07 22:27:51 +0100 | <Franciman> | i suppose |
2022-01-07 22:28:33 +0100 | <geekosaur> | ghc itself does, but llvm's optimizer defaults to doing as little as possible of its own optimization because it doesn't really understand the IR ghc generates |
2022-01-07 22:29:00 +0100 | <geekosaur> | and never will because it's all CPSed and llvm won't add support for ghc's CPS transforms |
2022-01-07 22:29:23 +0100 | <Franciman> | makes total sense to me |
2022-01-07 22:29:58 +0100 | <geekosaur> | and ghc needs all the optimization help it can get because graph reduction is inherently less performant than direct code |
2022-01-07 22:30:34 +0100 | <Franciman> | makes sense i see. Do you think LLVM backend can help soothe this problem, tho? https://gitlab.haskell.org/ghc/ghc/-/issues/20445 |
2022-01-07 22:31:01 +0100 | n3rdy1 | (~n3rdy1@2600:1700:4570:3480::41) |
2022-01-07 22:31:03 +0100 | <Franciman> | that's why i was asking what's the need of a native backend when it's bugged |
2022-01-07 22:31:09 +0100 | <Franciman> | but the fact that it supports special needs |
2022-01-07 22:31:13 +0100 | <Franciman> | is more than better answer |
2022-01-07 22:31:15 +0100 | <Franciman> | thanks geekosaur |
2022-01-07 22:31:43 +0100 | <geekosaur> | 9.0.2 should hopefully fix that one |
2022-01-07 22:32:03 +0100 | <geekosaur> | it's not unusual that .1 point releases are buggy, that's why there are later releases |
2022-01-07 22:32:36 +0100 | <geekosaur> | we actually went through the same thing with m1 llvm support, but the ".1" release was 8.10.5 |
2022-01-07 22:32:44 +0100 | <geekosaur> | wasn't stable until 8.10.7 |
2022-01-07 22:32:54 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) (Remote host closed the connection) |
2022-01-07 22:33:06 +0100 | <geekosaur> | so it's not like llvm is always better codegen-wise |
2022-01-07 22:33:15 +0100 | jonathanx | (~jonathan@h-178-174-176-109.a357.priv.bahnhof.se) |
2022-01-07 22:34:50 +0100 | <Franciman> | i just quoted the docs |
2022-01-07 22:35:16 +0100 | <dmj`> | If GHC went from STG to LLVM directly it'd probably be faster than the current approach of Cmm to LLVM. |
2022-01-07 22:36:29 +0100 | <Franciman> | dmj`: faster but maybe produce worse code |
2022-01-07 22:36:56 +0100 | <EvanR> | clarification please, the LLVM backend is slower... meaning it takes longer to produce code, or the resulting code is slower |
2022-01-07 22:37:17 +0100 | <Franciman> | takes longer to produce code |
2022-01-07 22:38:01 +0100 | <EvanR> | and resulting code is about the same performance? |
2022-01-07 22:39:06 +0100 | <dmj`> | Franciman: it actually took longer to produce ARM code before we got the native ARM backend, since LLVM was just being used as an additional translation layer to get to ARM by way of Cmm. |
2022-01-07 22:39:07 +0100 | burnsidesLlama | (~burnsides@dhcp168-021.wadham.ox.ac.uk) |
2022-01-07 22:42:43 +0100 | <geekosaur> | the code is also generally less performant although this depends on the exact code |
2022-01-07 22:42:57 +0100 | <geekosaur> | numeric operations are often as fast or faster |
2022-01-07 22:43:24 +0100 | burnsidesLlama | (~burnsides@dhcp168-021.wadham.ox.ac.uk) (Ping timeout: 256 seconds) |
2022-01-07 22:48:00 +0100 | <dmj`> | geekosaur: do we have any benchmarks to compare STG -> LLVM vs. Cmm -> LLVM? I think that would be super interesting. |
2022-01-07 22:48:27 +0100 | Shiranai | (~Shiranai@190.237.13.79) (Quit: Connection closed) |
2022-01-07 22:50:03 +0100 | <geekosaur> | no, there is currently no way for ghc to go directly stg -> llvm |
2022-01-07 22:50:29 +0100 | <geekosaur> | and little interest in doing so since the llvm folks aren't interested either |
2022-01-07 22:51:08 +0100 | mc47 | (~mc47@xmonad/TheMC47) (Remote host closed the connection) |
2022-01-07 22:51:19 +0100 | <geekosaur> | you might wan tto talk to the folks in #ghc about it but this is my understanding of the situation |
2022-01-07 22:51:33 +0100 | <geekosaur> | (I think you want moritz angermann) |
2022-01-07 22:51:54 +0100 | jonathanx | (~jonathan@h-178-174-176-109.a357.priv.bahnhof.se) (Remote host closed the connection) |
2022-01-07 22:52:06 +0100 | Franciman | (~Franciman@mx1.fracta.dev) (long live telescope) |
2022-01-07 22:52:12 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
2022-01-07 22:53:11 +0100 | <geekosaur> | llvm is currently something of a bastard child because doing anything significant over what ghc already does requires teaching llvm about ghc's cps-ed code |
2022-01-07 22:53:57 +0100 | <geekosaur> | so almost all effort has gone into the native backends, with the exception of m1 support because it required such radical changes |
2022-01-07 22:55:41 +0100 | <geekosaur> | (basically, apple decided to get rid of C-style type promotion, everything is its native size. which had to be reflected everywhere, so for example in 9.2.x Char# is 32 bits and Word8# is 8 bits) |
2022-01-07 22:56:05 +0100 | OscarZ_ | (~oscarz@95.175.104.170) |
2022-01-07 22:57:46 +0100 | <dmj`> | geekosaur: Interesting, I know compiling HOFs isn't feasible, which I imagine a CPS pass would create a lot of. GRIN can handle those (HOFs) through a defunctionalization pass. This could also be done in Core before you even get to STG / Cmm. I've wondered why GHC doesn't completely monomorphize up front, then CPS transform, defunctionalize, optimize, then codegen to LLVM. MLTon does this more or less. |
2022-01-07 22:58:20 +0100 | eggplantade | (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
2022-01-07 22:58:23 +0100 | <geekosaur> | you'd have to ask them |
2022-01-07 22:58:25 +0100 | <dmj`> | well, you'd have to lambda lift and closure convert before defunctionalizing too |
2022-01-07 22:58:52 +0100 | <dmj`> | geekosaur: I think its because you can't encode existentials when you monomorphize, but maybe I'm wrong |
2022-01-07 22:59:26 +0100 | f-a | (f2a@f2a.jujube.ircnow.org) () |
2022-01-07 22:59:27 +0100 | <geekosaur> | afaik existentials as such cease to exist as distinct entities past the typechecker |
2022-01-07 23:00:05 +0100 | DNH | (~DNH@2a02:8108:1100:16d8:ad26:5398:3e1f:d97d) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
2022-01-07 23:00:25 +0100 | <monochrom> | My understanding is that STG moves support for HOFs to the RTS and it is a very direct form of support, i.e., without encoding it by defunctionalization. |
2022-01-07 23:02:42 +0100 | <monochrom> | For example if you look at generated Cmm code you can see it calling functions with names like "ap1_fast", which are functions provided by the RTS. |
2022-01-07 23:03:15 +0100 | sub0 | (~bc8147f2@cerf.good1.com) |
2022-01-07 23:03:17 +0100 | Pickchea | (~private@user/pickchea) |
2022-01-07 23:03:54 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) (Remote host closed the connection) |
2022-01-07 23:04:14 +0100 | <dmj`> | monochrom: interesting, I know defunctionalization requires a whole program pass, so maybe GHC being incremental makes it a non-starter. |
2022-01-07 23:04:20 +0100 | jonathanx | (~jonathan@h-178-174-176-109.a357.priv.bahnhof.se) |
2022-01-07 23:04:49 +0100 | <monochrom> | I would describe STG as thunk-passing style instead of continuation-passing style. :) |
2022-01-07 23:04:51 +0100 | <geekosaur> | that was one of the changes grin had to make to ghc, yeh |
2022-01-07 23:05:03 +0100 | <monochrom> | Or s/thunk/closure/ if you will. |
2022-01-07 23:05:10 +0100 | glguy | (x@libera/staff/glguy) (Quit: Quit) |
2022-01-07 23:05:23 +0100 | glguy | (x@libera/staff/glguy) |
2022-01-07 23:05:24 +0100 | jonathanx | (~jonathan@h-178-174-176-109.a357.priv.bahnhof.se) (Remote host closed the connection) |
2022-01-07 23:05:43 +0100 | jonathanx | (~jonathan@h-178-174-176-109.A357.priv.bahnhof.se) |
2022-01-07 23:05:58 +0100 | eggplantade | (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
2022-01-07 23:06:14 +0100 | <dmj`> | geekosaur: hmm, yea the modpak files got merged iirc. I wonder if a ghc-plugin would have been more appropriate, or if that is even possible with the plugin architecture. |
2022-01-07 23:08:03 +0100 | <dmj`> | monochrom: One of the arguments I've heard against GHC going whole program optimizing is that cross module inlining is good enough. I wonder how well this holds up in practice, because I'm pretty sure GHC will generate code that does a blind JMP to some function pointer address for all unknown calls, which are probably a lot I imagine. |
2022-01-07 23:09:20 +0100 | <geekosaur> | I find myself wondering of there are some other barriers to it |
2022-01-07 23:09:30 +0100 | <int-e> | memory usage? |
2022-01-07 23:10:03 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) |
2022-01-07 23:10:03 +0100 | wroathe | (~wroathe@206-55-188-8.fttp.usinternet.com) (Changing host) |
2022-01-07 23:10:03 +0100 | wroathe | (~wroathe@user/wroathe) |
2022-01-07 23:10:15 +0100 | <geekosaur> | like, the inlinePerformIO hullabaloo suggests to me that ghc relies on *not* doing inlining in some cases to prevent lifting things that shouldn't be lifted |
2022-01-07 23:10:48 +0100 | kupi | (uid212005@id-212005.hampstead.irccloud.com) (Quit: Connection closed for inactivity) |
2022-01-07 23:11:02 +0100 | <geekosaur> | and of WPC exposes IO definitions for inlining then that barrier might be hard to maintain |
2022-01-07 23:11:18 +0100 | <geekosaur> | *if WPC |
2022-01-07 23:12:07 +0100 | jackhill | KM4MBG |
2022-01-07 23:12:35 +0100 | KM4MBG | jackhill |
2022-01-07 23:16:31 +0100 | <dmj`> | seems like Lennart has done it and thinks its ok https://twitter.com/Augustsson/status/1104924762499768320 |
2022-01-07 23:16:46 +0100 | coot | (~coot@89-64-85-93.dynamic.chello.pl) () |
2022-01-07 23:17:11 +0100 | coot | (~coot@2a02:a310:e03f:8500:5cc8:47c:8ec0:b827) |
2022-01-07 23:17:36 +0100 | eggplantade | (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
2022-01-07 23:17:57 +0100 | n3rdy1 | (~n3rdy1@2600:1700:4570:3480::41) (Ping timeout: 240 seconds) |
2022-01-07 23:18:22 +0100 | <EvanR> | monochrom, you just changed from thunk to closure. I'm not sure which one is more vague (outside context of GHC guts) |
2022-01-07 23:18:28 +0100 | <geekosaur> | the question I have there, as above, is whether *ghc* can do this or if it'd require significant rearchitecting to the point of writing a whole new compiler as lennart did |
2022-01-07 23:21:32 +0100 | xff0x | (~xff0x@2001:1a81:525f:5800:1882:d375:707:2176) (Ping timeout: 240 seconds) |
2022-01-07 23:21:57 +0100 | coot | (~coot@2a02:a310:e03f:8500:5cc8:47c:8ec0:b827) (Ping timeout: 240 seconds) |
2022-01-07 23:21:58 +0100 | acidjnk_new3 | (~acidjnk@p200300d0c7271e73e4c690103e77be5f.dip0.t-ipconnect.de) |
2022-01-07 23:21:58 +0100 | acidjnk | (~acidjnk@p200300d0c7271e73e4c690103e77be5f.dip0.t-ipconnect.de) |
2022-01-07 23:22:08 +0100 | <monochrom> | EvanR, the good news and bad news is that STG finds that it can use closures for thunks (and a lot of other things) so "everything is a closure". In this context, "closure" is not vague. |
2022-01-07 23:22:32 +0100 | <EvanR> | everything is a closure, great |
2022-01-07 23:22:35 +0100 | <EvanR> | so it's like a box |
2022-01-07 23:22:43 +0100 | xff0x | (~xff0x@2001:1a81:525f:5800:6161:847e:32a5:3ca7) |
2022-01-07 23:24:32 +0100 | <dmj`> | geekosaur: that's a good question, I don't know. Not many optimizations happen in STG (afaik), GRIN is its supposed successor, yet it performs all the optimizations. So if GRIN is to be included in GHC why do the optimizations in Core at all? Unless there is a way to combine GRIN and Core. GRIN being first-order makes me lean no. |
2022-01-07 23:25:19 +0100 | <dmj`> | If you keep the compiler frontend is it considered a rewrite ? :) |
2022-01-07 23:25:45 +0100 | <geekosaur> | you might ask the grin folks that question :) |
2022-01-07 23:26:09 +0100 | <geekosaur> | I'd also be interested in finding out as above if they had any issues with IO escaping its boundaries |
2022-01-07 23:26:38 +0100 | <geekosaur> | although I guess that part lives in the frontend, so probably no unless they didn;t do due diligence with the WPC part |
2022-01-07 23:30:47 +0100 | evocatus | (~evocatus@62.182.77.224) |
2022-01-07 23:31:01 +0100 | n3rdy1 | (~n3rdy1@2600:1700:4570:3480:1b88:50f:dae0:9293) |
2022-01-07 23:31:24 +0100 | evocatus | (~evocatus@62.182.77.224) (Remote host closed the connection) |
2022-01-07 23:33:55 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
2022-01-07 23:35:44 +0100 | raehik | (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) |
2022-01-07 23:39:15 +0100 | tromp | (~textual@dhcp-077-249-230-040.chello.nl) |
2022-01-07 23:39:30 +0100 | <dmj`> | geekosaur: sure, will see what I can find out about IO escaping boundaries |
2022-01-07 23:44:26 +0100 | motherfsck | (~motherfsc@user/motherfsck) |
2022-01-07 23:46:08 +0100 | DNH | (~DNH@2a02:8108:1100:16d8:ad26:5398:3e1f:d97d) |
2022-01-07 23:47:17 +0100 | raehik | (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 240 seconds) |
2022-01-07 23:48:17 +0100 | Pickchea | (~private@user/pickchea) (Ping timeout: 240 seconds) |
2022-01-07 23:51:37 +0100 | shapr | (~user@2601:7c0:c202:5190:1c89:9f27:44af:85b3) (Ping timeout: 240 seconds) |
2022-01-07 23:52:06 +0100 | wyrd | (~wyrd@gateway/tor-sasl/wyrd) (Quit: leaving) |
2022-01-07 23:52:08 +0100 | eggplantade | (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
2022-01-07 23:52:36 +0100 | raehik | (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) |
2022-01-07 23:53:02 +0100 | cemg | (~cemguresc@2001:a61:11ff:a001:9318:98d4:c6f5:3049) |
2022-01-07 23:54:33 +0100 | <geekosaur> | I'm not absolutely certain that it's a problem, but like I said the inlinePerformIO thing seems strongly suggestive |
2022-01-07 23:54:36 +0100 | vysn | (~vysn@user/vysn) (Ping timeout: 268 seconds) |
2022-01-07 23:55:03 +0100 | <geekosaur> | just inlining unsafePerformIO wouldn't be expected to have that severe an effect on how ghc treats IO-using code |
2022-01-07 23:56:36 +0100 | gehmehgeh | (~user@user/gehmehgeh) (Quit: Leaving) |
2022-01-07 23:56:55 +0100 | OscarZ- | (~oscarz@95.175.104.170) |
2022-01-07 23:59:17 +0100 | deadmarshal | (~deadmarsh@95.38.112.110) (Ping timeout: 240 seconds) |