<    March 2017    >
Su Mo Tu We Th Fr Sa  
          1  2  3  4  
 5  6  7  8  9 10 11  
12 13 14 15 16 17 18  
19 20 21 22 23 _2_4 25  
26 27 28 29 30 31
00:00 tsmish joined
00:00 jsgrant- left
00:00 YongJoon joined
00:01 pixelfog joined
00:01 {emptyset} joined
00:02 sleffy joined
00:02 <lyxia> SYB only considers a datatype to be generic if all its fields are.
00:03 <lyxia> with special cases for primitive types like Int/Double
00:03 jsgrant- joined
00:04 <Koterpillar> Wasn't there an escape hatch for "some other type"?
00:08 OnkelTem joined
00:09 <lyxia> You can define a dummy Data instance that behaves like the unit type.
00:10 <lyxia> or any type you want actually
00:10 halogenandtoast joined
00:11 vydd joined
00:11 ddere joined
00:12 FullyFunctional1 left
00:13 tom7942 joined
00:14 <lyxia> It feels quite wrong.
00:19 woonhulktin joined
00:19 nakal_ joined
00:22 desktop joined
00:22 pera joined
00:22 peterbecich joined
00:25 threedot14 joined
00:26 SAL9000 joined
00:27 xaviergmail joined
00:28 zennist` joined
00:28 JeanCarloMachado joined
00:29 zennist` left
00:30 magthe joined
00:30 ebzzry joined
00:31 watabou joined
00:31 lynnard joined
00:31 nomicflux joined
00:32 andyhuzhill joined
00:36 andyhuzhill joined
00:37 lynnard joined
00:37 <lynnard> yes
00:37 lynnard left
00:38 sportanova joined
00:38 skeet70 joined
00:38 lynnard joined
00:40 watabou joined
00:40 tromp joined
00:42 <robkennedy> Is there any reason `Data.Map.size` is named size and not length?
00:42 sportanova joined
00:43 <robkennedy> The question is as much design as it is practicality
00:44 dan_f joined
00:44 sdothum joined
00:44 markus1209 joined
00:44 markus1219 joined
00:44 <lyxia> "size" sounds natural when talking about a map.
00:44 <centril> robkennedy: well.. this is just speculation but: do you generally speak of length for non-sequential stuff? Do sets have length or do they have a size/cardinality ? Maps are more like sets than lists
00:45 <centril> robkennedy: size is imo also a more general term, length is kinda specific length/height/depth... vs. size
00:46 <robkennedy> But length is what Data.Traversable exports?
00:47 sz0 joined
00:47 JeanCarloMachado joined
00:47 <centril> robkennedy: and Monad has return , which it shouldn't, and head is a partial function, etc...
00:47 <centril> base is filled with things you could change for the better that would break backwards compatibility
00:48 <robkennedy> But the FTP was a bridge burning proposal?
00:48 <centril> robkennedy: also, Traversable has a notion of left -> right
00:48 <ezyang> well, it didn't burn /that/ many bridges
00:49 sdothum joined
00:49 halogenandtoast joined
00:49 <centril> robkennedy: it even has a function called "sequence" - so it implies order of some sort
00:50 <centril> does a "Map" have order ?
00:51 harwiltz joined
00:51 <centril> again, this is rank speculation, but this is my intuition
00:51 <harwiltz> Hello all. I just attempted to implement a tree in haskell to learn about functors and stuff, anyone mind critiquing my code? http://lpaste.net/353794
00:51 <robkennedy> Sure, Map are not infinite and a finite subset of any ordered set is well ordered
00:52 Rotaerk joined
00:52 <lyxia> harwiltz: there are a lot of unnecessary parentheses
00:52 <MarcelineVQ> harwiltz: take x (repeat y) is also called replicate x y
00:52 eacameron joined
00:52 <harwiltz> MarcelineVQ: oh man.... I knew I was missing something there
00:53 <harwiltz> lyxia: where?
00:53 <harwiltz> I always get confused with parentheses
00:53 <robkennedy> You can't blame me for believing that Maps are ordered when (Ord k) is a constraint ;)
00:53 <lyxia> harwiltz: lines 12 13 17
00:53 <ChaiTRex> harwiltz: Leaf should probably be Leaf a.
00:53 <Axman6> > replicate 3 True
00:53 <centril> harwiltz: also, a lot of ++ - consider using concat instead =)
00:53 <lambdabot> [True,True,True]
00:53 <lyxia> harwiltz: also 34-37
00:53 <harwiltz> ChaiTRex: I did that on purpose, in case I wanted to make Tree a Monoid somehow
00:53 <Axman6> ChaiTRex: not necessarilly
00:53 <lyxia> harwiltz: it's quite minor though
00:54 <harwiltz> centril: I've never used concat, I'll check it out
00:54 theDon_ joined
00:54 <centril> robkennedy: well, some maps are ordered, but not maps in general
00:54 _ashbreeze_ joined
00:54 <harwiltz> lyxia: Nah, I wanna clear up the parenthesis issue
00:54 <lyxia> harwiltz: (length $ dropWhile isDigit s) == 0 is all isDigit s
00:54 <harwiltz> I'm always confused about that
00:54 <Axman6> harwiltz: you might find writing addtoBST ius a little prettier if you use compare and parttern match on the three cases
00:54 <harwiltz> lyxia: Oh, didn't know about all
00:54 <centril> > concat ["hello", "world", "what", "a", "nice", "day"]
00:54 <lambdabot> "helloworldwhataniceday"
00:55 systadmin joined
00:55 <harwiltz> Axman6: I've never heard of compare either, I'll check it out
00:55 <Axman6> harwiltz: case compare x a of LT -> ... GT -> ... EQ -> ...
00:55 <harwiltz> Thanks for the help everyone
00:55 <lyxia> harwiltz: remember function application has higher precedence than any operator. So ... ++ (show a) ++ ... is ... ++ show a ++ ...
00:55 <robkennedy> centril: are you going to give a case where `x :: Map k v` is not ordered? Sounds like fake news, even for Map which is not from Data.Map
00:55 <harwiltz> Axman6: Oh right... now that you mention it, I think I've seen that before
00:55 <Axman6> > map (compare 2) [1,2,3]
00:55 <lambdabot> [GT,EQ,LT]
00:55 <harwiltz> lyxia: Ah, that's what I was missing
00:55 <harwiltz> I love this lambdabot functionality
00:56 <centril> robkennedy: a hash map is not ordered. a tree map is
00:56 Stanley00 joined
00:56 <harwiltz> Ok, just removed a bunch of parentheses, beautiful
00:57 sdothum joined
00:57 <centril> harwiltz: also, avoid too much indentation - you should bias towards using more top level functions and instead using modules for exporting and controlling interfaces
00:57 <centril> harwiltz: top level functions are testable
00:58 sdothum joined
00:58 <lyxia> harwiltz: the second argument of dispTree seems unnecessary
00:58 <lyxia> it's always ""
00:58 <centril> harwiltz: also, this is a personal preference, but use case instead of the way you are pattern matching since it is more DRY - and check out LambdaCase
00:59 eacameron joined
00:59 <centril> <3 LambdaCase
00:59 <harwiltz> Hmm. Youre right lyxia, not sure what I was thinking there
00:59 <harwiltz> centril: LambdaCase?
00:59 <centril> harwiltz: http://dev.stephendiehl.com/hask/#lambdacase
00:59 Ranhir joined
00:59 <robkennedy> centril: ...
01:00 <centril> robkennedy: ... ?
01:00 <robkennedy> Sorry bad send.
01:00 Fairy joined
01:01 <harwiltz> centril: Ah I see, that is nice
01:01 tom7942 joined
01:01 <centril> harwiltz: protip: if you already haven't, cabal install hlint , and integrate it into your editor - and let it do a lot of the work for you
01:01 <centril> harwiltz: very nice =)
01:01 wtetzner joined
01:01 <centril> my world would fall apart without LambdaCase - it satisfies all my eta reduction needs
01:02 <harwiltz> centril: I haven't gotten around to that yet, but I definitely should. I'm imagining I can do that with vim?
01:02 <centril> harwiltz: sure, tho i cant help you with vim since i dont like or use it
01:02 <harwiltz> centril: I'm surprised I've never seen LambdaCase in any books yet
01:02 <harwiltz> centril: psssshhh
01:02 <harwiltz> Lol
01:03 eschnett joined
01:03 <centril> harwiltz: What I Wish I Knew When Learning Haskell is an invaluable source - you should read it, ALL OF IT
01:03 <harwiltz> centril: And I've never heard of that either, but it does sound intriguing
01:03 baweaver left
01:03 <centril> it is
01:03 <harwiltz> I will definitely look that up
01:03 <robkennedy> centril: is your contention that `size` makes less sense as a function of the `Traversable` class than `length`?
01:04 Welkin joined
01:04 <harwiltz> I actually have another question though, however this one may be more philosophical
01:05 marvin2 joined
01:05 <marvin2> hi
01:05 <harwiltz> So this is my first time deriving an instance of Functor, and I'm trying to learn Monoids and Monads as well. From what I understand, the only use of Functors, Monads, and Monoids is purely to make code cleaner (and to make use of code easier when working in groups I guess). It's basically just like inheritance with types kinda, so you can define general functions rather than specific ones for each type.
01:05 <harwiltz> Correct?
01:05 <centril> robkennedy: no - my **conjecture** is that length is better for ordered and sequential stuff, which Traversable has some notion of... And maps in general are not ordered, even tho Data.Map is (sometimes)
01:06 <marvin2> trying to fetch my ip from icanhazip.com web page. what library would you recommend?
01:06 eacameron joined
01:06 <harwiltz> Like theoretically I can make a function with the same signature as (>>=), and use it to sequence code like I would with a Monad, and I would get the same functionality. So Monads, for example, don't actually add any new functionality to the language, it's just convenience
01:06 Lord_of_Life joined
01:07 <centril> harwiltz: so functions abstract what a structure preserving mapping is, so given a functor, any functor, you can do certain stuff - so it gives you the power to not care about the specifics and write abstract code
01:07 <centril> functors*
01:07 <centril> s/functions/functors
01:08 <centril> harwiltz: right, you can always write a function: [a] -> (a -> [b]) -> [b]
01:08 <harwiltz> Right, thats kinda what I meant. What I'm getting at is that the only benefit of using these classes is that you get to write more abstract general code. But theoretically I can always get away with not using them, just the code may be uglier
01:09 <centril> or: Maybe a -> (a -> Maybe b) -> Maybe b
01:09 certainty joined
01:09 tapirus_ joined
01:09 <harwiltz> centril: Exactly, just of course that would be annoying and hideous
01:09 <centril> harwiltz: well, and you'd have to repeat yourself
01:09 <harwiltz> centril: Right
01:10 <centril> harwiltz: there is a lot of things you can say generally with monads that you'd have to rewrite for every single monad if you weren't able to speak generally about monads
01:10 <harwiltz> centril: Was that supposed to confuse me? ;)
01:11 lambda-11235 joined
01:11 <centril> harwiltz: and I put it to you: everything "above" 010101 and machine instructions is only for: 1) convenience, 2) correctness
01:11 <centril> harwiltz: no, apologies if you were confused
01:11 <centril> harwiltz: what specifically was confusing ?
01:11 <harwiltz> centril: Hmm, I see. I get what you mean
01:11 <harwiltz> centril: Mostly a joke on my part
01:12 <centril> oh =)
01:12 <centril> convenience and easier correctness allows for increased productivity
01:12 <centril> which is important
01:12 <centril> harwiltz: so "only" becomes "NEAT!"
01:12 <harwiltz> centril: But what I'm trying to say is that Monads in haskell are kinda quasi-analagous to interfaces in java... sort of.
01:13 <harwiltz> And by that I mean it makes code much more integratable and less repetitive, but doesn't actually add any features that you couldn't live without
01:13 <centril> harwiltz: well, not monads, but (type) classes are, if you squint a bit, analagous to java interfaces
01:13 <robkennedy> centril: okay, I'm ready to be put to bed - is there an example that comes to mind to instantiate your parenthetical "sometimes"?
01:14 <harwiltz> centril: Right, that makes more sense
01:14 e14 joined
01:14 <harwiltz> centril: Thanks for all this. I think I have finally (sort of) understood monads now
01:14 <harwiltz> (And functors and monoids)
01:14 <centril> robkennedy: well, if you don't have (Ord k, Ord v), then =/=> Ord (Map k v)
01:15 <centril> robkennedy: but no - i dont have any instantiation atm since im only at the level of conjecture and not stating =) and for maps in general, i.e: all maps, including hash maps, the language of size is more apt than length
01:16 <centril> harwiltz: sec, I'll link you a lecture in advanced functional programming
01:16 <centril> harwiltz: http://www.cse.chalmers.se/edu/course/TDA342_Advanced_Functional_Programming/lecture4.html
01:17 <centril> harwiltz: but start with: http://www.cse.chalmers.se/edu/course/TDA342_Advanced_Functional_Programming/lecture3.html
01:17 lynnard joined
01:17 <harwiltz> centril: Oooh thanks
01:18 <harwiltz> centril: Is this from your school or something?
01:18 <centril> harwiltz: Some important stuff: Java has subtyping (unfortunately), haskell does not have this - you can only talk about what common class of functions a set of data types have in common
01:18 sanitypassing joined
01:18 <centril> harwiltz: yes, from Chalmers University of Technology
01:18 sdothum joined
01:18 <harwiltz> Oh, nice. I wish I learned this at my school haha
01:19 <harwiltz> Also, these notes are wayy better than what my profs provide, it's quite impressive
01:19 <centril> harwiltz: this common class of functions is what we call a (type) class
01:19 <centril> harwiltz: They were made by Alejandro Russo, he's a great lecturer
01:19 <harwiltz> centril: So that's what I've come to understand about type classes today
01:19 <harwiltz> centril: are you a cs student?
01:20 <centril> harwiltz: Yes, writing my bachelors atm
01:20 <harwiltz> centril: Awesome. I'm a comp eng student, no haskell (or functional programming at all) for us
01:20 <centril> harwiltz: comp eng or software eng doesnt really matter that much for me
01:21 AndoBado joined
01:21 <centril> harwiltz: terms don't really translate over english/swedish
01:21 <centril> harwiltz: my programme is really called "Information Technology"
01:21 <centril> I guess the english name is: "Software engineering"
01:21 <harwiltz> centril: Oh, I see. That makes sense
01:21 <centril> But I'm gearing towards a master in: Computer Science, Algorithms, Logic & Languages
01:22 <harwiltz> centril: I'm thinking about doing that as well
01:22 <centril> it's nice
01:22 <centril> harwiltz: Have you heard of a type constructor before ?
01:22 tomku joined
01:22 samgd joined
01:22 tom7942 joined
01:22 <harwiltz> centril: Really nice. Just worried I'm not learning enough software in my program, it's a shame. And yes, I've heard of a type constructor, I think
01:23 Scip__ joined
01:23 <harwiltz> Isn't that how I defined Tree in my code? "data Tree a = Leaf|Node a...
01:24 <centril> harwiltz: right, so a refresher: You have constructors at the level of expressions and values, ... so: makePerson :: Name -> Age -> Person
01:24 doodlehaus joined
01:24 <tom7942> harwiltz: the tree on the left side of = is your type constructor
01:24 <harwiltz> Yup
01:24 <centril> harwiltz: but you can also have constructors, and functions on the type level
01:25 <harwiltz> What do you mean by that?
01:25 nighty- joined
01:25 JoshS joined
01:25 <centril> harwiltz: what Maybe ? or [] ?
01:25 e14 joined
01:25 <centril> harwiltz: what's*
01:25 acarrico joined
01:25 brynedwards joined
01:26 <harwiltz> centril: Well they're Monads, but you can define them by type contructors... not sure I'm on the right track here lol
01:26 <centril> harwiltz: so, you have a function/constructor Maybe and I give you a type Int, and you give me back: Maybe Int
01:26 <harwiltz> Right
01:27 <centril> harwiltz: so you have a function from one type, to another, and I give you a type, and you give me back a type
01:27 <harwiltz> Ok, makes sense
01:27 <centril> harwiltz: so, if we can talk about types of types (which are often called kinds), then Maybe :: Type -> Type
01:27 <centril> :k Maybe
01:27 <lambdabot> * -> *
01:28 <centril> :k []
01:28 <harwiltz> centril: Yup, makes sense
01:28 <lambdabot> * -> *
01:28 <centril> :k Either
01:28 <lambdabot> * -> * -> *
01:28 <harwiltz> So lemme try to figure out the kind of my tree
01:28 jbiesnecker joined
01:28 <tom7942> :k (,,,)
01:28 <lambdabot> * -> * -> * -> * -> *
01:28 <harwiltz> Wait, the tree is recursive, how would I even go about that...
01:29 <tom7942> harwiltz: easy enough… how many type arguments are there?
01:29 <harwiltz> One
01:29 <tom7942> :k Int
01:29 <lambdabot> *
01:29 juhp joined
01:29 <tom7942> :k Maybe
01:29 <lambdabot> * -> *
01:29 <tom7942> :k Maybe Int
01:29 <lambdabot> *
01:29 <centril> tom7942: haha, shoulda started with that
01:30 sleffy joined
01:30 <tom7942> :info Maybe
01:30 <harwiltz> So I'd have Tree: *, Trew Int: * -> * for example?
01:30 <tom7942> close...
01:30 <harwiltz> Oops, flipped them
01:30 <harwiltz> Tree: * -> *, Tree Int: *
01:30 <centril> harwiltz: yes
01:30 <tom7942> right, so Tree is a type constructor, Tree Int is now concrete
01:31 <harwiltz> Ok, so the *'s represent only how many type arguments are needed to define the type basically
01:31 <centril> harwiltz: because you can't make any values of Tree, but you can make values of Tree Int
01:31 <harwiltz> Yup, got it
01:31 <centril> harwiltz: yes, so you have a function on types, and arguments to the function
01:31 <centril> harwiltz: applying the arguments to the function gets you a result , a type in this case
01:31 <harwiltz> Right
01:32 <centril> harwiltz: * is just fancy notation for Type
01:32 <tom7942> you could make your tree kind * -> * -> * by chaging the "data Tree a =" to "data Tree a b ="
01:32 <harwiltz> centril: fair enough]
01:32 <centril> :k Int
01:32 <lambdabot> *
01:33 <harwiltz> tom7942: Ok, I see
01:33 <centril> :k Either
01:33 <lambdabot> * -> * -> *
01:33 <centril> :k Either Int
01:33 <lambdabot> * -> *
01:33 <centril> :k Either Int String
01:33 <lambdabot> *
01:33 <harwiltz> I see
01:33 <tom7942> like maybe if you wanted some meta data attached to the tree nodes
01:33 <tom7942> :k (,,)
01:33 <lambdabot> * -> * -> * -> *
01:33 <tom7942> :k (,,)
01:33 <lambdabot> * -> * -> * -> *
01:33 <tom7942> :k (,)
01:33 <harwiltz> tom7942: Lol, I was gonna say I don't understand the application of the Tree a b but that makes sense
01:33 <lambdabot> * -> * -> *
01:33 eacameron joined
01:34 FreeBirdLjj joined
01:34 <centril> harwiltz: Have you heard of higher-order functions (HoF:s) ?
01:34 conal joined
01:34 <harwiltz> centril: By that do you mean functions that "take multiple arguments"?
01:34 <erisco> that's half of it
01:35 <AndoBado> Wait, Are those functions that return functions or take functions?
01:35 <harwiltz> Like currying stuff
01:35 serendependy joined
01:35 <centril> harwiltz: no, functions that either 1) take other functions as arguments, 2) return functions, 3) both of 1 & 2
01:35 <centril> :t map
01:35 <lambdabot> (a -> b) -> [a] -> [b]
01:35 <erisco> functions that have multiple arguments are functions that return functions
01:35 <harwiltz> centril: Oh. Ok hahaha. Well yeah I've heard of those
01:35 <harwiltz> erisco: Right, that's true
01:36 <harwiltz> centril: Well then >>= is a higher order function
01:36 marcopullo joined
01:36 <harwiltz> And so is fmap
01:36 <centril> erisco: right, but the fact that curried functions are functions returning functions is not the important note here
01:36 <AndoBado> and partially applied functions are higher order? Right?
01:37 <centril> harwiltz: right you are
01:37 <centril> harwiltz: so... if we can have higher-order functions on values, what about higher-order functions on types ?
01:37 <harwiltz> centril: Jeez
01:37 watabou joined
01:38 <harwiltz> I guess so? Never thought about that
01:38 <centril> harwiltz: how would such a signature look like, if you do the * -> * stuff
01:38 <centril> ?
01:38 <harwiltz> Trying to understand the implications of that
01:38 <harwiltz> centril: Well, something like * -> (* -> *) -> *
01:38 <harwiltz> Oh yeah, makes sent
01:38 <harwiltz> *sense
01:38 <centril> :k Functor
01:38 <lambdabot> (* -> *) -> Constraint
01:39 <Welkin> kinds
01:39 <harwiltz> Either Maybe Int
01:39 <centril> :k Monad
01:39 <lambdabot> (* -> *) -> Constraint
01:39 <harwiltz> What's Constraint?
01:39 <centril> harwiltz: Constraint here is a special kind used for classes that denote that some constraint has been fulfilled
01:39 <Welkin> Monad is a typeclass
01:39 <Welkin> :k Maybe
01:39 <erisco> I think it is more simple to say functions are values, and the rest falls from that
01:39 <lambdabot> * -> *
01:39 robertkennedy joined
01:39 <erisco> because even id is a higher order function
01:40 mmachenry joined
01:40 <Welkin> :k Either
01:40 <lambdabot> * -> * -> *
01:40 <harwiltz> But why wouldn't Either (Maybe) Int have * -> (* -> *) -> * -> *?
01:40 <Welkin> :k Either String
01:40 <lambdabot> * -> *
01:40 <harwiltz> Oops, I think I added an extra -> * to that
01:40 harfangk joined
01:40 <harwiltz> :k Either (Maybe) Int
01:40 <Welkin> :k Either Maybe
01:40 <lambdabot> error:
01:40 <lambdabot> • Expecting one more argument to ‘Maybe’
01:40 <lambdabot> Expected a type, but ‘Maybe’ has kind ‘* -> *’
01:40 <lambdabot> error:
01:40 <lambdabot> • Expecting one more argument to ‘Maybe’
01:40 <lambdabot> Expected a type, but ‘Maybe’ has kind ‘* -> *’
01:40 <Welkin> :P
01:40 <Koterpillar> Either Maybe is not well formed
01:40 <centril> :k StateT
01:40 <harwiltz> Oh, that's why
01:40 <lambdabot> * -> (* -> *) -> * -> *
01:40 <Welkin> because * is a type
01:40 <harwiltz> Lol
01:41 <Welkin> in Idris, it is called Type
01:41 <centril> :k ExceptT
01:41 <lambdabot> * -> (* -> *) -> * -> *
01:41 <centril> :k ReaderT
01:41 <lambdabot> * -> (k -> *) -> k -> *
01:41 <centril> :k WriterT
01:41 <lambdabot> * -> (* -> *) -> * -> *
01:41 <harwiltz> What's k?
01:41 <centril> harwiltz: any kind
01:41 <Welkin> type variable
01:41 <harwiltz> Oh, I see
01:41 <Welkin> kind variable in this case
01:42 <centril> harwiltz: Functor is a higher order type constructor, so is Applicative, and Monad
01:42 <harwiltz> centril: Ok, makes sense
01:43 <centril> harwiltz: they are a bit special due to Constraint, but as you saw with :k StateT , you can have * -> (* -> *) -> * -> *
01:43 <harwiltz> Right
01:43 <mmachenry> Anyone know what I'm doing wrong here trying to derive a MonadState instance? http://lpaste.net/353795
01:44 conal joined
01:44 <centril> harwiltz: Java does not have the ability to speak about T<Integer> if T is a generic parameter
01:44 <centril> haskell does.
01:44 <centril> This is commonly referred to as "Higher Kinded Types" or (HKTs)
01:45 <erisco> Java has higher-kinded types
01:45 <centril> erisco: whatnow ?
01:45 <erisco> it does not have higher-kinded polymorphism
01:45 <harwiltz> centril: Oh, that's true
01:45 <erisco> neither does Rust
01:45 <Welkin> HKT would be type constructors, would it not?
01:46 <centril> erisco: how do you form (* -> *) -> * -> * in Java ?
01:46 <dolio> Java doesn't have higher-kinded types, because the "higher" part means they're parameterized by a function.
01:46 <dolio> Higher than first-order.
01:46 <centril> dolio: right
01:46 tom7942 joined
01:47 <centril> harwiltz: thus, you can't speak generally about Functors, Monads, and stuff like this in Java
01:47 <erisco> well, I relinquish the pedantry
01:47 <erisco> everyone keeps defining it differently
01:47 <centril> harwiltz: only specific instances of Functors
01:47 <centril> erisco: I've never heard of anyone saying that Java has HKTs - but Scala tho...
01:48 <lyxia> mmachenry: where is ListT from
01:48 <Welkin> so, MaybeT is a HKT, but Maybe is not?
01:48 <lyxia> mmachenry: I suspect it doesn't implement MonadState
01:48 <harwiltz> centril: Right, fair enough. That makes sense. So if I had a bunch of other Tree-like things in Java, my code would get very messy and tedious, whereas with Haskell I can just keep redefining fmap
01:48 <Welkin> :k Control.Monad.Trans.Maybe.MaybeT
01:48 <lambdabot> (* -> *) -> * -> *
01:48 <Welkin> :k Maybe
01:48 <lambdabot> * -> *
01:48 <erisco> centril, well I am glad it has been consistent for you ;)
01:48 <mmachenry> lyxia: list-t… https://hackage.haskell.org/package/list-t
01:48 <dolio> Welkin: Yes.
01:48 <centril> erisco: cheers ;)
01:49 <mmachenry> It could probably be easily swapped for Control.Monad.List for this example.
01:49 <centril> erisco: well, i revise my statement... Now I've heard of one person saying that Java has HKTs
01:49 ludat joined
01:49 peterbecich joined
01:49 <centril> erisco: revision is healthy
01:49 <erisco> centril, higher-kinded types and higher-order types have meant the same thing in some discussions
01:49 <centril> ^^
01:50 <mmachenry> lyxia: ListT definitely doesn't implement MonadState, I want my monad transformer to implement it though
01:50 lifter joined
01:50 <erisco> centril, and since I have never heard of someone talk about "higher-typed values" I don't have much of a basis to make either case
01:50 anuxivm left
01:50 <harwiltz> centril: How would this idea apply to C++? Because in C++ you can do operator overloading, but I wouldnt think you can do higher-kinded types
01:50 <centril> erisco: well, I interpret HKTs enabled languages as those languages with the ability to have higher order type constructors
01:50 AndoBando joined
01:51 <erisco> centril, if you're tacitly saying that higher-order types and hkts are the same then I stand by what I said
01:51 <dolio> harwiltz: C++ can do template templates now, I think.
01:51 <harwiltz> dolio: Oh, really. That's interesting
01:51 <Welkin> C++ "overloading" is ad-hoc polymorphism
01:51 <lifter> There are a number of options available for auto-completion in Emacs, anyone know what is considered to be the best? ("company-mode", maybe?)
01:52 acidjnk22 joined
01:52 <erisco> centril, any type parameterised by a generic becomes a higher-order type
01:52 <erisco> centril, the question is if variables can range over such types
01:52 mrpavo joined
01:52 <centril> erisco: hmm well, can you form higher order type constructors in Java?
01:52 <erisco> centril, hence me saying it has HKT (same as higher-order types) but not HKP (because variables do not range over HKTs)
01:52 <dolio> No, first order is not "higher" order. :)
01:52 jbiesnecker joined
01:53 <tom7942> sorry, but who cares about java?
01:53 <centril> tom7942: well, you have to have reasons to avoid it
01:53 <harwiltz> centril: lol
01:53 Scip joined
01:53 FreeBirdLjj joined
01:53 <centril> tom7942: at least if you want to tell people why they should use a better language
01:53 <lyxia> mmachenry: looks like you won't be deriving it then
01:53 <Welkin> philip wadler worked on the java type system, lol
01:54 eacameron joined
01:54 <centril> Welkin: it's a freakin mess... but im sure it's not his fault
01:54 JeanCarloMachado joined
01:54 urodna joined
01:54 <Welkin> I think he added all the good features
01:54 xkapastel joined
01:54 <mmachenry> lyxia: I've done this before and it seemed to work… Made a monad transformer chain and it allowed me to just use the functions of the inner monads on my resultant monad.
01:54 <centril> Welkin: soooo many special cases, even for simple things such as conversions btw primitive types
01:55 <mmachenry> I'm confused about why this is different.
01:55 <centril> Welkin: right - im sure the language was pretty effed up when he came along
01:55 <centril> Welkin: a part of my bachelors thesis involved writing a type checker for Java - it was not fun...
01:55 <Welkin> centril: oh god... you just reminded me of another reason I hate using java... the distinction between primitive and user-defined types...
01:55 <lyxia> mmachenry: because more standard transformers implement the mtl type classes
01:56 <mmachenry> Ah.
01:56 <centril> Welkin: the language is not uniform in any way... the rules for conversions in assignment and function application are for example not the same
01:56 coltfred joined
01:56 <centril> Welkin: read this chapter if you want yourself a good cry... https://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html
01:56 <mmachenry> lyxia: So is it ListT that's blocking this from propagating out?
01:56 conal joined
01:56 <centril> Welkin: or you know... don't. if you value your sanity.
01:56 <tom7942> does java do implicit type conversion?
01:56 <Welkin> oracle.com is banned from my computer
01:56 <lyxia> mmachenry: yes
01:57 <centril> tom7942: yes, in an inconsistent manner
01:57 <tom7942> well then it sucks
01:57 <Welkin> "worse than javascript" :D
01:57 <tom7942> it doesn't even run on metal
01:57 <centril> Welkin: OK - not that bad...
01:57 <tom7942> waste of time :)
01:57 <mmachenry> Ah I see. Maybe ListT done wrong does this right. :)
01:57 <centril> Welkin: nothing is worse than Javascript
01:57 <Welkin> javascript is actually a better language than many others that people seem to *think* are good
01:58 <centril> Welkin: 1995 - Brendan Eich reads up on every mistake ever made in designing a programming language, invents a few more, and creates LiveScript. Later, in an effort to cash in on the popularity of Java the language is renamed JavaScript. Later still, in an effort to cash in on the popularity of skin diseases the language is renamed ECMAScript.
01:58 <Welkin> I'd choose javascript any day over java and friends
01:58 <Welkin> ES6
01:58 <tom7942> if it weren't for the whole "untyped" thing, javascript would be ok
01:58 eacameron joined
01:59 <centril> Welkin: http://stackoverflow.com/questions/5447153/javascript-equality-transitivity-is-weird
01:59 <dolio> Okay, this is getting a bit in the woods.
01:59 <lyxia> mmachenry: http://hackage.haskell.org/package/pipes-4.3.2/docs/Pipes.html#t:ListT this ListT is done right
01:59 <tom7942> yeah the channel is #haskell :)
02:00 <centril> right, we seem to have hit a tangent
02:00 <Welkin> you can do something close to real functional programming in js
02:00 <Welkin> afaik you can't in languages like java
02:00 <centril> tom7942: I thought it was #RustIsLiterallyHaskell
02:00 <Welkin> and there are nice haskell-like libraries for it
02:00 <harwiltz> I've never seen such hate for a programming language before lol
02:00 <centril> harwiltz: which one ?
02:00 <harwiltz> java
02:00 <centril> harwiltz: oh, if you think I loathe Java...
02:01 <harwiltz> centril: Well now I'm curious
02:01 avn joined
02:02 <centril> harwiltz: If I say it like this: https://www.youtube.com/watch?v=uMY5VGYh2Go
02:02 jsgrant- left
02:02 <nshepperd> Welkin: primitive types like int, byte, etc are analogous to unlifted Int# etc in haskell. the difference is that java encourages you to use the unlifted types, instead of doing like haskell and having a good compiler that optimizes away boxes
02:02 <tom7942> perl is worse than java
02:03 <harwiltz> centril: I'm not sure I understand...
02:03 <centril> harwiltz: "Go Johnny Go"
02:03 <harwiltz> centril: Yeah, what does that have to do with languages that you hate? Or are you telling me to leave? haha
02:03 systadmin joined
02:03 <centril> harwiltz: the name of the programming language is in there
02:03 <erisco> dolio, maybe I am confusing things in my head, but I think you'd be arguing that if f :: Int -> String that f is a first-order value
02:04 jbiesnecker joined
02:04 <harwiltz> Ohhhh
02:04 <nshepperd> if they had instead provided a nice way to use boxed Integers for everything, they'd be about on par with haskell there
02:04 <Welkin> tom7942: perl is really cool though, and has first-class functions o.o
02:04 <erisco> dolio, and if not then could you clarify what you mean by first-order type?
02:04 <Welkin> for me, first-class functions are required or the language automatically sucks (excepting C and asm)
02:04 <harwiltz> Alright all, I best be off to sleep. Thanks for all the help centril!
02:05 <centril> harwiltz: At the time Java & others was made, it was somewhat acceptable to not have a good type system, because type system research wasn't that well developed at the time, but now it is not acceptable
02:05 <centril> harwiltz: you're welcome =)
02:05 jsgrant- joined
02:05 <Welkin> centril: unless the language is called "Go" and made by google :P
02:05 <centril> Welkin: right
02:05 <Welkin> then it can be as crappy as they want
02:05 <dolio> erisco: id : Int -> Int is a first-order function. It operates on non-function arguments.
02:05 <harwiltz> centril: Unfortunately, Java is the only language I learn at my uni (which is ridiculous, I don't even learn C). Thankfully I learn software stuff on my own time
02:05 alx741_ joined
02:05 <tom7942> go was made by the people that made plan 9 i think
02:06 <centril> harwiltz: Java is very common at all universities, even mine
02:06 <erisco> dolio, okay, that's fine, but HKT does not include the word "function"
02:06 <dolio> erisco: `f : (Int -> Int) -> Int` is second-order.
02:06 <Welkin> harwiltz: that is the unfortunate state of CS "education" it seems
02:06 <Welkin> CS people get screwed it seems
02:06 <harwiltz> centril: Yeah. But how do you explain not learning C? That's just insulting
02:06 <dolio> `g : ((Int -> Int) -> Int) -> Int` is third-order.
02:06 <Welkin> I studied computer engineering (with lots of real engineering courses) and we used C and asm
02:06 <erisco> if we were talking about "first order type functions" and "higher-order type functions" it'd be a different discussion
02:06 <dolio> Maybe : * -> * is first-order.
02:06 <erisco> but when we say "higher order type" or "higher-kinded type" that is something else
02:06 <harwiltz> Welkin: I'm not even in CS, I'm in comp eng. You'd think java would be more useless even for comp eng than CS
02:06 <dolio> Fix : (* -> *) -> * is second-order.
02:07 <erisco> a first-order what and a second-order what
02:07 <centril> harwiltz: C is important to learn, but it's not really a good language with todays research in mind
02:07 <harwiltz> Welkin: Right, I'm in computer engineering (with real engineering courses), but we never learn C and we half-learned asm
02:07 <centril> erisco: does it make sense to talk about higher order types even? functions are higher order...
02:07 <harwiltz> centril: I guess, but it's very useful for low level stuff like embedded systems
02:08 <harwiltz> And OS
02:08 <centril> harwiltz: Rust is better =)
02:08 <erisco> centril, yes, depending on how you set up the terminology
02:08 <Welkin> centril: rust is still immature
02:08 <erisco> centril, I am happy saying functions are higher-order values, and so higher-order types are type functions
02:08 <dolio> erisco: Higher-kind means that the kind is analogous to the type of a higher-order function.
02:08 <harwiltz> centril: Ah. Well I don't learn Rust either, and havent started learning that on my own yet. I should look into that though, I've been hearing a lot about it recently
02:08 <centril> Welkin: well, kinda, it is racing towards being an awesome language very fast
02:09 <erisco> if everyone means to include the word "function" but keeps forgetting it, well, that isn't my problem :P
02:09 <Welkin> but yes, I am interested in rust myself
02:09 <harwiltz> Alright guys, thanks again. Off to bed for real now!
02:09 <centril> Welkin: =)
02:09 <harwiltz> Good night
02:09 lambda-11235 joined
02:10 <centril> erisco: I think it is more clear to talk about higher order type constructors
02:10 <centril> less confusion
02:10 <nshepperd> hm. (* -> *) -> * is a second order type function
02:10 <erisco> sure
02:10 <dolio> nshepperd: Well, that specifically is a kind, but it's the kind of a second-order function.
02:10 <centril> erisco: besides, Hotc is almost Hots, which is kinda Hot.
02:10 <nshepperd> I guess that checks out with the intuitive understanding that 'higher kinded types' means that your variables can range over type functions
02:12 <centril> I was supposed to sleep a long time ago... damn...
02:12 vydd joined
02:12 <Welkin> centril: happens to me all the time
02:12 <nshepperd> for instance 'fmap :: Functor f => (a -> b) -> f a -> f b'
02:12 MathUser joined
02:13 <nshepperd> I suppose that could be written out in dependent syntax as '(f :: * -> *) -> Functor f -> (a -> b) -> f a -> f b'
02:13 <Welkin> is there confucion over the definition of higer kinded types?
02:13 <Welkin> hgher*
02:13 <centril> nshepperd: and some foralls to :P
02:13 <Welkin> higher*
02:13 xaviergmail joined
02:13 <centril> Welkin: much it seems ?
02:13 <MathUser> Can someone please verify my proof? http://mathb.in/134943 if it is good, I have a follow up question for it (I know it's math related but also know you guys like proofs. I am studying this for type theory)
02:14 <erisco> yes there is and I blame whoever came up with the term :P
02:14 <nshepperd> which is a second order type function and also contains an application of a second order type function
02:14 <Welkin> MathUser: ask in Category Theory if it is CT related
02:14 <Welkin> MathUser: ask in #category-theory if it is CT related
02:14 <centril> MathUser: try writing it in #agda
02:14 <Welkin> it might be ##category-theory
02:14 <erisco> as soon as we establish clearly what a higher-typed value is I'll buy whatever higher-kinded type is supposed to mean
02:14 <MathUser> Thanks!
02:15 <Welkin> lol erisco
02:15 <centril> MathUser: if #agda says your proof is good, your proof is good, barring that agda has bugs
02:15 <MathUser> I need to learn Agda :)
02:15 <centril> MathUser: and #idris
02:15 iddqd joined
02:15 tswett_to_go joined
02:16 <Welkin> never heard of a higher-typed value
02:16 <Welkin> doesn't make sense
02:16 <Welkin> unless you mean a function that takes a function as a parameter
02:16 <dolio> A higher-typed value would be a higher-order function.
02:17 <Welkin> like fmap
02:17 <centril> dolio: right, that makes sense
02:17 <centril> somewhat
02:17 <dolio> Or one that returns a function if you want to define your orders that way (but people usually don't).
02:17 <nshepperd> I've never heard of the term 'higher-typed' and would imagine it's not real
02:18 <centril> dolio: aren't you just taking higher-kinded type and extrapolating on values & types ?
02:18 <Welkin> to me, HKT only makes sense then if you have a kind that takes a type-function as a parameter
02:18 <centril> feels like somewhat an after-the-fact construction
02:18 <dolio> Yes, I've never seen someone use the term.
02:18 chin-tastic joined
02:18 <Welkin> otherwise, it's not a higher-ikind; it's just a kind
02:18 <dolio> But there are lots of examples of "higher".
02:18 <erisco> take me higher
02:19 <Welkin> this was helpful actually :D
02:19 <dolio> And I'm not sure I've ever seen a situation where it included 1.
02:19 <erisco> to a place where blind men see
02:19 <centril> erisco: sorry, I'm Apping your Lam
02:19 <Welkin> I never really understood what HKT actually meant
02:19 infinity0 joined
02:19 <Welkin> for some reason I thought it was a type constructor, like * -> *
02:19 <Welkin> but that is obviously wrong
02:20 e14 joined
02:20 <nshepperd> that's what I thought too
02:20 <tswett_to_go> I've been craving to write some Haskell code...
02:20 <tswett_to_go> So I'm going to write a database query language. :D
02:20 <nshepperd> it's not that obviously wrong, to me
02:20 <Welkin> nshepperd: after the discussion that just happened, it is
02:20 halogenandtoast joined
02:20 jbiesnecker joined
02:20 <Welkin> but what is Higher-Kinded Polymorphism?
02:21 <centril> Welkin: classes over that ?
02:21 <nshepperd> I mean, the main problem with lots of languages that don't have HKTs is that they also don't have types of kind * -> *
02:21 <erisco> centril, and I counter by eta expansion
02:21 <Welkin> (* -> *) -> Constraint ?
02:21 infinity0 joined
02:21 <centril> Welkin: PolyKinds ?
02:22 <nshepperd> they might have macros that can expand into a type of kind * when passed a type, but those macros don't have a kind
02:22 <dolio> There aren't many of those anymore.
02:22 <erisco> centril, or I suppose beta would make more sense
02:22 <Welkin> oh, HKP would be ReaderT?
02:23 <Welkin> :k ReaderT
02:23 <lambdabot> * -> (k -> *) -> k -> *
02:23 <Welkin> because of the kind variable
02:23 MathUser left
02:23 <dolio> That would be polymorphic kinds.
02:23 <centril> nshepperd: is doing it by macro an important distinction ?
02:23 <Welkin> okay
02:23 <Welkin> so what is HKP?
02:23 <erisco> nshepperd, do they not? I don't see why they can not
02:24 <centril> erisco: yes, i dont see it too
02:24 <centril> Welkin: we need a glossary :/
02:24 <centril> clearly this is all levels of confusing
02:24 infinity0 joined
02:24 systadmin joined
02:24 <centril> You all know what happens when you don't have shared facts...
02:25 <erisco> you probably cannot use this kind, but it'd be like saying Haskell doesn't have bottom because you can't use it
02:25 <centril> BAD STUFF.
02:25 <Welkin> but then, how is a kind variable useful?
02:25 <Welkin> does that just mean it could be * or * -> *?
02:25 andyhuzhill joined
02:25 mvr_ joined
02:26 <centril> erisco: WHNF is verboten
02:26 <erisco> Welkin, yes, that is what it means
02:26 <dolio> Welkin: I would guess people mean it to involve being able to quantify over the things that can be used as arguments in higher kinds.
02:26 <Welkin> Are there other kinds in haskell tht are actually useful besides *?
02:26 <dolio> So it would be pretty odd to have the kinds but not the polymorphism.
02:27 <erisco> yes, all the promoted ones you get with DataKinds
02:27 <centril> Welkin: there is #, Constraint
02:27 <centril> # <-- magic hash
02:27 <Welkin> * is a weird (and confusing) name
02:27 <Welkin> why not call it Type like in Idris?
02:27 <centril> Welkin: s/*/Type
02:27 <erisco> possibly because of Miranda, but I don't know
02:27 <monochrom> * -> * is useful. When I turn on DataKinds and define "data X = Y | Z", the kind X is useful.
02:27 <erisco> in Miranda your type variables were *, **, ***, and so on :P
02:27 infinity0 joined
02:28 sportanova joined
02:28 <* monochrom> cringes, unary type variable notation?!
02:28 <dolio> Yep.
02:28 <monochrom> If I have 20 type variables, is it going to be "My God it's full of stars!!!!"
02:28 sleffy joined
02:29 <erisco> pipes or lens in Miranda, oh boy
02:29 <monochrom> The number of stars grows quadratically to the number of type variables, did they notice that?
02:29 <tswett_to_go> I'm not totally sure what to name my modules. If I'm implementing a language, and I want to refer to it as "LaserDb", does that mean I should probably name the root module Language.LaserDb?
02:29 <centril> Welkin: https://www.reddit.com/r/haskell/comments/4180k3/what_is_typeintype/
02:29 <tswett_to_go> With 100 type variables, you get at least 5,050 stars. Hmm.
02:29 <centril> tswett_to_go: that is standard
02:29 <mniip> * :: *
02:29 <mniip> :: :: * -> *
02:29 <centril> :k *
02:29 <lambdabot> error:
02:29 <lambdabot> Not in scope: type constructor or class ‘*’
02:29 <lambdabot> error: Operator applied to too few arguments: *
02:30 <centril> lambdabot: dude...
02:30 infinity0 joined
02:30 <dolio> It's a very odd choice, since ML had named variables, I'm sure.
02:30 <centril> :k Type
02:30 <lambdabot> error:
02:30 <lambdabot> Not in scope: type constructor or class ‘Type’
02:30 <erisco> that is not how you refer to it actually
02:30 <centril> Ok, lambdabot needs some updating ?
02:30 <mniip> :k Data.Kind.*
02:30 <lambdabot> *
02:30 <tswett_to_go> centril: coo', thanks.
02:30 <centril> mniip: aah
02:30 <monochrom> tswett_to_go: Since it's for databases, you may also choose "DataBase.LaserDB".
02:31 <erisco> it is weird, and I don't know why, but DataKinds gives a special way to refer to it that mniip just showed
02:31 <monochrom> And since "LaserDB" is pretty unique, you may also just choose "LaserDB"
02:31 <Welkin> mniip: privet, comrade
02:31 <mniip> DataKinds?
02:31 <mniip> Data.Kind is a module
02:31 <erisco> yes, I am aware
02:31 <mniip> I think it was added in 7.12 for compatibility reasons?
02:31 <mniip> and defines type Kind along with type *
02:31 <tswett_to_go> I'd probably go with either Language.LaserDb or DataBase.Laser.
02:31 <mniip> er
02:31 <mniip> type Type
02:31 <centril> tswett_to_go: I'd also just go for LaserDB
02:32 <mniip> Welkin, well hello
02:32 <centril> tswett_to_go: short and sweet is nice
02:32 nshepperd joined
02:32 <tswett_to_go> *nod* Yeah, that works!
02:32 c137 joined
02:32 watabou joined
02:32 <centril> mniip: privet tavarich
02:33 <erisco> you guys have it all wrong
02:33 infinity0 joined
02:33 <erisco> Org.Tswett.LaserDB obv
02:33 <centril> erisco: =====> Java land :P
02:33 <lifter> Is there another place I should go to ask Spacemacs/Emacs related questions?
02:34 <tswett_to_go> You mean Net.Warrigal.LaserDB. :D
02:34 <tswett_to_go> I hope nobody's going to be offended if I go with LaserDb instead of LaserDB.
02:34 <mniip> centril, дратути
02:34 <erisco> ICANN already does the work of ensuring uniqueness
02:34 <centril> mniip: I can't read cyrillic tho
02:34 <Welkin> lol wtf?
02:35 <centril> tswett_to_go: noooo don't do it. LaserDB is way cooler.
02:35 <Welkin> centril: that reddit thread you linked has someone saying "HKT is a type that takes a type"
02:35 <Welkin> the confusion pervades
02:35 <centril> Welkin: wat?
02:35 <centril> ...
02:35 <erisco> I think you're missing the opportunity of DbLaser
02:35 <tswett_to_go> Mmmmmmmm. I just don't know if I can bring myself to call it LaserDB. :D
02:35 <boccato> hspec's before and around are making me mad, i just can't understand how to combine them
02:35 <tswett_to_go> erisco: I've thought about calling it that!
02:35 <tswett_to_go> "The Database Laser"
02:36 infinity0 joined
02:36 <boccato> This post finishes with "Simply combine the with app and around withRollback"... and I simply cannot do that!
02:36 <monochrom> The King Edward and the Database Laser.
02:36 <boccato> https://begriffs.com/posts/2014-10-19-warp-server-controller-test.html
02:36 <centril> tswett_to_go: LightAmplificationByStimulatedEmissionOfRadiationDb
02:36 <nshepperd> tswett_to_go: laser decibels?
02:37 <tswett_to_go> The official name of the language is just "Laser", though.
02:37 <tswett_to_go> Harry Potter and the Database Laser?
02:37 <centril> tswett_to_go: Fantastic Beasts and where to find a Laser for Databases.
02:37 <tswett_to_go> And "laserdb" is just a secondary disambiguative moniker.
02:37 <monochrom> The potter Harry and the database Laser.
02:37 Goplat joined
02:37 diegoksp joined
02:38 <nshepperd> when you titlecase an initialism, a puppy cries
02:38 <centril> nshepperd: dafuq is titlecase?
02:38 eazar001 joined
02:38 <monochrom> "Db"
02:38 <nshepperd> Titlecase, UPPERCASE, lowercase
02:38 <mniip> Xml Http Request
02:38 <centril> oh
02:38 <erisco> snake_case
02:38 <Koterpillar> nshepperd: TitleCase?
02:38 <centril> CamelCase
02:38 <mniip> --kebab-case
02:38 <Welkin> LASER: Light Amplification by Stimulated Emission of Radiation
02:38 <Welkin> :D
02:39 <tswett_to_go> module laser'data'base where
02:39 <Welkin> centril: wrong!!
02:39 <Welkin> that is CapsCase D:<
02:39 <Koterpillar> camelCase
02:39 <Welkin> this is camelCase
02:39 <erisco> lowerCamelCase UpperCamelCase
02:39 <centril> Welkin: CapitalCamelCase
02:40 <erisco> CAPSCASE come on people
02:40 <Welkin> and then you have the-weird-lisp-stuff
02:40 jbiesnecker joined
02:40 <centril> Upper_Camel_Snake_Case
02:40 <centril> go nuts with (.) on naming conventions
02:40 <tswett_to_go> antIcameLcasE
02:40 <centril> LaTeX
02:41 <centril> MiDDleCaSe
02:41 <tswett_to_go> vOwElcAsE
02:41 <centril> KKKKoNSoNaNTCaSe
02:41 <nshepperd> those are just variations on l33tsN1perCasE
02:42 Ranhir joined
02:42 <erisco> I feel like real progress is occurring right now
02:42 <centril> erisco: right RIGHT
02:42 <tswett_to_go> aɪpiːˈeɪ keɪs
02:43 <centril> \case
02:43 <nshepperd> never mind actual progress, a feeling of progress is what's important
02:43 <centril> LambdaCase .
02:44 <Welkin> what about china case? 大便
02:44 <tswett_to_go> module ˌleɪzɹ̩diːˈbiː where
02:44 <Welkin> we need unicode variable names!
02:44 <Koterpillar> Welkin: case isn't defined for CJK, AFAIR
02:45 <centril> Welkin: "By the way, I thought it was about time I built my own Agda library. With no fucking unicode. " - Conor McBride, https://mobile.twitter.com/pigworker/status/764410137884909568
02:45 <Welkin> I know :D
02:45 <Koterpillar> (also, language!)
02:45 <tswett_to_go> Hiragana vs katakana is sort of like case.
02:45 JuanDaugherty joined
02:45 <centril> Koterpillar: not my language :P
02:45 <Koterpillar> tswett_to_go: but does Unicode standard agree?
02:45 <centril> blame Conor ^,-
02:45 <Koterpillar> centril: sorry, that was to Welkin
02:45 <centril> ^^
02:45 <tswett_to_go> I'm sure that the Unicode standard does not say anywhere, "The distinction between hiragana and katakana is *not* sort of like the distinction between lowercase and uppercase letters."
02:46 <monochrom> > case 5 of λ -> λ*λ
02:46 <lambdabot> 25
02:46 ystael joined
02:46 <centril> monochrom: wat ?
02:46 <centril> magic...
02:46 <Koterpillar> > isUpper "ひ"
02:46 <lambdabot> error:
02:46 <lambdabot> • Couldn't match expected type ‘Char’ with actual type ‘[Char]’
02:46 <lambdabot> • In the first argument of ‘isUpper’, namely ‘"\12402"’
02:46 <Koterpillar> > isUpper 'ひ'
02:46 <lambdabot> False
02:46 <Koterpillar> > isLower 'ひ'
02:46 <lambdabot> False
02:47 <tswett_to_go> Well, I think I'm going to succumb to peer pressure and name this module "LaserDB".
02:47 <erisco> there is this nice little case/of feature for types with literals
02:47 <Welkin> those are only defined on the ascii range o.o
02:47 <erisco> where it uses the Eq instance
02:47 <Koterpillar> > let ひ = "hi" in ひ
02:47 <centril> also, -case (EmptyCase) is always useful
02:47 <lambdabot> "hi"
02:47 <Welkin> tswett_to_go: that is the trend these days
02:47 <Koterpillar> @let data ひ = ひ
02:47 <lambdabot> Parse failed: Illegal character ''\12402''
02:47 <centril> tswett_to_go: that's the spirit!
02:47 <Welkin> no namespacing, just top-level name squatting
02:48 <centril> Has anyone ever had an actual use for EmptyCase ?
02:48 <mniip> > generalCategory 'ひ'
02:48 <erisco> yes
02:48 <lambdabot> OtherLetter
02:48 <monochrom> What is EmptyCase?
02:48 <Koterpillar> @let data ヒ = ヒ
02:48 <lambdabot> Parse failed: Illegal character ''\12498''
02:48 <erisco> you need it to inhabit Void
02:48 <centril> monochrom: a case with no patterns
02:48 <Welkin> > generalCategory 💩
02:48 <lambdabot> <hint>:1:18: error:
02:48 <lambdabot> parse error (possibly incorrect indentation or mismatched brackets)
02:48 <Welkin> lol
02:48 <monochrom> Oh! That one.
02:48 <erisco> or want it, at least, and unfortunately Haskell doesn't check it correctly
02:48 <mniip> quotes
02:48 <centril> erisco: right, but can't you do ordinary pattern not-match ?
02:49 <tswett_to_go> > case 6 of {}
02:49 <lambdabot> *Exception: <interactive>:3:1-4: Non-exhaustive patterns in case
02:49 <Welkin> > generalCategory '💩'
02:49 <lambdabot> OtherSymbol
02:49 <erisco> I am not aware of a pattern not-match notation
02:49 <centril> erisco: :P
02:49 <Koterpillar> tswett_to_go: checked GHCi, it refuses to make ヒ a constructor
02:49 <erisco> well it exists in other languages
02:49 <Welkin> Koterpillar: that is because it's an animal! D:<
02:49 <centril> erisco: it is there <hand waving> I think ?
02:49 <centril> erisco: agda has it iirc
02:49 <mniip> > generalCategory 'ヒ'
02:50 <lambdabot> OtherLetter
02:50 <mniip> it's not an UppercaseLetter
02:50 <Welkin> Koterpillar: I can't tell if that is the chinese character or the katakana
02:50 <centril> but Void is kinda more important in Agda
02:50 <Welkin> probably katakana
02:50 eacameron joined
02:50 <lifter> That's katakana "hi"
02:50 <erisco> eh, well, that is somewhat just because of how Agda is used
02:50 <Koterpillar> Welkin: ヒト doesn't work either
02:51 robkennedy joined
02:51 <Welkin> a perosn is still an animal!
02:51 <Welkin> person*
02:52 shoopaloop joined
02:52 jbiesnecker joined
02:52 <centril> erisco: right
02:52 Jacoby6000_ joined
02:52 <centril> erisco: well, using agda as a general purpose language is probably painful
02:52 shoopaloop joined
02:52 <erisco> though in Haskell you also end up limited because DataKinds is limited in what it can promote
02:53 <centril> the only time I've actually dealt with Void is for Trees that Grow
02:53 ramzifu joined
02:53 <centril> https://www.microsoft.com/en-us/research/wp-content/uploads/2016/11/trees-that-grow.pdf
02:53 <erisco> and limited in what type level functions you can write
02:53 shoopaloop joined
02:54 <mniip> :let data 𝓓𝓪𝓽𝓪 = 𝕯𝖆𝖙𝖆
02:54 <mniip> @let data 𝓓𝓪𝓽𝓪 = 𝕯𝖆𝖙𝖆
02:54 <lambdabot> Defined.
02:54 <centril> does lambdabot have all extensions enabled, or what?
02:54 <mniip> no
02:55 <erisco> but Haskell has the wonderful traits of simplicity and better inference
02:55 <centril> but dont you need UnicodeSyntax for this ... ?
02:55 <mniip> yes you do
02:55 <mniip> er
02:55 <mniip> no
02:55 <mniip> not for this in particular
02:55 <centril> ah
02:55 {emptyset} joined
02:55 <mniip> this is not unicode *syntax*, just identifier
02:55 <centril> right
02:56 <mniip> I wonder if :t was fixed
02:56 eacameron joined
02:56 <mniip> :t 𝕯𝖆𝖙𝖆
02:56 <lambdabot> ????
02:56 <mniip> :(
02:56 <erisco> lambdabot is confused
02:56 <tswett_to_go> So I'd like to define a function or two for converting a String into my language's Identifier type.
02:56 <centril> btw, if you haven't read the trees that grow paper i highly recommend it
02:57 <tswett_to_go> I'd like to have toIdentifierMaybe :: String -> Maybe Identifier, and also toIdentifier :: String -> Identifier, which just does "error" for invalid identifiers.
02:57 <centril> tswett_to_go: that paper might be useful to you as well in language design if you need tree decoration
02:58 <centril> tswett_to_go: toIdentifier = fromJust . toIdentifierMaybe
02:58 plutoniix joined
02:58 <centril> tho I don't recommend it
02:58 <erisco> the more conventional names would be parseIdentifier :: String -> Maybe Identifier and unsafeParseIdentifier :: String -> Identifier
02:59 <centril> erisco: +1
02:59 <centril> or just skip the unsafe part
02:59 <tswett_to_go> But I want to give a good error message in the case that it's not a valid identifier.
02:59 eacamero_ joined
02:59 plutoniix joined
02:59 <centril> tswett_to_go: Either GoodErrorMessage Identifier
02:59 <tswett_to_go> I want to say "error: this string has length 53 but identifiers have a maximum length of 50" rather than "error: nope, sorry".
03:00 mizu_no_oto joined
03:00 hucksy joined
03:01 ChaiTRex joined
03:01 <tswett_to_go> erisco: unsafeParseIdentifier, really? I usually think of "unsafe" as meaning "violates the assumptions that are generaly made about Haskell code".
03:01 <centril> tswett_to_go: offering partial functions is also promoting their use, kinda...
03:01 <erisco> yeah, and totality is one of those assumptions
03:01 <centril> idd
03:01 <centril> tswett_to_go: don't promote the use of partial functions, please :P
03:01 <erisco> it is why people balk at head and tail
03:01 <tswett_to_go> "Unsafe" makes me think unsafePerformIO and unsafeCoerce, not error and undefined.
03:02 <centril> tswett_to_go: well, undefined is basically just an unsafePerformIO to something that always crashes
03:02 <okeuday_bak> what version of GHC attaches is the first to attach the stack trace to error function use?
03:02 <centril> or you could define it as such
03:02 <tswett_to_go> Anyway... how about...
03:02 <tswett_to_go> parseIdentifierEither :: String -> Either String Identifier; parseIdentifier :: String -> Maybe String
03:02 <nshepperd> + is just an unsafePerformIO to something that adds two numbers then does nothing :p
03:02 <tswett_to_go> Er, s/Maybe String/Maybe Identifier/
03:03 <Welkin> has anyone used sorts in haskell?
03:03 <tswett_to_go> And just forget about the String -> Identifier version
03:03 <erisco> parseIdentifierWithError perhaps
03:03 <centril> tswett_to_go: flip them around - Either is should be the default
03:03 <nshepperd> parseIdentifierOrDie
03:04 <tswett_to_go> parseIdentifier :: String -> Either String Identifier; parseIdentifierMaybe :: String -> Maybe Identifier?
03:04 <centril> parseIdentifier = either (const Nothing) pure . parseIdentifierEither
03:04 ramzifu joined
03:04 <erisco> I don't see parts of the type being included in the name that often
03:04 <erisco> it is already in the type, after all
03:04 <Welkin> :k ExceptT
03:04 <centril> erisco: right - no hungarian notation
03:04 <lambdabot> * -> (* -> *) -> * -> *
03:04 <Welkin> :k ReaderT
03:04 <lambdabot> * -> (k -> *) -> k -> *
03:04 <tswett_to_go> Yeah, but I can't call them both parseIdentifier.
03:04 <glguy> :t mapMaybe
03:04 <lambdabot> (a -> Maybe b) -> [a] -> [b]
03:04 <centril> tswett_to_go: parseIdentifier'
03:05 <centril> or parseIdentifierM
03:05 <erisco> yes there are lots of exceptions glguy :P
03:05 <tswett_to_go> I like parseIdentifierM.
03:05 <centril> tswett_to_go: you should really put all your parsers in a neat type class
03:05 <glguy> enough that it's not worth making a confusing name to avoid it
03:06 <tswett_to_go> I should keep in mind that for the time being, I don't care about making a stable public API...
03:06 <erisco> I didn't say it should be confusing
03:06 <centril> tswett_to_go: class Parsable (t :: *) where type Repr t = r | r -> t ; parse :: String -> Either Err (Repr t) ;
03:06 <Welkin> didn't ghc8 add more sorts to haskell?
03:06 <erisco> if they called it mapAndFilter or something that wouldn't be confusing
03:06 eacameron joined
03:07 <centril> tswett_to_go: wait... you don't need the Repr
03:07 <centril> just class Parsable (t :: *) where parse :: String -> Either Err t
03:07 <glguy> welkin: with TypeInType, the sky is the limit
03:08 <centril> glguy: you can even reach the bottom!
03:08 <erisco> it is type universes all the way down
03:08 <nshepperd> I would have parseIdentifier with the Either, and parseIdentifier' or parseIdentifierOrDie for the partial function
03:08 <tswett_to_go> I'm planning to use Parsec (or Megaparsec).
03:08 <nshepperd> only bother providing the partial function if people frequently need to convert identifiers that are known to be valid
03:08 <tswett_to_go> I could just give you a parser for identifiers instead of this parseIdentifier function.
03:08 <tswett_to_go> *shrug*
03:08 <centril> nshepperd: is that Or, or Xor ?
03:08 eazar001 joined
03:09 <nshepperd> if you're using a parser library, you could just provider a parser, yeah
03:09 <centril> yes, do that
03:09 fede joined
03:09 <fede> hi
03:09 <centril> and then add a type class to provide parsers for all your types
03:09 <nshepperd> CharParsing m => m Identifier
03:09 <fede> i need some help with a little problem
03:10 <nshepperd> centril: parsing an identifier *and* dying is hardly distinguishable from dying on its own, so it doesn't matter :p
03:11 <barrucadu> fede: What is your problem? (also: don't ask to ask, just ask)
03:11 <centril> nshepperd: "And, as his last act, he parsed an identifier, and them promptly proceed to die."
03:11 <centril> Sad.
03:11 <centril> nshepperd: total failure.
03:12 <erisco> this is what we call a "don't care" and denote it with an underscore
03:12 xtreak joined
03:12 <centril> clearly I'm not fit to write text at this hour...
03:13 <centril> Time to sleep... Goodnight y'all
03:13 vydd joined
03:15 nomicflux joined
03:17 <Welkin> yeah
03:17 <Welkin> I'm trying to program right now, and my whole screen is orange
03:17 <Welkin> because of flux
03:18 <Welkin> I turned it off for a moment and my eyes were assaulted by blue light
03:18 <centril> Dont do that
03:19 <Welkin> yeah
03:19 <centril> Protip
03:19 papermachine joined
03:19 <Welkin> all of my terminals and emacs use a dark theme too :P
03:19 <centril> Except when watching movies
03:19 <Welkin> the web browser is the only thing that really assaults me
03:20 <centril> Yeah I wish web pages were dark
03:20 <centril> It's not the browser but the websites
03:20 <Welkin> I always wanted a dark theme website for myself :D
03:21 lykki joined
03:21 <Welkin> but it goes against "common wisdom"
03:21 <centril> Firefox dev edition has a dark chrome
03:21 <centril> It's nice
03:21 <Welkin> dark theme?
03:21 <tswett_to_go> Is there a library function which will convert a Char to its Unicode number string thingy, such as "U+201A" or "U+1FE08"?
03:21 electrostat joined
03:21 <Welkin> > ord 'c'
03:22 <lambdabot> 99
03:22 <centril> Right the chrome is dark
03:22 <Welkin> > ord '好'
03:22 <lambdabot> 22909
03:22 lykki left
03:22 <Welkin> twomix: ^
03:22 <Welkin> er'
03:22 <Welkin> tswett_to_go: ^
03:22 <tswett_to_go> But I'm looking for "U+0063" in that case.
03:22 <centril> Those parts of the browser not displaying the web page itself
03:23 <tswett_to_go> Guess I can do ord, convert it to hex with padding out to 4 digits, and stick "U+" on the front.
03:23 cpup joined
03:23 <Koterpillar> tswett_to_go: 4 digits is not enough
03:23 <Welkin> Koterpillar: 4 digits is enough for anybody
03:23 <tswett_to_go> Koterpillar: yeah, that's why I said "pad out". Use 4 digits if 4 digits is enough, otherwise use 5 digits.
03:24 Jacoby6000_ joined
03:25 <centril> Representing years with 2 digits... What could go wrong?
03:27 uglyfigurine joined
03:28 <tswett_to_go> It's not quite a library function, but looks like (Text.Printf.printf "U+%04X" :: Int -> String) does the trick.
03:30 snowalpaca joined
03:31 Volt_ joined
03:31 snowalpa_ joined
03:31 dfeuer joined
03:32 eazar001 joined
03:33 FreeBirdLjj joined
03:34 takle joined
03:36 howdoi joined
03:37 praduca joined
03:38 <erisco> cool, I generated a puzzle
03:38 certainty joined
03:39 eazar001 joined
03:41 doodlehaus joined
03:41 exferenceBot joined
03:42 trineroks joined
03:42 systadmin joined
03:42 <trineroks> hey guys, why can't I continuously concat a list like this?
03:42 <trineroks> element : element1 : element2 : ...
03:42 <trineroks> it works for element : element1
03:42 <trineroks> but when I add : element2
03:42 <trineroks> it throws an error
03:42 takle joined
03:42 <erisco> : is cons, not concat
03:42 <trineroks> sorry then, cons
03:42 <erisco> and for element : element1 to work element1 has to be a list
03:42 <jle`> > 1 : 2 : 3 : [4,5,6]
03:43 <lambdabot> [1,2,3,4,5,6]
03:43 <erisco> indicated by the type of :
03:43 <tom7942> :t (:)
03:43 <erisco> :t (:)
03:43 <lambdabot> a -> [a] -> [a]
03:43 <lambdabot> a -> [a] -> [a]
03:43 <jle`> which is 1 : (2 : (3 : [4,5,6]))
03:43 safe joined
03:43 <tom7942> :t snoc
03:43 <lambdabot> Snoc s s a a => s -> a -> s
03:44 <erisco> this is the most common misconception about lists, I think, and I had it to
03:45 <erisco> : does not put two elements together
03:45 <trineroks> oh
03:45 <erisco> : puts an element and a list geother
03:45 <trineroks> so it's element added to a list?
03:45 <trineroks> so
03:45 <trineroks> element : list
03:45 <erisco> together*
03:45 <jle`> > 3:[4,5,6]
03:45 <lambdabot> [3,4,5,6]
03:45 markasoftware joined
03:45 <jle`> > 2 : (3:[4,5,6])
03:45 <lambdabot> [2,3,4,5,6]
03:45 <trineroks> then how would you do element + list + list2?
03:45 <jle`> > 1 : (2 : (3 : [4,5,6]))
03:45 <lambdabot> [1,2,3,4,5,6]
03:45 <trineroks> is that
03:45 <erisco> (x : xs) ++ ys
03:45 <jle`> trineroks: you can use (++), which concatenates two lists
03:45 <trineroks> element : (concat (list list2))?
03:45 hexagoxel joined
03:45 <erisco> or x : (xs ++ ys)
03:45 <jle`> element : list1 ++ list2
03:45 <trineroks> alright, thanks
03:45 <erisco> you can prove the equivalence if you like :)
03:49 boccato joined
03:50 takle joined
03:56 igniting joined
03:57 <trineroks> okay, this approach is not working
03:58 <erisco> lol this library has some issues with killing children
03:58 <trineroks> how would I do a nested for loop in haskell while adding to a list?
03:59 <erisco> by approaching the problem quite differently, likely
04:00 <jle`> trineroks: we would need more details to be able to help
04:00 <tom7942> no loops, only recursion
04:00 <trineroks> yeah I'm writing up what I want this to do in pseudo
04:00 <jle`> learning haskell helps you see how much we rely on loops as a crtuch
04:00 <jle`> *crutch
04:00 Noldorin joined
04:01 <tom7942> trineroks: can you write something like length :: [a] -> Int in haskell yet?
04:01 <trineroks> http://pastebin.com/AR44V4TY
04:01 <trineroks> yes I can
04:02 <trineroks> you'd just recursively go through each element in a list and add 1, and when the head is empty you return a 0
04:02 <tom7942> cool, so you know how to loop
04:03 <erisco> trineroks, there is more than one answer, but one is a list comprehension
04:03 <tswett_to_go> All right, here's a bit of code.
04:03 <erisco> trineroks, so [(x,y) | x <- xs, y <- ys]
04:03 <tswett_to_go> I'm sort of an "old newbie" with Haskell.
04:04 <tswett_to_go> I first learned about it, like, 15 years ago or whatever, but I don't have any experience writing code for other people to read.
04:04 <lpaste_> tswett pasted “LaserDB.Identifier” at http://lpaste.net/353801
04:04 <tswett_to_go> ^^^ Something tells me I did a bunch of confusing, non-idiomatic stuff there. :D
04:04 <erisco> trineroks, another is the list Applicative, so (,) <$> xs <*> ys
04:04 sssilver joined
04:04 halogenandtoast joined
04:04 <trineroks> can you explain what [(x,y) | x <- xs, y <- ys] does?
04:05 <tswett_to_go> Oh, I forgot to write the export list...
04:05 jud joined
04:06 <erisco> trineroks, it does xs >>= \x -> ys >>= \y -> return (x, y)
04:06 Rizy joined
04:06 <jle`> tswett_to_go: it returns a list of all combinations of x and y from xs and ys
04:06 <jle`> * trineroks
04:06 <jle`> that's how list comprehensions work
04:06 <erisco> or just for that specific example it is the Cartesian product of xs and ys
04:06 <tswett_to_go> If someone would like to take a look at my code and offer a comment or two, I'd really appreciate it!
04:06 <jle`> but, you can also write it from scratch
04:07 <jle`> trineroks: you can start the same way you started wit 'length'
04:07 <jle`> trineroks: allPairs [] [] = ...
04:07 <jle`> trineroks: allpairs (x:xs) [] = ...
04:07 <trineroks> yeah, that snippet isn't doing what I intend it to do
04:07 <erisco> you can also read it like set builder notation
04:07 <jle`> trineroks: allPairs [] (y:ys) = ...
04:07 <jle`> allPairs (x:xs) (y:ys) = ..
04:07 <erisco> *like*, as it isn't, but similar concept
04:08 <jle`> tswett_to_go: what's the issue?
04:08 <jle`> tswett_to_go: or are you just looking to clean it up
04:08 <erisco> trineroks, what snippet?
04:08 <tswett_to_go> jle`: I'm just looking for feedback about style.
04:09 raycoll joined
04:09 <trineroks> [(x,y) | x <- xs, y <- ys]
04:09 <trineroks> this one
04:09 <erisco> > [(x,y) | x <- "abc", y <- [1..2]]
04:09 <tswett_to_go> Does all of this look idiomatic, or am I doing some unconventional stuff?
04:09 <lambdabot> [('a',1),('a',2),('b',1),('b',2),('c',1),('c',2)]
04:09 <trineroks> I don't know why, but I'm getting this error "Couldn't match expected type [[Char]] -> t with actual type [Integer]"
04:10 <trineroks> I'm testing this using List A = [1,2]
04:10 <trineroks> List B = ["string", "string2"]
04:10 <jle`> hm, variable names can't have spaces in them
04:10 <jle`> and they also can't start with capital letters
04:11 <trineroks> oh wait
04:11 <trineroks> nevermind, I'm a dumbass
04:11 <trineroks> I forgot to preface it with my function name lol
04:11 <trineroks> ah there we go
04:12 <trineroks> but if I wanted to write this from scratch...
04:12 takle joined
04:13 jre2 joined
04:14 <trineroks> jle`, [] means an empty list right?
04:14 <tom7942> start with your base case, make it work for one more
04:14 <jle`> trineroks: yes
04:14 <tom7942> recurse
04:15 JavaSucksMan joined
04:15 <erisco> tswett, your first clause of parseIdentifier looks suspicious
04:16 <erisco> tswett, unless I misunderstand guards, I think the first clause will always be used because all strings match str
04:16 <erisco> tswett, so it will either return Left reserved-word-error or crash
04:18 <tswett_to_go> erisco: thanks for taking a look. It seems to be working fine; when the guard expression comes out as False, it's falling through to the next equation.
04:18 <erisco> that is weird
04:19 <erisco> I didn't think guards fell through like that
04:21 takle joined
04:21 systadmin joined
04:21 <tom7942> yeah, you usually write: | otherwise =
04:21 <tom7942> which is the same as | False =
04:21 <tom7942> er True
04:21 <Koterpillar> > otherwise
04:21 <lambdabot> True
04:22 <erisco> even without that I didn't think it fell through
04:22 <erisco> because I was writing some complicated cases a few months ago and I remember that not happening
04:22 <MarcelineVQ> tswett_to_go: the name repetition is hard to read through, consider using a case statement for parseIdentifier, you can also combine the multiple different guards into one or two guard blocks
04:22 <erisco> suppose I remember incorrectly
04:22 Destol joined
04:23 raycoll joined
04:25 <tswett_to_go> MarcelineVQ: that's a good idea, thanks.
04:25 <erisco> why the bang pattern in showsPrec?
04:25 <erisco> I thought a pattern match there was already strict
04:26 tromp joined
04:26 <trineroks> hey guys, "maximum" just returns the highest member of a list, right?
04:26 <tswett_to_go> What do y'all think of IdentifierInternal, Identifier, fromIdentifier and toIdentifier? Good idea or pointless overkill?
04:26 barryburd joined
04:26 <tswett_to_go> erisco: nope, it's not strict in (Identifier str) without the bang.
04:26 <erisco> well I am not sure why the data constructor is not just called Identifier
04:26 <erisco> but it is fine to newtype String
04:27 <barryburd> I’ve defined a class as follows:
04:27 <barryburd> class Fancy a where
04:27 <barryburd> fancy :: a -> String
04:27 <erisco> tswett_to_go, is this something to do with it being a newtype?
04:27 <barryburd> define Purchase as follows:
04:27 <barryburd> data Purchase = Purchase Item Amount
04:27 <barryburd> I let Int and Purchase be instances of Fancy
04:28 <tswett_to_go> erisco: the bang thing, you mean? The reason I want it to be strict in str is so that if there's an error, it gives you the error message right away instead of starting to print stuff out and then showing you the error.
04:28 <barryburd> When I try to do putStrLn $ Fancy 33 , I get an ambiguous type message. Why does Haskell think that 33 might be a Purchase?
04:28 takle joined
04:29 <erisco> tswett_to_go, I don't know what that means. Pattern matches are strict, as far as I know, and so I don't see the bang being necessary
04:29 <erisco> tswett_to_go, but maybe the rules are different wrt newtypes, I wouldn't be so surprised
04:29 Jacoby6000_ joined
04:30 <tswett_to_go> As for why the data constructor isn't just called Identifier, the motivation is that I want users of this module to be able to pattern match on Identifier, but not to use it to create their own Identifier values.
04:30 <erisco> barryburd, did you mean putStrLn $ fancy 33 ?
04:31 <barryburd> Yes, I meant putStrLn $ fancy 33
04:31 <tswett_to_go> erisco: I think pattern matches are only strict as far as the pattern goes... so to speak.
04:31 djapo joined
04:31 <Koterpillar> :t 33 -- barryburd
04:31 <tswett_to_go> > (\(Just x) -> "hello") (Just undefined)
04:31 <lambdabot> Num t => t
04:31 <lambdabot> "hello"
04:31 <tswett_to_go> erisco: ^^^ it's strict in (Just x), but it's not strict in x.
04:31 <erisco> barryburd, please lpaste the whole error, but it is probably because 33 is polymorphic
04:32 <erisco> barryburd, I don't think it looks at available instances and then decides what the type is
04:32 <erisco> barryburd, rather it figures out the type and then finds an instance
04:32 <erisco> barryburd, so when the type is variable then so can be the instance, hence an ambiguity error
04:32 <tswett_to_go> erisco: now that I think about it again, I think newtypes must be special here after all.
04:33 <erisco> > (\!(Just x) -> "hello") (Just undefined)
04:33 <lambdabot> <hint>:1:13: error: parse error on input ‘->’
04:33 <erisco> > let foo !(Just x) = "hello" in foo (Just undefined)
04:33 <lambdabot> "hello"
04:33 <erisco> see, your example is incorrect
04:33 <tswett_to_go> I think pattern matching on the constructor of a newtype doesn't force anything at all.
04:34 <tswett_to_go> Let me see, can I...
04:34 <erisco> you placed undefined where x is, and of course it is not strict on x because we do not pattern match on x
04:34 plugin joined
04:34 <tswett_to_go> @newtype MyString = MyString String
04:34 <lambdabot> Unknown command, try @list
04:34 <barryburd> Ambiguous type variable arising from a use of ‘fancy’ … Potential instances exist: instance Fancy Purchase, instance Fancy Int…
04:34 sleffy joined
04:35 <erisco> which you acknowledge, but then it just proves the redundancy of the bang in showsPrec
04:35 <barryburd> That’s much of the error message (not all of it)
04:35 <erisco> barring different rules for newtype
04:35 <erisco> barryburd, try (33 :: Int)
04:35 praduca joined
04:36 <barryburd> Yes, (33 :: Int) works. I’m just not sure why it’s suggesting Purchase as one of the possible types.
04:36 <tswett_to_go> And if that's the case, that means we've proved that there are in fact different rules for newtype.
04:36 <erisco> it is just listing instances
04:36 <erisco> it doesn't know Purchase is not a Num
04:36 <erisco> like I said, it does not consider "here are the only instances I have"
04:36 <erisco> it figures out the type and then finds an instance
04:37 <erisco> so if you chose the Purchase instance it would then be looking for Num Purchase
04:37 <barryburd> OK. I have some further investigating to do about Int and Num. Thank you.
04:38 timrs2998 joined
04:38 <glguy> tswett_to_go: Yes, pattern matching on a newtype doesn't force anything. The newtype constructors don't exist at runtime
04:38 <tswett_to_go> I want to do a test, but I'm not aware of any newtypes in the standard libraries...
04:39 <glguy> tswett_to_go: There are a lot in Data.Monoid you can try
04:39 <erisco> the question is if the bang transfers to the unwrapped value
04:39 <MarcelineVQ> tswett_to_go: most things in Data.Monoid and Data.Semigroup
04:39 <erisco> but I don't think so, I think it is just redundant
04:39 FreeBirdLjj joined
04:39 eacameron joined
04:40 <glguy> I think I missed the original question. Would you want to restate it?
04:40 <tswett_to_go> erisco: I've *tried* it; the bang changes the behavior of the program.
04:40 <erisco> that's alarming
04:40 <erisco> how could that be?
04:40 <tswett_to_go> glguy: we're talking about http://lpaste.net/353801, line 16.
04:40 <erisco> strictness should not be doing that, unless unsafe IO is involved
04:40 <erisco> or you are talking about time and memory
04:40 <tswett_to_go> "showsPrec p !(Identifier str) = ..."
04:41 <tswett_to_go> Identifier is a newtype around String.
04:41 <erisco> or you are talking about one case being bottom and the other not
04:41 <erisco> what is this change in behaviour?
04:41 <glguy> tswett_to_go: Where is the Identifier value constructor defined?
04:42 takle joined
04:42 <glguy> Oh, I see the pattern synonym now
04:42 <tswett_to_go> Without the bang, showing an "undefined" Identifier value prints this out:
04:42 <glguy> not sure how I missed it
04:42 <tswett_to_go> toIdentifier "*** Exception: An identifier cannot be empty.
04:42 <tswett_to_go> With the bang, it's just:
04:42 <tswett_to_go> *** Exception: An identifier cannot be empty.
04:43 <glguy> What's the surprise?
04:43 <erisco> okay, that's fine, it is unsafe IO involved
04:44 <tswett_to_go> You consider the "error" function to be unsafe IO?
04:44 <erisco> yes
04:44 <erisco> that is how it is defined
04:45 <erisco> and when you change evaluation order with strictness you can see differences when unsafe IO is involved
04:45 <erisco> but also there is a view pattern involved and I am not familiar with how those work
04:45 <erisco> it isn't just about the newtype like I thought it was
04:45 <glguy> The view pattern doesn't matter
04:45 <MarcelineVQ> they're really quite interesting
04:46 <erisco> it has to matter wrt what the bang does
04:46 <erisco> I am guessing "Identifier" is a pattern, and the bang is applied to this
04:46 <glguy> The view pattern doesn't matter regarding the bang
04:46 <glguy> You get the same behavior inlining the newtype constructor rather than using the view pattern
04:46 andyhuzhill joined
04:47 <glguy> Given newtype N = MkN Int, forcing a value with type N forces the Int
04:47 <glguy> so: example !(N x) = ...
04:47 <glguy> is going to force the x
04:47 mada joined
04:47 <glguy> err
04:47 <glguy> so: example !(MkN x) = ...
04:47 <glguy> The newtype constructors don't count as far as strictness and evaluation go
04:48 raycoll joined
04:48 <erisco> okay, so if F is a newtype
04:48 <erisco> then !(F x) is strict on x
04:48 <glguy> yeah
04:49 roconnor joined
04:49 <glguy> It might as well be !x
04:49 <erisco> okay, I didn't know if that was the case
04:49 <glguy> the F just changes the type
04:49 unK_ joined
04:49 <erisco> the other option is it is just redundant i.e. ignored
04:49 <erisco> not sure how I feel about that
04:50 takle joined
04:50 sssilver joined
04:53 felixsch__ joined
04:53 <MarcelineVQ> that's pretty interesting, I saw a bit of that here https://wiki.haskell.org/Newtype (4 Examples section) but didn't know how to piece together how ! would interact with that behavior
04:53 uglyfigurine joined
04:53 <mmachenry> I'm having a design problem and I'm wondering if anyone has any suggestions.
04:53 <MarcelineVQ> https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#bang-patterns-and-strict-haskell has a lot of examples with let but I also wasn't sure how that translates to patterns ni a function defintion
04:53 <mmachenry> I'm writing a dynamic state space search.
04:54 <mmachenry> I have a game state in the state monad and nested within RandT and other transformers making up my primary type that I'm searching.
04:55 <mmachenry> At some point, I need to access bits of the game state. I sometimes do this by focusing on a particular piece in the game. I need to change that piece.
04:56 <mmachenry> To do so, functionally, I'm finding the piece in the game state, and then making the manipulation I need, then removing the old version and inserting the new version.
04:56 eacameron joined
04:56 <mmachenry> However, now, in order to maintain information about how the piece is changing while I also maintain information about how the game is changing, I kind of want to wrap my game monad in a (StateT Piece)
04:57 xiinotulp joined
04:57 diegoksp joined
04:57 <mmachenry> But that is going to make it so that get,put, and modify refer to just the piece.
04:57 <mmachenry> I'm sorry if this is hard to explain.
05:01 takle joined
05:03 Xanather joined
05:04 splanch joined
05:06 shafox joined
05:06 eacameron joined
05:08 <erisco> is the issue that you have multiple StateT in your stack?
05:10 <Koterpillar> add a lens to the piece to the state
05:10 <Koterpillar> State Game -> State (Game, Maybe (Lens' Game Piece))
05:12 ali_bush joined
05:12 ali_bush joined
05:13 <mmachenry> erisco: That's an issue with one proposed solution. But really I think that solution might be wrong for many reasons.
05:14 <mmachenry> Koterpillar: I was reading about lenses. I was thinking they might be a good solution.
05:14 <erisco> well it isn't a technical issue because it just depends on how you lift get/put/modify
05:14 vydd joined
05:14 eacameron joined
05:14 <mmachenry> erisco: Yeah I suppose it's not hard to get around it, huh?
05:14 <erisco> but from a practical standpoint it isn't friendly to have a deep stack
05:15 <mmachenry> Basically I want to keep my GameEffect monad which is basically ListT (RandT (State GameState))
05:15 a3Dman joined
05:16 <Koterpillar> maybe you even want to pass the piece lens explicitly to functions that need it
05:16 <erisco> I like monads like I like the plague
05:16 <mmachenry> I then want to do something to a piece that's in that GameState. Imagine game state is a matrix of integers. Let's say I get one of them.
05:16 <Koterpillar> do you want access to the old state though?
05:17 <mmachenry> I want to hold on to that piece… add one to it, that should update the board but also update the piece I'm holding in a variable elsewhere so that when I delete it from the board, it's equal to the piece that's acually there.
05:17 <Koterpillar> because if not, use zoom to get from State GameState to State Piece
05:17 <mmachenry> Zoom?
05:17 xujun joined
05:17 takle joined
05:18 <erisco> the way you worded that sounds impossible
05:18 arawack joined
05:18 <Koterpillar> zoom :: (a -> (b, b -> a)) -> State a r -> State b r
05:18 <erisco> because you've described mutability
05:18 <mmachenry> erisco: I've gotten it written with really inelegant functions and types.
05:18 <mmachenry> But a monad transformer really cleaned up the game state effects.
05:19 <mmachenry> I want to do the same thing for the pieces.
05:19 <Koterpillar> do you want to modify both the complete state and the piece in one function?
05:19 <mmachenry> Koterpillar: Yeah, more or less.
05:20 <* erisco> recalls talking about an indexed state monad a few days ago
05:20 <Koterpillar> let's say data GameState = Game { pieces :: [Piece] }
05:20 <mmachenry> I want Piece -> GameEffect
05:20 nemorichard joined
05:20 <mmachenry> Kotepillar: Sure
05:20 <Koterpillar> and the first thing your function does is put $ Game []
05:20 <Koterpillar> and then you're trying to modify the piece
05:20 <Koterpillar> what happens?
05:21 splanch joined
05:21 <erisco> can you just work with the state (GameState, Piece)?
05:21 <mmachenry> Let's say I have Piece -> GameEffect. and data Piece = Piece Bool Int
05:22 <mmachenry> Doesn't matter what the Bool and Int are.
05:22 <Koterpillar> that doesn't modify anything...
05:22 <erisco> you can zoom to this state
05:22 <erisco> extract the piece, put the piece back in
05:23 <erisco> maybe not the most elegant because there is a different piece in the GameState than what you've pulled out
05:23 <erisco> but then you can use a lens like Koterpillar says
05:23 <mmachenry> Now I want to write a function that's basically myFunc :: Piece -> GameEffect; myFunc piece = do {negateThePiece; moveThePieceBackSpace }
05:23 <erisco> or you can just program responsibly
05:23 <mmachenry> I want negateThePiece and moveThePieceBackSpace to be separate functions that I can compose.
05:24 <Koterpillar> mmachenry: so you have a notion of "current piece", right?
05:24 <mmachenry> Koterpillar: Yes in a way.
05:24 <mmachenry> It's not really current to the game state
05:24 <Koterpillar> State (Game, Maybe (Lens' Game State))
05:24 <mmachenry> It's just the piece I'm trying to move at this point in the search for a solution.
05:24 <Koterpillar> State (Game, Maybe (Lens' Game Piece))
05:24 <Koterpillar> sorry
05:24 <Koterpillar> or
05:25 <mmachenry> Koterpillar: Not sure that's going to help me all that much.
05:25 <Koterpillar> type PieceRef = Lens' Game Piece
05:25 <Koterpillar> negateThePiece :: PieceRef -> GameM ()
05:25 <erisco> you want the Piece in the state, don't you?
05:25 <Koterpillar> moveThePieceBack :: PieceRef -> GameM ()
05:25 <Koterpillar> i.e. pass the lens around explicitly
05:25 <mmachenry> Because I want, if possible, GameEffect to remain unchanged. Pieces are just one thing that could be the current focus of what I'm trying to manipulate the game state with
05:25 <erisco> I thought that was the essence of your inquiry
05:25 <mmachenry> And GameEffects are very solid and reusable.
05:26 <mmachenry> erisco: Yeah… let me fininsh my example.
05:26 <erisco> you can focus on more than just Piece
05:26 <erisco> just substitute the type Piece with whatever you want
05:26 <erisco> and I don't know what GameEffect is but that doesn't have to change, I don't think anyways
05:26 <erisco> you use zoom like Koterpillar said
05:27 Rainb joined
05:27 takle joined
05:27 <erisco> so you reach a point where you want to focus on a part of the game state
05:27 <erisco> you use zoom to augment the state with this focus
05:27 <glguy> You can't have a Maybe (Lens' s a), specifically that Maybe can't be applied to a Lens' _ _
05:27 <erisco> now you have some functions which work on this focused state
05:27 <Koterpillar> glguy: why not?
05:27 <mmachenry> So I have negatePiece :: Piece -> GameEffect; negatePiece (Piece b i) = let newPiece = Piece False i in do { s <- get; put (insert newPiece (delete piece s)) }
05:28 <glguy> Because Lens' is a polymorphic type
05:28 <mmachenry> That game effect takes a piece and negatates it.
05:28 <erisco> then you move back to the unfocused state
05:28 <mmachenry> moveAPieceBack would do a similar manipulation.
05:28 <Koterpillar> mmachenry: are your pieces identifiable?
05:28 <Koterpillar> mmachenry: i.e. what would insert p $ insert p $ insert p s do?
05:28 <mmachenry> Koterpillar: I actually tried that. It was a nightmare. :(
05:28 systadmin joined
05:29 <mmachenry> It's a good idea.
05:29 <mmachenry> But it was hard.
05:29 <suppi> glguy: you need ALens' or something like that, right?
05:29 <mmachenry> Koterpillar: multiple inserts would make a weird game state that shouldn't happen and duplicate the piece
05:29 <glguy> suppi: Yes, that or ReifiedLens
05:30 xall joined
05:30 <erisco> :t insert
05:30 <lambdabot> Ord a => a -> [a] -> [a]
05:30 <Koterpillar> is this your insert?
05:31 <mmachenry> Ah no, sorry, I was being a little fast and loose there.
05:31 <suppi> i remember having problems with that and it kinda made me put aside the project i was working on
05:31 <mmachenry> Let's imagine it's just (:)
05:31 <mmachenry> I remove the piece from the board, the not negated version, and cons on a negated version of the piece.
05:31 Swizec joined
05:32 <mmachenry> Effectively just doing and in-place update to the state of the piece. But functionally.
05:32 raycoll joined
05:32 <mmachenry> Thing is I have to now now that the piece is negated so that when I go looking for it in the movePieceBackASpace function it'll be (==) to the piece I'm actually working with.
05:33 <mmachenry> So chaining together these updates that focus on one piece is the critical issue.
05:33 <mmachenry> You think zoom helps me solve that problem? Lens maybe?
05:33 <erisco> or you can add a StateT to your stack
05:34 <mmachenry> erisco: Yeah I was just about to do that, felt weird about it, and came here. :)
05:34 <erisco> zoom lets you change the state, but you said you want to still use GameEffect
05:34 tom7942 joined
05:35 <mmachenry> So I have a monad transformer stack… I just call get and it uses the one and only StateT in the transformer stack. How would adding a StateT Piece change that?
05:35 ramzifu joined
05:35 <erisco> the lens lets you read and write a part of the game state, but isn't relevant to the monad issues
05:36 <mmachenry> Lens might work well if the updates can happen all in the original State GameState type
05:36 <erisco> so I am guessing you have StateT GameEffect (Lens' Game Piece) now, or something
05:37 <erisco> but I'm not a lens person so I don't know if that type works
05:37 takle joined
05:37 <mmachenry> That puts the Piece on the inside of this stack of transformers though.
05:37 splanch joined
05:37 sssilver joined
05:37 <mmachenry> Which is a bit unsatisfying to me. Because it requires I put everything that will be the focus of my game state updates at some point in there along with it. Or a union type that knows about all of them.
05:38 <mmachenry> I will be adding focuses of things I'm updating. The game state is complicated.
05:38 <mmachenry> So I don't want to have to list them all ahead of time in the game effect monad
05:38 <erisco> I don't really understand
05:38 <mmachenry> Currently it's something like this:
05:39 <mmachenry> ListT (RandT StdGen (State GameState))
05:39 raycoll joined
05:39 <mmachenry> type GameEffect = <that>
05:39 <mmachenry> But if I change it to this:
05:40 <mmachenry> type GameEffect = ListT (RandT StdGen (State (Lens' GameState Piece)))
05:40 <mmachenry> Then I've made Piece part of the GameEffect.
05:40 ali_bush joined
05:40 ali_bush joined
05:41 <erisco> why would you change it like that?
05:41 <mmachenry> Because I thought you were suggesting that.
05:41 <erisco> no, reread
05:41 fizruk joined
05:41 <mmachenry> "StateT GameEffect (Lens' Game Piece)"
05:41 <erisco> :t StateT
05:41 <lambdabot> (s -> m (a, s)) -> StateT s m a
05:41 <erisco> okay reverse the args
05:42 <mmachenry> Oh I think I see what you're saying.
05:42 <erisco> you're just going to add on a StateT to the stack
05:42 <mmachenry> Well.. if I put a "StateT Piece GameEffect" that kind of does away with the need for lens in a way.
05:42 <glguy> mmachenry: No, you can't use Lens' there
05:43 <erisco> I can't comment on the lens portion of it
05:43 <mmachenry> Yeah, like I said, I was about to do that, but didn't know how to reference the correct "get"
05:43 <erisco> I don't know how the lens would manage to read and write from the state
05:43 <mmachenry> How would I make sure I get the right get and put?
05:43 <erisco> it just depends on how you lift them
05:43 <mmachenry> I should really read up on lens even if it's not for this project.
05:43 <erisco> :t get
05:43 <lambdabot> MonadState s m => m s
05:44 <erisco> too many monad classes -.-
05:44 <mmachenry> I'm not lifting at all right now.
05:44 <erisco> well if you don't lift you'll get the outermost state
05:44 <mmachenry> And if I lift I'll get the inner get? Okay, that makes plenty of sense.
05:45 ramzifu joined
05:45 takle joined
05:45 <mmachenry> I guess that's probably the most straight forward way to do this.
05:45 <erisco> when you change the piece it isn't going to update in the game state, mind you
05:45 <erisco> that is what the lens part was trying to achieve but I don't think it succeeds with this setup
05:46 <erisco> you'd be looking to write the updated piece back to the game state when you drop the outer StateT again
05:47 justicefries left
05:47 cultofmetatron joined
05:47 <erisco> just a side note, I don't find it a good idea to depend on the state as it is being computed
05:47 <mmachenry> Yeah that's exactly my plan
05:48 <erisco> this leads to weird, obnoxious, ordering issues
05:48 <mmachenry> Maybe not very elegant.
05:48 <mmachenry> I think I can handle the ordering alright.
05:48 <erisco> it is much better if you can compute the next state only from the previous state
05:48 <erisco> rather than the previous state plus an incomplete delta
05:48 sleffy joined
05:48 sssilver joined
05:48 <erisco> I see games written like that and they run into awful ordering problems
05:49 <mmachenry> I can compute the next state just from the current.
05:50 <erisco> it starts with the decision that there is just one mutable state object
05:51 <erisco> then you're immediately in the last state + incomplete delta paradigm
05:51 ali_bush joined
05:51 <erisco> but you can just as easily do this without mutability
05:51 xtreak joined
05:52 takle joined
05:53 Reshi joined
05:55 conal joined
05:55 sleblanc` joined
05:55 osa1 joined
05:55 osa1 joined
05:56 <mmachenry> Sure.
05:56 <mmachenry> Thans for your help, bye the way.
05:56 <erisco> you're welome
06:00 JoshS joined
06:02 takle joined
06:02 Sh4rPEYE joined
06:03 ali_bush joined
06:03 ali_bush joined
06:03 Sh4rPEYE joined
06:05 raycoll joined
06:05 <Sh4rPEYE> Hey. I reached the chapter about monoids and bedore I knew it, I was lost. Am I right when I think that monoid(s) is just a typeclass?
06:06 systadmin joined
06:06 <erisco> Sh4rPEYE, Monoid is a type class, yes
06:07 <Sh4rPEYE> And as such it has some functions, which all its instances have to define?
06:07 <Sh4rPEYE> So, when Num has instance of monoid, it defines mappend, mempty etc?
06:07 dec0n joined
06:08 <erisco> Num is a type class, so there is no such thing as a Num instance of Monoid
06:08 <erisco> instances are defined on types. Num is not a type.
06:08 nomotif joined
06:08 <Sh4rPEYE> So... on Integer?
06:08 <erisco> then yes, correct
06:08 <geekosaur> except that there isn't one
06:09 <Sh4rPEYE> Ok... and what's that 'Sum' and 'Product' about?
06:09 <geekosaur> that's why there isn't one :)
06:09 <erisco> yes, so there can only be one instance of a type class per type
06:09 a3Dman joined
06:09 certainty joined
06:09 <geekosaur> rings ("numbers", unless you want to delve into number theory and learn the truth :) have *two* monoids.
06:09 <erisco> there are more than one possible instances for Integer, and so instead of choosing one arbitrarily the library authors chose none
06:10 <geekosaur> ((+),0) and ((*),1)
06:10 takle joined
06:10 <geekosaur> neither one can be considered primary, so we punt them both to newtypes
06:10 <erisco> mind you, this didn't stop people from making other non-unique instances
06:11 <Sh4rPEYE> Ok, great. Should've asked before - why do I need to define mappend for numbers? (Or rings, then)
06:11 mmachenry joined
06:11 <erisco> they have been defined for you
06:11 <Sh4rPEYE> Even if I end up with two... why do I need one in the firdt place?
06:12 <erisco> because there are functions defined only assuming a type is a Monoid
06:12 <Sh4rPEYE> * I meant, why are they define
06:12 <erisco> :t foldMap
06:12 <lambdabot> (Monoid m, Foldable t) => (a -> m) -> t a -> m
06:12 <erisco> such as that one
06:12 <erisco> so if you want to participate you need to define a Monoid instance for your type
06:13 <erisco> > getSum (foldMap Sum [1,2,3])
06:13 <lambdabot> 6
06:13 <erisco> > getProduct (foldMap Product [1,2,3])
06:13 <lambdabot> 6
06:13 <Sh4rPEYE> Oh, I see.
06:13 <Sh4rPEYE> It needs to be monoid, becaude ut needs thide associativity and identity things :-D
06:14 <Sh4rPEYE> Those*
06:14 <erisco> it needs mempty and mappend, which are supposed to abide by those laws, yes
06:14 <erisco> in Haskell these laws are not checked
06:14 <Sh4rPEYE> Mappend is just some arbitrary general append, then?
06:15 <erisco> mappend is associative and has mempty as an identity
06:15 <Sh4rPEYE> And mempty just general... Nothing
06:15 <erisco> mempty is the identity of mappend
06:15 <Axman6> Sh4rPEYE: you cannot have two instances of a Class for a specific type. Numbers have two (or more) possible Monoid instances, one using Addition and one using Multiplication. so we have the Sum and Product newtypes which allow us to choose which one we want
06:16 <erisco> they are named "append" and "empty" just 'cause
06:16 <Sh4rPEYE> The "identity" means it's something that makes mappend return the secind argument it was passed?
06:16 <Axman6> mappend mempty x = x and mappend mempty x = x
06:17 <erisco> well it is both a left and right identity
06:17 <Axman6> uh, mappend x mempty
06:17 <Sh4rPEYE> So, yes
06:17 razi1 joined
06:17 <erisco> but it doesn't have to return the argument given, it just has to give something equivalent
06:17 <Sh4rPEYE> Equivalent to what?
06:17 kvda joined
06:17 <erisco> to the argument
06:18 sanett joined
06:18 <mniip> oh man
06:18 <mniip> the technicalities of equality
06:18 <erisco> the way you worded it made it sound like object identities, which is not applicable here
06:18 <erisco> but also like mniip says it depends on what equality you are using
06:19 <erisco> in Haskell we're usually referring to ==
06:19 marcopullo joined
06:20 <mniip> except for ->
06:20 <mniip> then it's behavioral equality
06:20 <mniip> actually
06:20 <Sh4rPEYE> Oh, ok. Thanks
06:21 <mniip> are that many laws even realizable with ==
06:21 Sh4rPEYE joined
06:21 <Axman6> Sh4rPEYE: the reason people are being a bit particular about language here is that image you use lists to represent Sets, then [1,2,3] == [3,2,1]. to obey the monoid laws, we could happily have mappend [1,2,3] [] = [3,2,1]
06:21 <Sh4rPEYE> To wrap up: Monoid is simething that has a associative function and and identity for that function
06:22 uglyfigurine joined
06:22 <Sh4rPEYE> Yeah, I understand. My wording wasn't really precise
06:23 plugin joined
06:23 <Axman6> yep
06:23 takle joined
06:23 <mniip> hmm, curious
06:24 <mniip> in presence of arbitrary transitive-reflexive relations for ==, functions turn into arbitrary relations
06:24 <erisco> mniip, what is behavioural equality?
06:24 <Axman6> it's worth understanind there a lots of different monoids (Sum, Product, list, Any and All), but also combinations of monoids are also often monoids (hence the instance for (Monoid a, Monoid b) => Monoid (a,b))
06:24 <mniip> erisco, how do you check the fmap laws for ((->) e)
06:25 <Sh4rPEYE> Thank you very much for help.
06:25 <boxscape> Are there purely functional arrays (or similar data structures) that have runtime in O(m) to replace m elements, regardless of the length? I looked at diffarray, but that uses unsafePerformIO internally (a lot)
06:26 Sose_ joined
06:26 <jle`> boxscape: is the API purely functional?
06:26 <boxscape> yes
06:26 <erisco> fmap id f = id . f = \x -> id (f x) = \x -> f x = f
06:26 <jle`> are you asking for a theoretical answer, or are you looking for something you can use
06:26 <erisco> and whatever for the other law
06:26 <boxscape> jle`: theoretical answer
06:26 <erisco> mniip, so the equality I am using here is behavioural?
06:26 <Axman6> boxscape: what's wrong with that? the API is pure
06:26 <mniip> basically
06:26 <mniip> yes
06:26 <boxscape> It's not wrong, I just want to know whether it's possible :)
06:27 <mniip> boxscape, a quick thought suggests that no
06:27 magnap left
06:27 <boxscape> ok
06:27 <mniip> the best you can do on a pointer machine is log(m log m)
06:27 <mniip> errrr
06:27 <mniip> m log m
06:27 <jle`> boxscape: also it depends on what you mean by array
06:27 <Axman6> boxscape: there's probably structures similar to HAMT's which could do it in O(m log k) or something
06:27 magnap joined
06:27 mgu joined
06:28 <trineroks> hey guys, is it possible to let list = list?
06:28 <trineroks> like
06:28 <trineroks> let list = (map f xs)
06:28 <boxscape> What's k in that case, Axman6 ? the depth?
06:28 <jle`> trineroks: what happens when you try?
06:28 <trineroks> would give me a list "list" that has all the members of xs with f applied?
06:28 <Axman6> boxscape: yeah, probably bit size of pointers on the machine
06:28 <boxscape> ah, ok
06:28 xtreak joined
06:28 <boxscape> alright, thanks guys
06:28 <jle`> trineroks: if you defined 'list = map f xs', then list is a list of all the members of x with f applied to them, yes
06:29 <Axman6> trineroks: I'm not sure I understand the question, that's exactly what you get
06:29 <jle`> boxscape: if you consider type Array a = (Int -> a) to be a "purely functional" array
06:29 <jle`> then it has O(m) replacements
06:29 <boxscape> ah, yeah, that makes sense
06:29 <mniip> yeah but O(2^(ram size)) worst case
06:29 <mniip> yeah but O(2^(ram size)) worst case access
06:30 Sh4rPEYE joined
06:30 <Axman6> well, O(2^|Int|)
06:31 <jle`> yes, access is pretty bad :)
06:31 <mniip> Axman6, explain?
06:32 <jle`> boxscape: type Array a = [(Int, a)], same story
06:32 <Axman6> well, |Int| might be less than RAM size
06:32 igniting joined
06:32 <jle`> replace i x = ((i,x) :)
06:32 <mniip> if |Int| is larger, which it usually is, then yours is incorrect
06:32 <mniip> mine still is
06:32 takle joined
06:32 Rainb joined
06:32 <Axman6> on 32bit it can be smaller
06:33 <mniip> hardly
06:33 <boxscape> jle`: but... If you want to replace the last element in that list, wouldn't that still take O(length), because you have to go through the whole list?
06:33 <Axman6> ANYWAY,, this irrelevant :)
06:33 <jle`> boxscape: lookup would be finding the first match
06:33 <boxscape> oh, I see
06:34 <jle`> > find ((== 3) . fst) [(5,'a'), (3,'a'), (1, 'b'), (3,'c')]
06:34 <lambdabot> Just (3,'a')
06:34 mmachenry joined
06:34 <boxscape> right, ok
06:34 <jle`> > find ((== 3) . fst) $ (3,'c') : [(5,'a'), (3,'a'), (1, 'b'), (3,'c')]
06:34 <lambdabot> Just (3,'c')
06:34 <mniip> consider this
06:34 <mniip> with ADTs, all allocations are of bounded size
06:35 meandi_2 joined
06:35 <mniip> a datum can reference a bounded amount of other data
06:35 <jle`> anyway this kind of blurs the line for what you'd call an array, of course
06:35 <mniip> so to store N elements you need log N constructors
06:35 <jle`> but it seemed like you were considering some sort of tree structure as an array, which is already breaking from the traditional definition
06:35 subttle_ joined
06:35 <mniip> at least
06:35 <boxscape> right, I mostly meant fast access by that, I suppose
06:36 <mniip> fast access would be using an impure library
06:36 <jle`> traditionally, an array data structure refers to data stored in contiguous chunks in memory
06:36 tom7942 joined
06:36 <mniip> jle`, what's "memory"
06:37 <jle`> from the context of the interpretation it's pretty clear
06:37 <jle`> s/pretty/usually
06:37 <mniip> from the context of haskell it's nonsensical
06:37 <jle`> but this is distinct from the idea of an array of an abstract data type
06:37 <jle`> yes, my point was that the idea of a traditional array in haskell is already kind of weird
06:37 <mniip> oxymoronic
06:38 <jle`> so if you ask for an array, you probably have to clarify what you mean
06:38 <jle`> just something that implements the abstract operations of replace + access ?
06:39 <jle`> if so then yeah, you open yourself up to a lot of things that have O(1) replacement :)
06:41 <nshepperd_> mniip: might as well call the haskell ffi oxymoronic with that attitude
06:41 <mniip> we're talking theoretical haskell
06:42 <mniip> LC with ADT
06:42 <erisco> I'm waiting for the super-exponential algorithm
06:43 <mniip> store the hash of the array
06:43 <jle`> beautiful
06:44 danvet joined
06:46 <mniip> no wait
06:47 <jle`> that one should have constant-time lookup on the length of the array
06:47 <mniip> jle`, not for a variable length hash
06:47 <jle`> constant time replacements
06:47 <mniip> I have a better algorithm in mind though
06:48 <mniip> jle`, again no?
06:48 <trineroks> hey guys, is there a haskell function that returns the maximum value of a list as well as its inex?
06:48 <trineroks> index
06:48 <jle`> mniip: oh wait, nvm, yeah
06:48 <jle`> trineroks: you can use maximumBy
06:48 <geekosaur> ?
06:48 <mniip> you could encode your array as a solution to a system of rational equations
06:49 <mniip> and then
06:49 <mniip> using Tarski-Seidenberg...
06:49 takle joined
06:49 <jle`> > maximumBy (comparing snd) (zip [0..] "hello world")
06:49 <lambdabot> (6,'w')
06:49 <geekosaur> hm, right. I should be trying to sleep...
06:49 <trineroks> comparing snd?
06:49 <geekosaur> :t comparing
06:49 <lambdabot> Ord a => (b -> a) -> b -> b -> Ordering
06:50 <jle`> trineroks: it compares the second items in the tuples
06:50 <jle`> > comparing snd (1, 100) (3, 10)
06:50 <geekosaur> applies the function you specify to the parameter, then does the comparison
06:50 <lambdabot> GT
06:50 <jle`> > comparing snd (1, 100) (3, 10000)
06:50 <lambdabot> LT
06:50 pavonia joined
06:50 <jle`> oh, and comparing returns LT/EQ/GT based on which one is bigger
06:50 <geekosaur> so, you're handing it tuples of values and their indices, then telling maximumBy to only look at the value part
06:51 vach joined
06:51 <jle`> maximumBy takes a comparison function, an (a -> a -> Ordering)
06:51 <jle`> so you can tell it how to compare different items
06:51 sanett joined
06:51 <jle`> 'comparing snd' is a comparing function that compares tuples by their second item
06:52 <jle`> although, i suppose...
06:52 <jle`> > maximum (zip "hello world" [0..])
06:52 <lambdabot> ('w',6)
06:52 <jle`> that works fine too
06:52 <jle`> but that's a little more magical to me
06:53 <jle`> hm, oh, also it gives the last index that the item occurred in, instead of the first
06:53 <jle`> > maximum (zip "hello world wow" [0..])
06:53 <lambdabot> ('w',14)
06:53 <trineroks> what is "zip" btw?
06:53 <jle`> > zip [0..] "hello world"
06:53 <lambdabot> [(0,'h'),(1,'e'),(2,'l'),(3,'l'),(4,'o'),(5,' '),(6,'w'),(7,'o'),(8,'r'),(9,...
06:53 <trineroks> ah
06:54 <jle`> it zips up two lists, pairing them element-by-element
06:54 <jle`> feel free to try it out on ghci too :)
06:54 <jle`> > zip "abc" [1,2,3]
06:54 <lambdabot> [('a',1),('b',2),('c',3)]
06:54 <jle`> so zip [0..] "hello world" pairs up each letter in "hello world" with its index
06:54 <jle`> and `maximumBy snd` picks out the maximum in that list of tuples, based on the second item in the tuple (the letter)
06:54 ThomasLocke joined
06:54 <eatman> Hi! I was wondering what Vim plugins do you guys use for Haskell dev?
06:55 <jle`> mine have been sort of cobbled together over the years
06:55 <jle`> but this seems to be a good rundown on the state of the art http://www.stephendiehl.com/posts/vim_2016.html
06:55 <boxscape> > maximum (zip "hello world wow" [0,-1..]) -- I suppose works if you want the first 'w' in that case
06:55 <lambdabot> ('w',-6)
06:56 xtreak_ joined
06:56 eduardm joined
06:56 <trineroks> what if I want to find the maximum of only one list?
06:57 <trineroks> so for example, I have two lists
06:57 <trineroks> [5, 6, 3] and then [25, 36, 9] (the original list mapped with a square function)
06:57 <trineroks> I want this to return (36, 6)
06:57 <eatman> Thx jle`
06:57 <trineroks> it seems maximum over a zip doesn't exactly do this behavior?
06:58 <boxscape> in that case, maximumBy (comparing snd) is what you want
06:58 <cocreature> trineroks: isn’t that just (maximum [25,36,9], maximum [5,6,3])
06:58 Kreest__ joined
06:58 <Axman6> > maximumBy (comparing fst) (zip [25,36,9] [5,6,3])
06:58 <lambdabot> (36,6)
06:58 <trineroks> cocreature not exactly, since -6 squared would be 36
06:58 <Axman6> :t fst
06:58 <lambdabot> (a, b) -> a
06:58 <Axman6> :t comparing
06:58 <lambdabot> Ord a => (b -> a) -> b -> b -> Ordering
06:58 <cocreature> oh I should read the backlog
06:58 <jle`> trineroks: suqaring is monotonic
06:58 <jle`> so you can just find the maximum of [5,6,3] and thens quare it
06:58 <jle`> well, for positive numbers
06:58 <trineroks> but what if there's a list like
06:59 <trineroks> [5, -6, 6, 3]?
06:59 <trineroks> because in this case I want it to return
06:59 <trineroks> (36, -6)
06:59 subttle_ joined
06:59 <Axman6> do you want the maximum swuared number of unsquared number?
06:59 <boxscape> > maximumBy (comparing fst) (zip [25,36,36,9] [5,-6,6,3])
06:59 <cocreature> maximumBy abs
06:59 <Axman6> squared*
06:59 <boxscape> uhm
06:59 <jle`> you can map it to pair each item with its square
06:59 <jle`> > map (\x -> (x, x^2)) [5,-6,6,3]
06:59 <lambdabot> [(5,25),(-6,36),(6,36),(3,9)]
07:00 <boxscape> > maximumBy (comparing fst) (zip [25,36,36,9] [5,-6,6,3])
07:00 <lambdabot> (36,6)
07:00 <jle`> > maximumBy fst $ map (\x -> (x, x^2)) [5,-6,6,3]
07:00 takle joined
07:00 <lambdabot> error:
07:00 <lambdabot> • Occurs check: cannot construct the infinite type:
07:00 <lambdabot> b ~ (b, b) -> Ordering
07:00 insitu joined
07:01 <jle`> > maximumBy (comparing fst) $ map (\x -> (x, x^2)) [5,-6,6,3]
07:01 <lambdabot> (6,36)
07:01 <boxscape> comparing snd?
07:01 <jle`> oh
07:01 <jle`> > maximumBy (comparing fst) $ map (\x -> (x^2, x)) [5,-6,6,3]
07:01 <lambdabot> (36,6)
07:01 tristanp joined
07:02 wtetzner joined
07:02 cur8or joined
07:03 takuan joined
07:03 <trineroks> can anyone explain why this isn't working then?
07:03 <trineroks> http://pastebin.com/BqT2Kxk4
07:03 <boxscape> trineroks: your list is a single element
07:03 <boxscape> because it's the maximum of another list
07:04 <trineroks> oh shit
07:04 <trineroks> that's right
07:04 <trineroks> but even when I remove it, I still get errors...
07:04 tobill joined
07:04 <trineroks> http://pastebin.com/Gz4nKsHC
07:05 systadmin joined
07:05 <boxscape> why is there a do?
07:06 <jle`> trineroks: always paste the error too
07:06 <jle`> rule #1 :)
07:06 <trineroks> man
07:07 <trineroks> if there's an easy way to copy and paste the error from cmd
07:07 <boxscape> on windows?
07:07 <jle`> usually you can just higlight it and ctrl+c
07:07 <trineroks> I can't highlight it
07:07 <trineroks> but I can take a snapshot
07:07 <trineroks> http://puu.sh/uUd01/c92ef85833.png
07:07 <boxscape> rightclick -> mark -> Enter?
07:07 <jle`> it depends on what your terminal emulator is
07:07 <jle`> but also yes a lot of people screenshot it
07:07 raichoo joined
07:07 <jle`> trineroks: have you tried importing the modules where maximumBy and comparing come from?
07:08 <Axman6> urgh, why is windoes so broken >_<
07:08 <jle`> do you know what "variable not in scope" means, in an error message?
07:08 <Axman6> windows*
07:08 zeroed joined
07:08 <jle`> it means that you're using it, but it's not defined anywhere
07:08 <jle`> so in this case you'll have to import the modules that procide it
07:08 <jle`> s/procide/provide
07:08 <trineroks> so what would I import?
07:09 <trineroks> import Data.List?
07:09 <boxscape> yes, Data.List for maximumBy and Data.Ord for comparing
07:09 <jle`> you can use hoogle to find out where things come from in general
07:09 <jle`> but yes in this case Data.Ord has comparing
07:09 <boxscape> @where hoogle
07:09 <lambdabot> http://haskell.org/hoogle http://fpcomplete.com/hoogle – See also Hayoo, which searches more packages: http://hayoo.fh-wedel.de/
07:10 takle joined
07:10 Wizek joined
07:10 <jle`> also the documentation for 'base' has an index too :)
07:11 <trineroks> alright I can see it works for the most part, however it's still giving me the wrong tuple for this case
07:11 <trineroks> maxOver (\x -> x * x) [3,5,4,-6,6]
07:11 <trineroks> gives me (36, 6) rather than (36, -6)
07:11 <jle`> it seems like maximumBy gives the last result for some reason
07:12 a3Dman joined
07:12 <trineroks> I don't quite understand that
07:13 <jle`> well, maximBy fst compares only the first item in the tuple
07:13 <trineroks> also if this is working as intended, wouldn't zip list xs give me (9, 3) (25, 5) (16, 4) (36, -6) (36, 6)?
07:13 <jle`> so to compare (36, 6) and (36, -6), it only looks at the 36
07:13 <trineroks> yes
07:13 <jle`> so in maximumBy's eyes, (36, 6) and (36, -6) are equal
07:13 <jle`> they are both maximums of that list
07:13 <jle`> maximumBy just seems to pick the final maximum
07:13 <trineroks> yeah
07:13 <trineroks> ah
07:14 <trineroks> would I have to modify this to pick the first maximum?
07:14 <cocreature> gnah, I just looked at the source of maximumBy to figure out why it uses the final maximum and remembered that it uses foldr1 instead of foldl'
07:15 <jle`> what why is that even a thing
07:15 vydd joined
07:15 <jle`> that doesn't make any sense v.v
07:15 ninegrid joined
07:15 electrostat joined
07:15 <trineroks> so then how could I fix this to work as intended?
07:15 <cocreature> jle`: it probably makes even less sense than implementing sum in terms of foldr
07:15 <Axman6> -_-
07:15 <jle`> :'(
07:16 Swizec_ joined
07:16 <cocreature> I hate that all these useful functions are implemented like that but I’m too lazy to fight to change their definitions
07:16 <Axman6> off to -libraries with this! (to distract from all the Foldable nonsense there at the moment)
07:16 <jle`> i think they're from the Report
07:16 <kadoban> Perhaps that's so you can get the maximum of an infinite list?
07:16 <jle`> lol
07:16 <cocreature> kadoban: good luck with that
07:16 <kadoban> I'm only 99% joking. Are there types where you could? I think I could make one, though I don't know if it'd actually work.
07:17 jhrcek joined
07:17 <Axman6> if you had a short circuiting definition of max perhaps
07:17 <kadoban> Though ... even if you did, how would that ever be useful. It'd either give you "Infinity" or run forever.
07:17 <Axman6> like min Nothing _ = Nothing IIRC
07:17 takle joined
07:17 <kadoban> Right
07:17 sssilver joined
07:18 <cocreature> maximumBy uses cmp not max
07:18 <cocreature> eh nvm
07:18 <jle`> there isn't any way compare can be meaningfully short-circuiting
07:18 <Axman6> > minimum $ Nothing : repeat (Just 1)
07:18 <lambdabot> mueval-core: Time limit exceeded
07:18 <jle`> because compare Nothing x has to check if x is also Nothing
07:18 <jle`> in which case it would be EQ
07:19 <cocreature> ah it looks like for lists it’s at least foldl1 but not foldl1'
07:19 <cocreature> hm, I guess you don’t need strictness here
07:19 <cocreature> you’re forcing evaluation at every step anyway
07:19 <trineroks> well I just fixed it
07:19 <trineroks> I'm not used maximumBy
07:20 <trineroks> using*
07:20 Yuras joined
07:20 <kadoban> jle`: Maybe could just say that "Infinity" is greater than everything else, even other infinities? That ... seems like a wacky thing though.
07:21 <cocreature> why is maximum part of Foldable but maximumBy is not oO
07:21 <cocreature> that seems like the wrong way around
07:21 eacameron joined
07:22 <boxscape> uhm, maximumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a is part of http://hackage.haskell.org/package/base-
07:23 <cocreature> boxscape: but it’s not part of the Foldable type class
07:23 <cocreature> so you can’t overwrite it
07:23 <boxscape> ah, right, fair enough
07:23 <cocreature> and you’re stuck with that silly foldr1 definition
07:23 xtreak joined
07:24 <cocreature> yet another reason to use a non-default prelude because we’ll never be able to fix this
07:25 yinn joined
07:25 <jle`> well, time for BBP2
07:25 <Axman6> hooray!
07:25 <cocreature> jle`: and two more years of annoying discussions that don’t do any good
07:25 zeroed joined
07:25 <jle`> and two more years of bringing out the worst of the passive aggressiveness in the community? ;_;
07:25 zeroed joined
07:25 <cocreature> exactly
07:26 <Axman6> I would like the see the community more open to more aggressive changes/fixes these days. it didn't make sense a few years ago because there was less of a community of people trying to keep code up to date. I think things are better now
07:26 takle joined
07:26 <Axman6> far from perfect, but better
07:26 <jle`> maybe it's just time for ghc-9
07:26 <jle`> and not even pretend to have backwards compatibility
07:26 <Axman6> yeah
07:27 <jle`> and then for ghc-8 users we can let people import __future__
07:27 <Axman6> I feel each major GHC release (or each second one) should be a good excuse to make things better, with breakages if necessary
07:27 <JuanDaugherty> it's "passive aggression"
07:27 t0by joined
07:27 t0by joined
07:27 dawehner joined
07:27 <jle`> thank you JuanDaugherty
07:27 eacameron joined
07:27 <jle`> the major version bump for ghc seemed a bit arbitrary
07:28 <JuanDaugherty> BBP?
07:28 <Axman6> burning bridges proposal
07:28 freusque joined
07:28 <JuanDaugherty> ah, breaking changes for ghc i take it
07:28 <jle`> the droid from the new star wars
07:28 <jle`> not quite to ghc, but to Prelude
07:29 <JuanDaugherty> for it's profile hs is fairly dynamic, an ideal of conservative change I would say
07:30 unK_ joined
07:30 <jle`> the api cruft gives character to the language
07:30 eacameron joined
07:30 igniting joined
07:30 <Axman6> "rustic"
07:30 <JuanDaugherty> (profile compared to other high profile langs)
07:30 <jle`> gives a sense of history and legacy
07:31 <jle`> compare to a language like purescript which doesn't have much historical baggage
07:31 <halogenandtoast> Are there any nifty algorithms to determine if 3 unsorted numbers are consective?
07:31 <jle`> where's the character in that
07:31 <halogenandtoast> 3 unsorted numbers in a list
07:31 alfredo joined
07:31 <jle`> well, there are only six ways that three distinct numbers can be ordered
07:32 <jle`> maybe just enumerate over them :3
07:32 <jle`> i don't know if you're going to get any better than x <= y && y <= z, though
07:33 <erisco> why do printers never work
07:33 <halogenandtoast> That's not consecutive though
07:33 <halogenandtoast> erisco: is it a printer or an all in one printer
07:33 <Axman6> erisco: because you're not using a Mac (the one piece of hardware OS X excells at supporting is printers, but pretty much nothing else)
07:33 <erisco> a laser printer
07:33 <halogenandtoast> I'm pretty sure we've never gotten an all in one printer to ever work in human history
07:34 <erisco> I guess I'll get my mac tomorrow and plug it in
07:34 <erisco> it *was* working, and then now doesn't work
07:34 e14 joined
07:34 <sm> even on mac, it's not a sure thing
07:34 <erisco> reinstalled the drivers
07:35 <erisco> it printed one page and then stopped working again
07:35 tobill joined
07:35 <erisco> it also caused Windows to fail to boot a few times
07:35 <halogenandtoast> erisco: sounds like normal behavior to me.
07:35 <JuanDaugherty> halogenandtoast, same as sort
07:36 <JuanDaugherty> determine order for low number == sort
07:36 <halogenandtoast> JuanDaugherty: sure, I'll sort and then I guess just recursively check elements
07:36 <erisco> alright, g'night
07:37 <halogenandtoast> f (x:y:xs) = if x + 1 == y then f (y:xs) else False
07:37 <halogenandtoast> is my guess
07:37 <halogenandtoast> once sorted
07:38 <halogenandtoast> and then just have the base case f _ = True
07:38 xtreak joined
07:40 <cocreature> > (\xs -> all (== 1) (zipWith (-) (tail xs) xs)) [1,2,4]
07:40 <lambdabot> False
07:40 <cocreature> > (\xs -> all (== 1) (zipWith (-) (tail xs) xs)) [1,2,3]
07:40 <lambdabot> True
07:40 <cocreature> ^ halogenandtoast
07:40 <jle`> s/tail/drop 1
07:40 <cocreature> ah right, I always forget that
07:40 <halogenandtoast> why use drop 1 over tail?
07:41 <cocreature> because tail crashes on the empty list
07:41 <jle`> tail is partial
07:41 Itkovian joined
07:41 <jle`> > tail []
07:41 <lambdabot> *Exception: Prelude.tail: empty list
07:41 <halogenandtoast> oh right, boo hiss
07:41 <jle`> > drop 1 []
07:41 <lambdabot> []
07:41 FreeBirdLjj joined
07:41 oish joined
07:41 detrumi joined
07:41 <halogenandtoast> I'll need a second to digest that function
07:41 <halogenandtoast> okay digested
07:42 <halogenandtoast> neat
07:42 tom7942 joined
07:42 Itkovian_ joined
07:42 xtreak joined
07:42 <cocreature> halogenandtoast: that said I’m not sure if it’s really an improvement over just a manually recursive definition
07:43 FullyFunctional1 joined
07:43 <cocreature> halogenandtoast: btw you can replace your definition by x + 1 == y && f (y : xs)
07:43 <halogenandtoast> cocreature: very true
07:43 <jle`> the ol' `if p then True else False`
07:44 yellowj joined
07:44 <halogenandtoast> jle`: yeah I just didn't see it because recursion
07:44 <halogenandtoast> and coding on the spot in irc
07:44 <boxscape> if p == True then True else False
07:44 <cocreature> jle`: I actually found myself doing that not too long ago ;)
07:44 <cocreature> boxscape: if show p == "True" then read "True" else read "False"
07:44 <boxscape> brilliant
07:44 <cocreature> strings are the solution to everything!
07:45 tsdh joined
07:45 raduom joined
07:46 MoALTz joined
07:47 Mortomes|Work joined
07:48 tobill joined
07:48 certainty joined
07:48 arpl joined
07:49 <jle`> cocreature: i actually catch myself doing it too sometimes
07:49 cultofmetatron joined
07:49 <jle`> which leads me to think how many times i've done it and not caught myself
07:49 vydd joined
07:49 vydd joined
07:49 Yuras joined
07:49 zero_byte joined
07:49 <jle`> for the most part all of this is solved by just never using bools
07:49 earldouglas joined
07:49 <jle`> quality of code is inversely proportional to usage of obol
07:50 BartAdv joined
07:50 guiben joined
07:51 andyhuzhill joined
07:51 anohigisavay joined
07:51 <jle`> there is no safe dosage of bools
07:51 <halogenandtoast> thanks cocreature and others
07:51 Fairy joined
07:51 n1 joined
07:52 ljc joined
07:52 <anohigisavay> hi. i have always been confused about monads and tail recursion. monadic binds are not tail recursive right?
07:53 <jle`> i'm not sure if there is a meaningful way to answer that
07:53 <jle`> tail recursive doesn't have much of a meaning in haskell, anyway
07:53 <anohigisavay> i am thinking that if i enable {-# LANGUAGE Strict #-} then a monadic recursion will explode
07:53 xtreak joined
07:53 <anohigisavay> but it does not
07:53 <jle`> langage strict doesn't change the semantics of the language
07:53 <jle`> it only makes data fields strict by default
07:53 <anohigisavay> main = putStrLn "GG" >> main
07:54 <jle`> it just means that data Foo = Foo Int Bool is, by default, data Foo = Foo !Int !Bool
07:54 <jle`> it doesn't turn haskell into a strict language
07:54 <anohigisavay> jle`, that's StrictData extension no?
07:54 <jle`> also tail recursion doesn't have anything to do with strictness or evaluation strategies
07:55 <jle`> tail recursion just isn't a meaningful concept in haskell
07:55 tobill joined
07:55 <jle`> anohigisavay: ah yes, it also makes let bindings and pattern bindings strict by default, too.
07:55 <jle`> but it doesn't make haskell a strict language
07:56 <jle`> it just means that f x = ... is by default f !x = ..., etc.
07:56 <jle`> anohigisavay: if you are confused about monads and tail recursion, i have good news: the two things have nothing to do with each other :)
07:56 <jle`> hopefully that clears up the confusion?
07:56 mattyw joined
07:57 <anohigisavay> jle`, sorry :'(
07:57 <jle`> no need to be sorry :o
07:57 <anohigisavay> okay (>>=) is just a function
07:58 <anohigisavay> right
07:58 <jle`> but yeah, -XStrict only affects functions/data types declared in that module
07:58 <jle`> it doesn't modify the semantics of the language
07:58 <anohigisavay> jle`, okay so how do i understand that fact that monadic recursion doesn't explode? if strict is enabled it has to evaluate the second argument to >>= before applying the bind operation?
07:58 insitu joined
07:58 <jle`> -XStrict doesn't modify anything about how haskell evaluates things
07:58 thc202 joined
07:58 <jle`> it just affects the default behavior of how arguments are bound in functions defined in that module
07:59 <jle`> it's basically synactic sugar
07:59 <jle`> it doesn't change anything about haskell the language
07:59 free_beard joined
07:59 <jle`> it just basically inserts !'s for you, so you don't have to write f !x !y !z = ... everywhere, you can just write f x y z, which is "desugared" into f !x !y !z
07:59 <cocreature> -XStrict affects the definition of functions defined in that module not of things evaluated in that module
07:59 <jle`> it's mostly for syntactic convenience/cleanliness
08:00 <anohigisavay> OH!
08:00 <anohigisavay> i see
08:00 <jle`> anohigisavay: in your case, how >>= works is up to the definition of >>= for that specific typeclass
08:00 <anohigisavay> that makes it clear
08:00 <jle`> er, that specific instance
08:00 <jle`> every instance of Monad can define >>= however they want, as long as it obeys the laws
08:01 <jle`> it has nothing to do with the concept of monad itself
08:01 <jle`> it's about specific monad instances
08:01 tobill joined
08:01 <halogenandtoast> jle`: it can define it however it wants regardless of obeying the laws
08:01 <halogenandtoast> it's just bad then
08:01 <jle`> heh, yeah
08:01 <jle`> anohigisavay: so the behavior you are seeing when you do main = blah >> main doesn't have to do with the idea of monads at all
08:02 <jle`> anohigisavay: it has to do with how (>>) is defined/implemented for that instance, IO
08:02 <jle`> it's "unrelated to monads" in the sense that you're looking at a specific feature of a specific type, that can't be generalized to monads in general
08:03 <anohigisavay> jle`, many thanks man :D
08:03 govg joined
08:03 oish joined
08:03 <jle`> sort of like saying "it looks like all numbers are greater than zero. is being greater than zero a property of being a number?" when you only look at the number 7
08:03 <jle`> the number 7 is a nice number and all, but generalizing properties about 7 to properties about numbers in general is going to land you in trouble
08:04 <jle`> you might start thinking that all numbers are odd, too
08:04 ogrady joined
08:04 <jle`> and that being odd is an inherent property of being a number
08:04 splanch joined
08:05 <vach> hi all
08:05 <vach> where would you start learning haskel, if you dont really know Monads?
08:05 <vach> any links appreciated
08:06 splanch_ joined
08:07 <boxscape> @where book
08:07 <lambdabot> http://haskellbook.com/
08:07 vydd joined
08:07 <raduom> Haskell from first principles helped me get across the first hurdles.
08:07 <raduom> And that is the link ^^ :)
08:07 ventonegro joined
08:08 <boxscape> of course, there are free resources as well, though as far as I know none of them are as good as that book
08:09 Sampuka joined
08:09 cfricke joined
08:09 <boxscape> https://github.com/bitemyapp/learnhaskell
08:10 prkc joined
08:10 quchen joined
08:10 jujus joined
08:11 yinn joined
08:12 <raduom> jle` when you say tail recursion is not a thing in haskell, are you referring to the tail recursion modulo cons thing (or guarded recursion)?
08:13 tobill joined
08:13 <raduom> and since haskell is lazy you generally use right fold to make use of that?
08:14 eduardm joined
08:15 <ventonegro> I just wish they finished that book
08:15 fendor joined
08:15 raichoo joined
08:15 <magthe> boxscape: I'm mostly interested in the exercises in some of the chapters of that book... e.g. where can I find exercises geared towards solutions using/creating Monoid/Semigroup/... do you happen to have a good resource for that?
08:17 <boxscape> uh, I don't, sorry
08:21 albertid joined
08:21 coot joined
08:22 xtreak_ joined
08:23 tobill joined
08:24 wtetzner joined
08:25 qt joined
08:26 <halogenandtoast> vach: step 1) don't worry about learning monads
08:26 splanch joined
08:27 Miroboru joined
08:28 sgflt joined
08:29 <Cale> vach: The actual question should be the other way around: where would you start learning about monads if you don't know Haskell? The answer to that is to get a degree in mathematics and study category theory, but that's a really long route to take if your goal is to write programs.
08:29 <Cale> But you can learn about the monad abstraction as it applies to Haskell once you know a bit of Haskell and it's not a big deal.
08:29 <halogenandtoast> Cale: also most books on category theory (hyperbole since I've only tried reading one) are awful
08:29 <Cale> Which one did you try to read?
08:30 <boxscape> Bartosz Milewski's course on youtube was neat, although I haven't started watching the second course
08:30 <halogenandtoast> Oxford Logic Guides Category Theory by Steve Awodey
08:30 <Cale> Ah, that's too bad, I really liked that one :)
08:31 takle joined
08:31 <halogenandtoast> Cale: I think I'm missing a lot of the prerequesite courses
08:31 <Cale> I don't think I properly understood the Yoneda lemma before reading Awodey's treatment of it.
08:31 <halogenandtoast> And haven't "really done math" in 10 years.
08:31 fakenerd joined
08:31 _sg joined
08:31 ragepandemic joined
08:32 Beetny joined
08:32 CurryWurst_ joined
08:32 <halogenandtoast> Cale: it took me 20 minutes just to figure out what the subscript A was in a ≤A b
08:33 <halogenandtoast> Another 20 minutes to understand this: antisymmetry: if a ≤A b and b ≤A a,then a=b.
08:33 KarboniteKream joined
08:33 <halogenandtoast> although that's kind of obvious now.
08:34 <halogenandtoast> mainly the subscript A was throwing me off.
08:34 kshukla_ joined
08:35 bshelden joined
08:35 <halogenandtoast> Oh and Posets, that was fun to struggle through
08:35 <halogenandtoast> so mainly my fault I guess
08:36 qt joined
08:36 araujo joined
08:36 <Cale> Yeah, I suppose it tries to introduce those things if you didn't know them already, but it's really hard to be totally self-contained
08:36 <halogenandtoast> I guess I need a category theory for dummies book.
08:36 <Cale> Or just random other bits of mathematics
08:37 <halogenandtoast> Yeah
08:37 sanett joined
08:38 Jacoby6000_ joined
08:38 <halogenandtoast> I need someone to tell me that path
08:38 zeroed joined
08:38 <halogenandtoast> How do I go from calc/linear alg to category theory
08:38 fractalsea joined
08:39 <halogenandtoast> I'm assuming relational calculus probably helps?
08:39 <magthe> boxscape: my search continues then :)
08:39 <halogenandtoast> actually ignore what I just said
08:40 <cocreature> halogenandtoast: random bits of algebra, e.g. group theory, ring theory, … are helpful
08:40 <Cale> I would say you might want something on group theory and abstract algebra in general. Dummit and Foote is a good book
08:40 vydd joined
08:40 vydd joined
08:41 <Cale> and then, well, it depends on your interests -- the more areas of mathematics you get just a little bit of, the more you will appreciate what category theory can do as far as providing a sort of overarching organisational structure
08:41 <halogenandtoast> Cale: looks neat, I'll give it a go.
08:42 <Cale> But another area from which category theory specifically draws a lot of inspiration is algebraic topology
08:42 <halogenandtoast> to be honest, I should really focus on learning Japanese, but Haskell is just too interesting to me.
08:42 <Cale> (But you'll want to know some group theory at least before trying to learn any algebraic topology)
08:42 <cocreature> I think you can use japanese variable identifiers in haskell
08:42 hardfire joined
08:43 connrs joined
08:43 Jacoby6000_ joined
08:44 LazyUncleBob joined
08:44 <halogenandtoast> > let 猫 = "Neko" in 猫
08:44 raichoo joined
08:44 <lambdabot> "Neko"
08:44 sanett joined
08:44 <halogenandtoast> > let x + y = 4 in 5 + 10
08:44 <lambdabot> 4
08:45 <boxscape> that looks so confusing at first
08:46 <halogenandtoast> boxscape: it's confusing at second as well
08:46 <boxscape> I was thinking "is this something like n+k patterns?"
08:46 inad922 joined
08:47 <hardfire> hi, i'm super new to stack, and i'm trying to run `stack setup`. It fails with the following error `Updating package index Hackage (mirrored at https://s3.amazonaws.com/hackage.fpcomplete.com/) ...recv: resource vanished (Connection reset by peer)` - i couldn't find anything on how to solve this. --
08:47 fizruk joined
08:47 <hardfire> i'm basically trying to setup hledger
08:47 <hardfire> :D any help would be appreciated
08:47 <hardfire> or point to the right channel
08:48 <Cale> boxscape: Nope, just a local redefinition of (+)
08:48 <boxscape> yeah, I realized that after thinking about it for a bit :)
08:49 <Cale> hardfire: hmm
08:50 <hardfire> Cale: also s3 page says AccessDenied, not sure if that's how it should be
08:50 <Cale> hardfire: Where are you running that command from?
08:50 <Cale> I'll see if I can reproduce it
08:50 <hardfire> on the terminal? or do you mean physical location?
08:51 takle joined
08:51 <Cale> I mean, out of which directory
08:51 <hardfire> ah! just my home directory
08:51 <hardfire> i basically want to run ` stack install --resolver=nightly hledger hledger-ui hledger-web `
08:52 <hardfire> whcih also gives the same error, and somehow i ended up with `stack setup`
08:53 jluttine joined
08:54 <sm> hardfire: what's stack --version ?
08:54 <hardfire> sm - `Version 1.4.0, Git revision e714f1dd3fade19496d91bd6a017e435a96a6bcd (4640 commits) x86_64 hpack-0.17.`
08:57 mda1 joined
08:57 takle joined
08:58 raichoo joined
08:59 C-16 joined
08:59 ramzifu joined
09:01 fizruk joined
09:03 <halogenandtoast> Is there a reason ghci wouldn't be able to see modules installed with cabal. On my machine I can do `import System.Random` without a problem, but my coworker can not
09:04 <halogenandtoast> is there something I should be looking for to help him debug?
09:04 <sm> hardfire: that sounds good. I don't think "stack setup" is failing that way for other people right now. I'd guess it's either a transient networking failure or something firewalled
09:04 jhannah joined
09:05 <hardfire> okay. i had the same feeling as its happening since last night. but i'll try to see if it continues like this. Thanks sm.
09:05 <hardfire> what does the resource vanished error mean though?
09:06 <sm> connectivity trouble
09:08 gehmehgeh joined
09:08 insitu joined
09:09 marr joined
09:09 doodlehaus joined
09:09 certainty joined
09:11 <halogenandtoast> For my question I just had him run force-reinstall and it worked
09:11 <kylefang> hardfire: where are you located? Some gov might be "regulating" the internet, which replys reset when accessing foreign address
09:11 takle joined
09:11 <hardfire> i'm trying from Nepal
09:12 KarboniteKream joined
09:12 <kylefang> hardfire: try hop on some proxy and see if it works.
09:13 <kylefang> halogenandtoast: maybe you guys should start doing stack. :]
09:14 sanett joined
09:14 puregreen joined
09:16 augur joined
09:16 xaviergmail joined
09:18 takle joined
09:18 <sm> hardfire: it might be harder, but if there's no alternative try using https://www.haskell.org/cabal instead
09:18 mohsen_ joined
09:19 <drdo> I might be crazy, but didn't GHC use to warn you about incomplete matching?
09:19 <hardfire> ok, let me try cabal once
09:19 <cocreature> drdo: only with -Wall
09:19 <cocreature> or rather -fwarn-incomplete-patterns or something like that
09:19 <drdo> I see
09:20 <drdo> yep, that works, thanks
09:20 <boxscape> can someone explain this to me? It seems to me that 0.1.1 is inbetween 0.1 and 1 "diffarray must match >=0.1 && <1, but the stack configuration has no specified version (latest applicable is 0.1.1)"
09:20 datajerk joined
09:20 balor joined
09:21 <cocreature> boxscape: the package is not in the stackage snapshot but on hackage there is version 0.1.1
09:21 <boxscape> ah, ok
09:21 <cocreature> boxscape: you can solve this by adding it to extra-deps
09:21 <boxscape> alright
09:22 <boxscape> thanks
09:22 <cocreature> I should really make a PR to improve this error message
09:22 <cocreature> it’s really confusing
09:22 a3Dman joined
09:22 <boxscape> it is, but it does say that it's probably solvable by adding it to extra-deps
09:23 Kreest_ joined
09:23 unK_ joined
09:24 silentcontrib joined
09:25 tomphp joined
09:26 takle joined
09:27 acidjnk22 joined
09:32 cuqfye joined
09:35 kritzcreek_ joined
09:36 jbiesnecker joined
09:37 xtreak joined
09:37 Maxdaman1us joined
09:37 lithie joined
09:38 bakibour joined
09:38 <bakibour> Hi, does anyone use or know if i can use Haskelly in VSCode on Windows?
09:38 <sm> hardfire: cabal install going well I hope ?
09:39 ljc joined
09:41 bjz joined
09:41 gregman_ joined
09:41 <hardfire> sm: i think, installing cabal now first
09:42 luckymerlin joined
09:43 tom7942 joined
09:43 pylbrecht joined
09:43 <sm> ok. See also hledger/cabal-install.sh, good luck
09:43 <halogenandtoast> kylefang: we are using stack but sometimes you just want to jump into a random ghci instance to try things out
09:43 <halogenandtoast> kylefang: for example I was just showing him how easy it was to generate a random number
09:43 <hardfire> ok. thanks sm :D will shout if i get lost agian
09:45 sanett joined
09:46 Einwq joined
09:46 phaji joined
09:46 <Phyx-> trineroks: just put cmd in quick edit mode and you can just select text to copy
09:46 anohigisavay joined
09:46 fractalsea joined
09:47 <Phyx-> trineroks: or use a differnt terminal such as conemu.
09:49 theOtherAdam joined
09:50 cultofmetatron joined
09:51 oaao joined
09:53 reynir joined
09:53 takle joined
09:55 fractalsea joined
09:55 <Enzyme> Is there an easy way to take a seed value and create a geometric/arithmetic series out of it?
09:56 mmn80 joined
09:56 thing_ joined
09:57 <JuanDaugherty> evaluate a simple closed form for same and accumulate the result?
09:57 <JuanDaugherty> possible contest for least number of lines
09:57 skapazzo joined
09:57 <JuanDaugherty> 1 is possible
10:00 uglyfigurine joined
10:01 zeroed joined
10:02 dougger joined
10:02 whaletechno joined
10:02 makalu joined
10:03 <makalu> if I use my own snapshot with stack, it complains that packages such as directory are missing. Why doesn't stack take them from the GHC global database?
10:03 <makalu> why does a snapshot need to include the packages that come with GHC?
10:03 hardfire joined
10:05 <ventonegro> the whole point of stack is to use a self-contained set of packages
10:08 contiver joined
10:09 sanett joined
10:10 <makalu> I could live with that but when building happy for example, stack links it to both the global and snapshot unix package
10:10 <makalu> which will give a linker error of course
10:14 sanett_ joined
10:14 luckymerlin joined
10:14 zcourts joined
10:15 trolling joined
10:16 zcourts__ joined
10:16 JagaJaga joined
10:18 fendor joined
10:19 dan_f joined
10:20 ub joined
10:20 Gloomy joined
10:22 Jacoby6000_ joined
10:22 balor joined
10:26 certainty joined
10:26 sanett joined
10:27 <ocharles> What am I meant to do if I need to parser a 32-bit little endian integer with attoparsec?
10:28 shafox joined
10:29 oish joined
10:31 <ocharles> Hrm, maybe I should be using binary actually
10:31 <halogenandtoast> What is the `?` on this like doing? https://github.com/audreyt/regex-genex/blob/master/src/Regex/Genex.hs#L33
10:32 locallycompact joined
10:32 zcourts joined
10:32 louispan joined
10:33 aib joined
10:33 xtreak joined
10:33 <brynedwards> halogenandtoast: https://wiki.haskell.org/Implicit_parameters
10:33 biglama joined
10:33 Jacoby6000_ joined
10:34 lukaramu joined
10:34 certainty joined
10:34 mattyw_ joined
10:36 insitu joined
10:36 raducu427 joined
10:37 <raducu427> @hoogle [a] -> [a]
10:37 <lambdabot> Prelude tail :: [a] -> [a]
10:37 <lambdabot> Prelude init :: [a] -> [a]
10:37 <lambdabot> Prelude reverse :: [a] -> [a]
10:38 <ventonegro> @hoogle Either a c -> Either b c
10:38 <lambdabot> Data.Either.Combinators swapEither :: Either e a -> Either a e
10:38 <lambdabot> Data.EitherR flipEither :: Either a b -> Either b a
10:38 <lambdabot> Puppet.Utils strictifyEither :: Either a b -> Either a b
10:38 <halogenandtoast> brynedwards: Hmm seems like you could just pass in the dynamic value instead
10:38 <halogenandtoast> not sure what would prompt me to use that
10:38 <halogenandtoast> thanks for pointing me in the right direction
10:38 <halogenandtoast> it makes sense now what is happening there
10:39 danthemyth joined
10:40 <raducu427> @pl \f x -> f x x
10:40 <lambdabot> join
10:40 sphinxo joined
10:42 yinn joined
10:43 petermw joined
10:44 tom7942 joined
10:44 <raducu427> @pl \l -> (`runCont` id) $ callCC (\k -> loop k l) where loop _ [] = return 1 loop k (0:_) = k 0 loop k (x:xs) = do return 1 * x
10:44 <lambdabot> (line 1, column 97):
10:44 <lambdabot> unexpected '_'
10:44 <lambdabot> expecting variable, "(", operator, "$", "$!", "`seq`" or end of input
10:44 eduardm joined
10:45 bjz_ joined
10:45 <geekosaur> @pl only works on expressions
10:45 <lambdabot> only works on expressions
10:45 <lep-delete> lal
10:45 rcat joined
10:47 <geekosaur> well, the point is a where clause and accompanying bindings will not be handled
10:47 splanch joined
10:49 arianvp2 joined
10:49 <arianvp2> Why are Product and Compose in base twice?
10:49 <arianvp2> under GHC.Generics as (:*:) and (:.:)
10:49 <arianvp2> and under Data.Functor.{Product,Compose}
10:49 benl23 joined
10:50 <hardfire> sm: i have the feeling cabal is doing its job :D had to install some packages manually, but works
10:52 gawen joined
10:53 prophile joined
10:54 jaspervdj joined
10:54 skapazzo joined
10:54 insitu joined
10:55 plugin joined
10:55 oisdk joined
10:59 Jacoby6000_ joined
11:02 <halogenandtoast> Does `.:` have any kind of name
11:02 <halogenandtoast> f .: g = \x y -> f (g x y)
11:03 ramzifu joined
11:03 Nik05 joined
11:04 <halogenandtoast> Heading out, I'll check logs later
11:05 zeroed joined
11:06 <srhb> halogenandtoast: No, it doesn't. It's just slightly different composition, after all.
11:07 benl23 joined
11:07 <lyxia> arianvp2: they were developped independently, in GHC.Generics and in transformers.
11:07 <lyxia> it's possible they will get merged one day.
11:09 papermachine joined
11:10 avn joined
11:10 ahri joined
11:13 netheranthem joined
11:15 ompaul joined
11:15 kshukla_ joined
11:18 danza joined
11:23 Gurkenglas_ joined
11:25 benl23 joined
11:25 hardfire left
11:26 _sg joined
11:26 Rainb joined
11:26 sdothum joined
11:31 acarrico joined
11:32 Gloomy joined
11:33 papermachine joined
11:33 fizruk joined
11:33 sanett joined
11:34 bjz joined
11:36 carlomagno1 joined
11:36 <boxscape> It took me way too long to figure out that I wrote [0,maxX] instead of [0..maxX] -.-
11:37 <boxscape> maybe I should use dependent types to make sure my lists have the right lengths
11:37 silver joined
11:37 ramzifu joined
11:38 cfricke joined
11:39 JeanCarloMachado joined
11:41 insitu joined
11:41 twanvl joined
11:42 Fairy joined
11:44 sanett joined
11:44 tom7942 joined
11:45 eacameron joined
11:46 jbiesnecker joined
11:47 ebzzry joined
11:48 crobbins joined
11:49 plugin joined
11:52 asthasr joined
11:54 CRM114 joined
11:55 stryx joined
11:56 eacameron joined
11:58 eacameron joined
11:59 detrumi joined
11:59 HoierM joined
12:00 sphinxo joined
12:02 yinn joined
12:04 zaquest joined
12:05 Hafydd joined
12:05 Hafydd joined
12:08 eacameron joined
12:08 xaviergmail joined
12:08 systadmin joined
12:10 fractalsea joined
12:13 CurryWurst_ joined
12:14 eacameron joined
12:19 moongazer joined
12:19 mson joined
12:20 fractalsea joined
12:21 araujo joined
12:21 araujo joined
12:21 sanett joined
12:22 zeroed joined
12:22 c137 joined
12:22 yinn joined
12:24 acarrico joined
12:28 insitu joined
12:29 asmyers joined
12:29 <barrucadu> Anyone familiar with the 'bound' library? I'm trying to convert some code which currently uses stringy variable names to use bound/Scope as I'm now needing more complex functionality. But the problem is that my AST type is expicitly typed, only well-typed terms can be constructed, and I don't see how I can really make that work with bound, as I can't make my type a monad without giving that up.
12:31 cultofmetatron joined
12:32 lep_ joined
12:32 kubunto joined
12:32 <kubunto> what is eta conversion exactly?
12:33 rioch joined
12:33 <ahri> i have a type GameInProgress that holds my game board, players, etc. and i'm considering how to refactor to model the end of a game. my problem is that if i model it as "GameState = GameInProgress (...stuff...) | GameWon Player | GameDrawn" then i'll have to go around changing all my existing functions on GameInProgress to now deal with the rest of the union type that they don't care about. should i instead
12:33 oisdk joined
12:33 <ahri> do something like "GameState = Won | Drawn | InProgress GameInProgress" to avoid that hassle?
12:35 <codedmart> lyxia: OK have any time to help me? If not no bug deal.
12:35 Jacoby6000_ joined
12:35 <Athas> ahri: yes, that is the usual way to do it.
12:35 <rioch> I have a function `myfunc :: Ord a => [a] -> [a]`. When I call with `myfunc []` it fails to build with "Ambiguous type variable a0 from use of `myfunc` prevents the constraint (Ord a0) from being solved". Isn't [] in Ord?
12:35 nomicflux joined
12:35 <ahri> Athas: ok, i wasn't sure if i was trading something off that i shouldn't
12:36 <liste> rioch: there's a Ord a => [a] instance
12:36 <Athas> ahri: the only "cost" is an additional pointer, but don't worry about that. This is very idiomatic.
12:36 <cocreature> rioch: the problem is that to know what ord constraint to use it needs to know what kind of list this is
12:36 <cocreature> but [] contains no elements that help inferring that
12:37 e14 joined
12:37 zeroed joined
12:37 ramzifu joined
12:38 <rioch> cocreature: The function when given `[]` will return `[]`, so it doesn't matter.
12:38 <cocreature> rioch: that doesn’t matter. GHC still needs to know which "Ord a" it should chose.
12:39 <rioch> cocreature: How do I add a type annotation to an empty list?
12:39 <cocreature> rioch: ([] :: [Int])
12:39 <cocreature> or whatever type you want to give it
12:39 <rioch> Thanks
12:41 dmwit_ joined
12:41 jomg joined
12:41 <kubunto> what is the difference between where and let?
12:43 pi_____ joined
12:43 <lyxia> cocreature: I'm available
12:43 <lyxia> codedmart: ^ oops
12:44 <cocreature> lyxia: great, can you bring me a coffee please?
12:44 gawen joined
12:45 oisdk joined
12:45 tom7942 joined
12:46 zero_byte joined
12:46 fractalsea joined
12:46 shayan_ joined
12:47 <liste> kubunto: let .. in .. is an expression, where is bound to a pattern binding
12:47 <kubunto> liste: is pattern binding part of functions?
12:48 <kubunto> nvm
12:49 cdg joined
12:50 eduardm joined
12:51 <codedmart> lyxia: I am sort of grasping the code you gisted (I think), but when I read more about generics it isn't all sticking yet. And when I read other examples they seem so different. Also if I `:kind! (Rep User)` I see nothing about M1 or K1.
12:51 <ahri> i have another style question; i needed to control randomness to be able to test my game, so when creating the GameState i end up passing in a System.Random.StdGen and a function of type "StdGen -> (StdGen, Cell)" where a random Cell is generated for my board per the game rules. this means that each time i tick the game, generating a new GameState i need to pass along the StdGen and the function - it ends
12:51 <ahri> up looking like the function might change in the "tick" code, but in fact it's only like this to support testing. is there a nicer approach i could take? the code is on github if i'm not being clear enough
12:52 certainty joined
12:52 <ahri> the approach i took is indicative of my OOP background, inverting the dependency on particular logic so that i can control it from a test
12:53 ublubu joined
12:53 cyborg-one joined
12:53 cpennington joined
12:54 ramzifu joined
12:54 <lyxia> codedmart: M1 is hidden in D1/C1/S1, these three are type synonyms for M1 D/M1 C/M1 S.
12:54 <ahri> adding the StdGen to my GameState had the irritating side-effect that i could no longer derive Eq or Show instances, too :(
12:55 cdg joined
12:55 <codedmart> Ah ok I see that here: https://hackage.haskell.org/package/base-
12:55 mattyw joined
12:55 <lyxia> codedmart: K1 is hidden in Rec0 = K1 R
12:56 <codedmart> Did you name these to try and represent what they are `unpack strict lazy`?
12:56 <lyxia> codedmart: sometimes you don't care about the metadata, so you just implement an instance for M1 i c f, sometimes you do, and you have an instance for M1 S ('MetaSel ...) f or whatever
12:56 <Athas> ahri: you can always write your own Eq or Show instances. Logically, the RNG state is part of the "game state", isn't it?
12:57 mohsen_ joined
12:57 <Athas> (Although maybe that's a philosophical question!)
12:57 <codedmart> So `'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy`
12:57 Boomerang joined
12:57 <lyxia> codedmart: I just picked names that came to my mind from looking at the initial example in the docs
12:58 <Athas> ahri: instead of using an explicit StdGen, you can parameterise your functions over the RNG type via the class RandomGen (of which StdGen has an instance).
12:58 <Athas> Then, in your tests, you can pass in some other RNG.
12:58 <Athas> That basically turns a functional argument into parametric polymorphism.
12:59 <lyxia> codedmart: There are probably much better names, they corresponds to fields of MetaSel http://hackage.haskell.org/package/base-
13:03 <codedmart> lyxia: OK so this is helping me understand what you wrote better, but I still am not sure how to recursivly get fields with/from K1.
13:03 sanett joined
13:04 sea_wulf joined
13:04 <ahri> Athas: thanks, i'll have a play with that!
13:05 <codedmart> lyxia: If you know I would rather you didn't just post full code, but maybe give me a type or a hint. I would really like to try and grasp this. I appreciate your help.
13:05 <lyxia> Sure
13:05 mada joined
13:06 <Athas> ahri: although random numbers definitely aren't one of the most shiny parts of purely functional programming...
13:06 fakenerd joined
13:06 Gloomy joined
13:09 acidjnk22 joined
13:11 danharaj joined
13:11 dawehner joined
13:11 sanett joined
13:13 Tesseraction_o joined
13:14 sepp2k joined
13:15 featherlessbiped joined
13:16 <lyxia> codedmart: you want to get the field names of a in (K1 i a), then note that you have a function that does precisely that.
13:16 descender joined
13:16 crobbins joined
13:17 ebzzry joined
13:17 <codedmart> lyxia: you mean write a GFN instance for K1 that does that?
13:17 diag_ joined
13:18 <lyxia> Yeah
13:19 fractalsea joined
13:19 ChristopherBurg joined
13:19 Kreest joined
13:19 dec0n_ joined
13:23 cpape joined
13:28 jbiesnecker joined
13:29 <codedmart> Hmm... still lost, but still reading.
13:31 moongazer joined
13:32 doodlehaus joined
13:32 fractalsea joined
13:33 sanett joined
13:33 zaquest joined
13:35 lukaramu_ joined
13:35 eschnett joined
13:37 <codedmart> lyxia: is K1 -> `K1 R (Maybe c)`? Still trying to understand M1, K1, etc.
13:37 cfricke joined
13:38 <codedmart> I still don't fully understand Proxy either which I assume isn't helping.
13:38 xmonader2 joined
13:39 xmonader2 joined
13:39 <lyxia> Proxy is like (), K1 is like Identity.
13:40 <lyxia> K1 i a p is a newtype around a
13:41 mattyw joined
13:42 e14 joined
13:43 pi_____ joined
13:43 <codedmart> lyxia: This doesn't seem right to me `instance GFN (K1 i c) where; gfn = gfn;`, but so far is the only thing that does not give me errors.
13:44 <lyxia> indeed it's not right
13:45 mizu_no_oto_work joined
13:45 halogenandtoast joined
13:45 <lyxia> you need to call another function to look in the type c.
13:47 oish_ joined
13:48 sanett joined
13:49 cdg joined
13:50 prkc_ joined
13:50 certainty joined
13:50 tomphp joined
13:51 zar joined
13:52 uv4smt_ joined
13:52 <* shapr> thunks cheerfully
13:52 Unhammer joined
13:52 <uv4smt_> hey gus
13:52 dawehner joined
13:52 <uv4smt_> guys
13:52 <* lyxia> evaluates shapr.
13:52 <lyxia> No more leaks.
13:52 eacameron joined
13:52 <uv4smt_> does anyone have idea how the clean master works?
13:53 <uv4smt_> anyone?
13:53 <shapr> what's a clean master?
13:53 <uv4smt_> its an android app for locking another app
13:53 <kubunto> jw what is variable naming convention
13:53 <shapr> lyxia: well, my head is weak, and that's my normal form.
13:53 <shapr> uv4smt_: is your android app written in Haskell? I'm confused.
13:54 <uv4smt_> haskell! is it a language>
13:54 <uv4smt_> ?
13:54 <kubunto> uv4smt_: yes
13:54 freechips joined
13:54 <uv4smt_> no , it is written in java
13:55 <uv4smt_> i want to know its concept only?
13:55 <geekosaur> "if you can't tell from context and /topic that this isn;t the hacker hangout, you have no business trying to be a hacker"
13:57 <codedmart> lyxia: I have no idea. I feel like it has something to do with https://hackage.haskell.org/package/base-, but I am really have no idea what is going on. I seem to always overcomplicate things when trying to learn them.
13:57 rafael joined
13:57 Guest16174 joined
13:58 prkc joined
13:58 {emptyset} joined
13:58 mmachenry joined
13:58 <Guest27170> Hi
13:58 ystael joined
13:58 <uv4smt_> hii
13:58 <uv4smt_> guest
13:59 mattyw joined
13:59 Unhammer joined
13:59 <ski> hello rafael^WGuest27170
13:59 <Guest27170> urrr, learning to use irc, I'm dumb
13:59 nycs joined
14:00 <ski> nah, you're just a newbie
14:00 fendor joined
14:00 <ski> (that doesn't make someone dumb)
14:01 <Guest27170> @help
14:01 <lambdabot> help <command>. Ask for help for <command>. Try 'list' for all commands
14:01 ZesenQian[m] joined
14:01 <lyxia> codedmart: When working with Generics, you usually have two functions, here gfn, which works on the generic representation of a type (Rep a), and fieldNames, which works on the original types (a).
14:01 <ski> Guest27170 : did you have a question about Haskell ?
14:02 <lyxia> codedmart: and the instance for K1 usually calls the non-generic version
14:02 <ZesenQian[m]> Hi! I wrote an untyped lambda calculus interpreter, and hope to port Haskell to it.
14:03 <ski> ZesenQian[m] : .. good luck
14:03 <ZesenQian[m]> Will it be a lot of work compiling GHC core to untyped LC?
14:03 <ski> yes
14:03 <Guest27170> @ski , I have a question about Haskell's Type System, I will ask after learning to use irc
14:03 <lambdabot> Maybe you meant: wiki src ask
14:03 dsh joined
14:03 <ZesenQian[m]> OK, how about idris? that seems newer and less historical stuff.
14:03 <ZesenQian[m]> ski: ^
14:03 marcopullo joined
14:03 <ski> Guest27170 : well, it's not IRC custom to prefix nicknames with a `@', when addressing someone ..
14:03 <ski> ZesenQian[m] : i don't know about idris, ask in #idris ?
14:04 <ZesenQian[m]> ski: yeah sure. Thank you!
14:04 <Guest27170> ski: just noticed that
14:04 <ski> (also, lambdabot gets confused)
14:05 chlong joined
14:05 <ski> otherwise, you seem to be IRCing just fine ! :)
14:05 <codedmart> lyxia: but fieldNames gives an error about ambigous type. Not sure how to annotate it?
14:06 <lyxia> codedmart: with TypeApplications+ScopedTypeVariables. fieldNames @c
14:06 <Guest27170> ski: I'm learning how to set my nick name, create password (if there is some thing like that) etc
14:06 <shapr> I heard slack invented IRC
14:06 <kubunto> shapr: really?
14:06 <ski> Guest27170 : try `/nick myNickName'. also try `/msg NickServ help register'
14:06 <lyxia> codedmart: you could also change fieldNames to take a Proxy argument to make the type less ambiguous, but you would still have to annotate Proxy with its type at the call site
14:06 <shapr> kubunto: no, that's sarcastic
14:06 <lyxia> codedmart: you will need to add constraints to the instance BTW
14:06 <codedmart> Ugh I was trying `fieldNames (Proxy @c)`
14:07 <kubunto> shapr: glad to hear that :P
14:07 <shapr> kubunto: I started using IRC in 1988 or 1989
14:07 <kubunto> shapr: you are old :P
14:07 <rafael_cgs> now I'm rafael_cgs
14:07 <shapr> kubunto: yes, but I probably do better cartwheels than you do :-P
14:07 sanett joined
14:07 <* ski> has spoken to people aged around 70, on IRC
14:07 <shapr> and more mountain unicycling
14:08 <lyxia> codedmart: that would work if fieldNames had type (... => Proxy a -> ...)
14:08 <rafael_cgs> help register
14:08 gawen joined
14:08 <kubunto> shapr: thats nice
14:08 <ski> rafael_cgs : yeah, like that :)
14:08 <kubunto> (meant as compliment)
14:08 <shapr> kubunto: yeah, there's so much cool stuff in the world, I don't yet understand why people get mentally old. But maybe it'll happen to me too
14:09 <ski> rafael_cgs : as you noticed, if you change your nick to one that's registered, and you don't identify with the correct password within a set time, often this IRC network will automatically change your nickname to something like `Guest27170'
14:09 cultofmetatron joined
14:09 theelous3 joined
14:09 _sg joined
14:09 Rizy joined
14:09 <ski> rafael_cgs : sorry, you should `/msg NickServ' that other command
14:10 <codedmart> lyxia: OK so now I am at `instance Generic c => FieldNames (K1 i c) where; gfn _ = fieldNames @c;` but still getting an error `Could not deduce (FieldNames (Rep c)); arising from a use of ‘fieldNames’;`
14:10 <rafael_cgs> ski: thank you :)
14:10 <codedmart> Sorry I change GFN to FieldNames
14:10 QRealm joined
14:10 <lyxia> sure
14:11 vishalIRC joined
14:11 <vishalIRC> Hi!
14:12 <shapr> greetings vishalIRC! How's code for you?
14:12 <lyxia> codedmart: add that missing constraint to the instance
14:12 <vishalIRC> It’s beautiful
14:12 <codedmart> lyxia: duh, trying now.
14:12 <vishalIRC> in C++ that is :p
14:13 chlong joined
14:13 fractalsea joined
14:14 <codedmart> lyxia: ok that is passing now.
14:14 <rafael_cgs> anyone ever readed Phillip Wadler's paper called "How to make adhoc polymorphism less adhoc" ?
14:14 sanett joined
14:15 cfricke joined
14:16 PennyNeko joined
14:17 eduardm joined
14:18 sphinxo joined
14:19 jbiesnecker joined
14:19 jship joined
14:20 Jacoby6000_ joined
14:20 jdelreal joined
14:20 plutoniix joined
14:21 AndreasK joined
14:21 tomphp joined
14:22 <dolio> rafael_cgs: I've read it, a long time ago.
14:22 plutoniix joined
14:23 dfeuer joined
14:23 plutoniix joined
14:25 plutoniix joined
14:25 <codedmart> lyxia: ok so if I do this `instance (KnownSymbol n, Generic c, FieldNames (Rep c)) => FieldNames (M1 S ('MetaSel ('Just n) u s l) (K1 i c)) where`. That errors because Text does not have a generic instance.
14:25 sanett joined
14:26 <lyxia> indeed
14:27 npc24 joined
14:28 <npc24> Hello
14:28 <lyxia> codedmart: When you have a recursive generic implementation like this, where fieldNames calls gfn which calls fieldNames again, you can turn fieldNames into a type class, so that you can specialize its behavior for Text and other non-generic types.
14:28 tomphp joined
14:29 <codedmart> lyxia: OK so I was on the right path? I will move into that next.
14:29 <lyxia> yeah
14:29 kubunto left
14:29 <lyxia> uh...
14:29 rekahsoft joined
14:30 <lyxia> I would have split that instance in two
14:30 <codedmart> Sorry what do you mean?
14:30 oneeman joined
14:31 dylukes joined
14:31 sellout- joined
14:31 <lyxia> instance (KnownSymbol n, FieldNames f) => FieldNames (M1 S ... f) where and instance (Generic c, FieldNames (Rep c)) => FieldNames (K1 i c) where
14:32 <lyxia> it's more modular though the result is the same.
14:33 fractalsea joined
14:33 roconnor joined
14:35 <codedmart> Oh I did this: https://gist.github.com/codedmart/e0142e25a2b53c3dc1e20a30ce92056b
14:35 augur joined
14:36 sanett joined
14:37 sanett left
14:37 Elish joined
14:38 kody joined
14:38 <lyxia> the first instance does things that the second one does already
14:38 Gloomy joined
14:38 <lyxia> this duplicates the Generic c, FieldNames (Rep c) constraint
14:39 e14 joined
14:39 fractalsea joined
14:39 HarveyPwca joined
14:40 cdg_ joined
14:41 coltfred joined
14:41 <codedmart> lyxia: But don't I need to fieldNames on f?
14:41 _sras_ joined
14:41 splanch joined
14:42 umib0zu joined
14:42 ortmage joined
14:42 yellowj joined
14:42 <lyxia> you can call gfn, which will then call fieldNames through the second instance.
14:43 etehtsea joined
14:43 KamaKama joined
14:44 bodisiw joined
14:44 oisdk joined
14:45 <codedmart> lyxia: call gfn on @f? Sorry this is painful. I am still not getting :|.
14:45 <codedmart> Oh wait
14:45 <lyxia> something like that
14:46 <codedmart> I see
14:47 fractalsea joined
14:47 <codedmart> I got it. Let me see if I can figure out the typeclass and fieldNames
14:49 mson joined
14:52 sdothum joined
14:52 tomphp joined
14:53 joneshf-laptop joined
14:58 splanch joined
14:58 sz0 joined
14:59 doodlehaus joined
15:00 al-damiri joined
15:00 simukis__ joined
15:01 <codedmart> lyxia: It doesn't seem as easy as this at first try right: https://gist.github.com/codedmart/e0142e25a2b53c3dc1e20a30ce92056b#file-main-hs-L4-L5
15:02 eazar001 joined
15:03 <lyxia> using a Proxy might be a bit easier at first
15:03 marcopullo joined
15:03 <lyxia> I wasn't even consistent since gfn has Proxy argument too
15:03 <lyxia> codedmart: and the type class will not have the Generic constraint
15:04 snowalpaca joined
15:04 <lyxia> so, fieldNames :: Proxy a -> [Text]
15:05 baweaver joined
15:07 <codedmart> This is making me realize I know nothing about this side of haskell. I though I knew typeclasses well enough.
15:07 tom7942 joined
15:08 vishalIRC joined
15:11 dawehner joined
15:11 <lyxia> keep the original fieldNames as a separate function which will be used to implement this method for generic types
15:11 mmhat joined
15:11 uglyfigurine joined
15:12 descender joined
15:16 Vibor joined
15:17 aarvar joined
15:18 doodleha_ joined
15:18 <fendor> i'm tryign to install intero, but it fails with the message, to install terminfo
15:19 <fendor> but terminfo should be installed
15:19 <fendor> terminfo-
15:20 Guest21 joined
15:20 <fendor> stack install intero does nothing, and cabal claims it is already installed. On forced reinstallation, nothing changed
15:20 skeet70 joined
15:20 <brynedwards> fendor: It probably means the C library, libtinfo, not the haskell bindings
15:21 <fendor> oh ok
15:21 <fendor> brynedwards, libtinfo.so.5 is linked against libncurses.so.5.9
15:21 vishalIRC joined
15:22 <codedmart> lyxia: I have no idea how to write this typeclass right now. I am getting errors no matter what I try.
15:22 <brynedwards> fendor: It might be looking for libtinfo.so, see https://github.com/commercialhaskell/intero/issues/372#issuecomment-284029395
15:22 JagaJaga joined
15:23 <codedmart> Trying something else.
15:24 <geekosaur> urgh
15:24 <geekosaur> so they dlopen libtinfo.so unversioned?
15:24 <geekosaur> glad they're so certain it will never, ever be incompatible
15:24 urodna joined
15:25 netheranthem joined
15:25 <brynedwards> :(
15:26 <codedmart> lyxia: I might be onto something.
15:26 oisdk joined
15:27 marsam joined
15:28 muesli4_ joined
15:28 Frans-Willem joined
15:30 <codedmart> lyxia: Yup nevermind I am not sure. The route I was just going required my to do `ToFieldNames Maybe ...` instances.
15:31 <fendor> brynedwards, thanks, this resolved the issue
15:31 <brynedwards> :)
15:31 xaviergmail joined
15:32 <codedmart> Oh wait
15:33 jbalint joined
15:33 cpup joined
15:33 jbalint joined
15:33 sellout- joined
15:34 chlong joined
15:35 jbiesnecker joined
15:36 serendependy joined
15:38 <lyxia> codedmart: are you trying to write a class or instance declaration now?
15:38 b4ff3r joined
15:39 tom7942 joined
15:39 guampa joined
15:39 locallycompact joined
15:40 wtw_ joined
15:40 mmachenry joined
15:42 alios joined
15:42 besenwesen joined
15:42 <codedmart> lyxia: This is where I am at, but just hit another issue. Am I on the right path: https://gist.github.com/codedmart/e0142e25a2b53c3dc1e20a30ce92056b
15:42 wraithm joined
15:43 mk-fg joined
15:43 mk-fg joined
15:43 e14 joined
15:43 mizu_no_oto_work joined
15:44 <lyxia> yeah
15:44 LegionXII joined
15:44 vishalIRC left
15:45 jbiesnecker joined
15:45 <lyxia> codedmart: you don't need to write lines 25 and 28 because they are provided by the generic implementation
15:46 x1ddos joined
15:47 sssilver joined
15:48 <codedmart> Hmm... I get an error if I remove those lines.
15:48 mattyw_ joined
15:49 yellowj joined
15:49 <lyxia> ah I see, that's because you don't have an instance for sum types
15:50 <codedmart> lyxia: also don't I need a `instance ToFieldNames a`? If I use the generic one it ends up in a loop.
15:50 <lyxia> It seems best to leave these lines then
15:50 <codedmart> I can try an instance for sum types later.
15:50 <lyxia> Oh yes you are right about that
15:51 <codedmart> How would I go about that?
15:52 mmn80 joined
15:53 hackebeilchen joined
15:53 coot joined
15:53 <shapr> silly question, how do I write a megaparsec parser that will pick up alphaNum and @ and . but not comma?
15:54 <codedmart> lyxia: Any ideas how / when to terminate it?
15:54 alios joined
15:54 <glguy> shapr: alphaNum <|> oneOf "@."
15:54 <lyxia> codedmart: if you have a recursive type you will have to write the instance manually.
15:54 <shapr> glguy: thanks!
15:55 <lyxia> codedmart: or maybe you can keep a queue of types at runtime
15:56 jmelesky joined
15:56 LegionXII left
15:57 <Vibor> Hi, how do I import a module located in parent directory? say foo.hs is located in /P , bar.hs is in /P/C , how do I import foo in bar ?
15:58 <geekosaur> you shoulld have the source directory as /P, then Bar.hs is module C.Bar and can import Foo
15:58 jbiesnecker joined
15:58 marsam joined
15:58 balor joined
15:59 certainty joined
15:59 eduardm joined
16:01 dawehner joined
16:01 <codedmart> lyxia: ok but how would I add the parent model to the text? Ie in my example ["firstName", "address.street", "address.state"]?
16:02 jbiesnecker_ joined
16:02 jrajav joined
16:02 dan_f joined
16:02 <Vibor> geekosaur: Just made a test, thanks a lot:)
16:04 npc24 joined
16:04 jbiesnecker joined
16:04 marcopullo joined
16:04 ubsan joined
16:05 tlaxkit joined
16:06 oisdk joined
16:06 npc24 joined
16:06 wraithm joined
16:07 uve joined
16:07 <uve> Hey
16:08 <uve> 8
16:08 <shapr> yeah?
16:08 <shapr> hi uve
16:08 stef204 joined
16:09 jbiesnecker joined
16:09 snowalpaca joined
16:10 Gloomy joined
16:10 <uve> Hii shapr
16:11 dawehner joined
16:11 <shapr> uve: how's code?
16:12 <uve> Code?
16:12 <hydraz> Presumably, Visual Studio Code.
16:13 vidr joined
16:13 <hydraz> or your code :p
16:13 <danza> right ... i won't presume visual studio to be in front of any code :D
16:13 <uve> Visual studio code:-)
16:13 <danza> :(
16:13 <uve> R8
16:13 <hydraz> I use neovim
16:13 <uve> I agree
16:14 <hydraz> VS Code is about 100% heavier than an editor needs be
16:14 <hydraz> I keep trying to use Emacs but I can't.
16:14 jathan joined
16:14 <uve> Xamarin is interesting too
16:15 dawehner_ joined
16:15 <hydraz> you mean monodevelop? you can write Haskell in that?
16:15 <uve> Anybody android developer?
16:15 <uve> Or xamarin
16:15 trism joined
16:15 <glguy> uve: Did you have a Haskell question about Android?
16:16 <uve> No 💡 about haskell
16:17 Sonolin joined
16:17 <hydraz> well, you're in the Haskell channel.
16:18 mk-fg joined
16:18 mk-fg joined
16:18 <uve> ☺oops wrong channel
16:18 <boxscape> uve: now that you're here, you may as well learn haskell
16:18 lithie joined
16:19 XaNterous joined
16:20 <uve> Any application example written in haskell!!
16:20 Yuras joined
16:21 mmachenry joined
16:22 ubsan_ joined
16:23 <glguy> uve: You can start here: https://wiki.haskell.org/Haskell_in_practice
16:23 <ysangkok> i get an ambiguous type variable error on calling a function with an inferred type signature. the proposed fix is to add a type annotation, but how can i do it when i don't know the type?
16:24 <glguy> ysangkok: You can look at the types of things in GHCi and in the documentation
16:24 <XaNterous> hello everyone, i have a recursion question. I am trying to do this. [2,4,6,8,12] is my list and i am trying to check all elements have 2 difference. 2 - 4 is okey 4 - 6 is okey etc.. i tried this but having lots of errors.
16:25 <glguy> XaNterous: You can put your code on http://lpaste.net and ask questions about what you don't understand
16:25 <XaNterous> ~https://paste.kde.org/ppffn46hw
16:25 <XaNterous> https://paste.kde.org/ppffn46hw sorry for ~ in front
16:26 balor joined
16:26 <glguy> XaNterous: On line 6 you're trying to return the list 'htail' as the final result
16:26 osa1 joined
16:26 <glguy> So you're getting this message "Couldn't match expected type ‘[a]’ with actual type ‘a’"
16:27 <glguy> 'fx' is defined to return a value having type 'a', but you're returning a value with type '[a]'
16:27 <glguy> You'll need to make a recursive call to fx at this point to check the rest of that list
16:28 <glguy> Additionally you're trying to compare the values in your list to a number (2)
16:28 <glguy> Your type signature for fx :: (Ord a) => [a] -> a; doesn't say anything about 'a' being a number
16:29 <XaNterous> for your comment 'fx' is defined to return a value having type 'a', but you're returning a value with type '[a]' , i defined htail isnt it head of tail ?
16:29 <lyxia> codedmart: the place where you know you may have nested fields is in the instance FieldName (M1 S (...) f)
16:29 Jacoby6000_ joined
16:30 <lyxia> codedmart: you can add the current field name to each sub-field you get with gfn.
16:30 <glguy> XaNterous: Oh, yes I guess it is
16:30 <boxscape> The problem seems to be where the function is called
16:30 <boxscape> In the expression: x : fx xs
16:30 <glguy> XaNterous: I misread. The problem is just that you're trying ot compare your list elements to numbers, but they might not be numbers
16:30 <boxscape> you're treating fx xs as a list
16:31 <glguy> XaNterous: You can update the type signature: (Num a, Ord a) => [a] -> a
16:31 <glguy> That will compile (it just won't do what you described originally)
16:31 <boxscape> wait no
16:31 JeanCarloMachado joined
16:31 <boxscape> the error message is different from the code, isn't it?
16:31 eduardm joined
16:31 sleffy joined
16:31 <glguy> boxscape: yeah, it is
16:32 <glguy> the error message was for the version of code having "| htail + (- x) == 2 = x : fx xs"
16:32 <boxscape> oh, it was reloaded after that again
16:32 <boxscape> ok, got it
16:32 <XaNterous> these error messages so complicated
16:32 <boxscape> you get used to them, XaNterous
16:32 <glguy> They assume you know Haskell
16:32 <XaNterous> :D
16:32 <XaNterous> i wish
16:33 <XaNterous> at least it compiled like you told
16:34 <XaNterous> is this doable with recursion ? :D
16:34 <glguy> sure
16:34 <boxscape> anything that's computable is doable with recursion :P
16:34 <XaNterous> wow cool :D
16:34 yinn joined
16:35 <XaNterous> the part "| htail + (-x) == 2" if this happens how could i tell it go on ? :D
16:36 tag joined
16:36 <XaNterous> without doing anything
16:36 uv4smt joined
16:36 <glguy> apply fx to the portion of the list that remains to be checked
16:37 <XaNterous> shouldnt it complain about its not a other then [a] ?
16:37 wraithm joined
16:37 <glguy> The type of fx is [a] -> a
16:37 <glguy> and the rest of the list has type [a]
16:37 <glguy> so the result will be a
16:37 thunderrd joined
16:37 sssilver joined
16:37 <XaNterous> i did fx [xs] but says Couldn't match expected type ‘a’ with actual type ‘[a]’
16:38 <glguy> [xs] makes a new list with one element
16:38 <glguy> and that one element is the list xs
16:38 <XaNterous> | htail + (-x) == 2 = fx [xs]
16:38 <glguy> empty list: [], singleton list: [10], two-element list: [10,20]
16:39 <glguy> You just need to write: fx xs
16:39 e14 joined
16:39 <XaNterous> yeah, did it
16:39 cfricke joined
16:39 iomonad joined
16:40 fractalsea joined
16:40 ramzifu joined
16:41 robertkennedy joined
16:41 <XaNterous> glguy: what should i do for empty list ? :D
16:42 fendor joined
16:42 <glguy> Ask XaNterous. No one else can say
16:42 <boxscape> XaNterous: If I gave you the list [2,4,6,8], what should your function return?
16:42 permegreen joined
16:43 <XaNterous> i imagined this like but i cant code like i thought. i will give it a list and if there is a problem it will tell the number otherwise will do nothing
16:43 <boxscape> what number though?
16:43 <boxscape> oh
16:43 <boxscape> the number where it goes wrong?
16:43 <glguy> There's no "do nothing"
16:44 <XaNterous> :D
16:44 <glguy> You can return an uninteresting value
16:44 <glguy> fx :: (Ord a, Num a) => [a] -> Maybe a; for example
16:44 <XaNterous> hmm
16:44 <glguy> that either returns Nothing, or it returns Just y where y is the problem number
16:45 <glguy> The only thing functions "do" is return values
16:45 lambdafan joined
16:45 yogsototh left
16:46 <XaNterous> returns the last element of list . https://paste.kde.org/pty3e6cyb
16:46 oisdk joined
16:47 <phz_> hey, is there a standard way to get the pid of the running program?
16:48 mvr_ joined
16:48 gawen joined
16:49 eazar001 joined
16:51 <phz_> ok nevermind, I found something in the unix package
16:51 <XaNterous> glguy: i think, i did it barely :D is this correct ? https://paste.kde.org/p3ooiae5a#line-6
16:52 lifter joined
16:52 chlong joined
16:52 ragepandemic joined
16:53 codesoup joined
16:53 e14 joined
16:54 whaletechno joined
16:54 <XaNterous> thanks for your help guys, boxscape glguy
16:54 <lifter> I'm trying to switch to spacemacs, but autocomplete isn't working for me. I really don't know what the problem might be. I don't see any errors in *Messages* and ~/.local/bin is in my path (and I think I have all the binaries I need installed there). There must be something simple that I'm missing... Can anyone offer some hints?
16:55 <boxscape> XaNterous: that looks good, but now, instead of calling "error", you should probably return the current number with "Just x", as you wanted to
16:55 fractalsea joined
16:55 MitchW_ joined
16:57 <XaNterous> Cool. boxscape can i ask you something ? could i use putStrLn there in that function somewhere? when i use it i get IO error
16:57 ompaul joined
16:58 oisdk_ joined
16:58 <boxscape> XaNterous: Since putStrLn has type IO (), you can only use it in functions that also have the return type "IO something".
16:58 balor joined
16:59 SpinTensor joined
16:59 conal joined
17:00 <boxscape> (well, that's not entirely true, but it's close enough for now, I think)
17:01 Rodenbach joined
17:01 LuckyRawApe joined
17:01 <XaNterous> Okey thanks for your help, appreciated
17:02 <boxscape> this is generally the case with all functions that perform input or output
17:02 <boxscape> you're welcome
17:04 umib0zu joined
17:06 HoierM joined
17:06 <XaNterous> boxscape i think, for putStrLn thing, i should write another function and do pattern matching ? :D
17:07 <boxscape> possibly. Probably best to try it out and see if you can make it work.
17:07 HoierM joined
17:09 uv4smt joined
17:09 arpl left
17:10 uv4smt joined
17:15 <codedmart> lyxia: Yeah I figured that out actually. Thanks! I think if I can just get a sum type instance I think I should be on my way.
17:17 augur joined
17:17 takle joined
17:18 lifter joined
17:18 lavalike joined
17:18 gillesmajor joined
17:19 gillesmajor left
17:19 fractalsea joined
17:20 <codedmart> lyxia: Any change I could get your help with that last piece?
17:21 titivos joined
17:22 balor joined
17:23 _sras_ joined
17:23 <titivos> hi
17:23 Swizec joined
17:23 <_sras_> What is a good lib to do connection pooling of postgresql connections?
17:23 fendor joined
17:24 <codedmart> lyxia: A guess would be a start of this `instance (ToFieldNames a, ToFieldNames b) => ToFieldNames (a :*: b) where`.
17:25 <codedmart> But I know that is not right.
17:25 dawehner joined
17:25 raichoo joined
17:26 hamishmack_ joined
17:26 <lyxia> codedmart: that looks right to me though
17:28 <codedmart> lyxia: Oh I get this error `Expected kind ‘ghc-prim-* -> *’; but ‘a’ has kind ‘*’`
17:28 <codedmart> Along with the same for `b` and an error for `a :*: b`.
17:28 <brynedwards> _sras_: This is most likely still relevant http://codeundreamedof.blogspot.ie/2015/01/a-connection-pool-for-postgresql-in.html
17:28 takle joined
17:29 <lyxia> codedmart: Oh I see. You should be implementing FieldNames (f :*: g)
17:29 balor joined
17:30 <lyxia> you already did that, didn't you
17:30 <codedmart> Yeah I already have that.
17:30 <lyxia> you don't need to implement ToFieldNames (f :*: g)
17:31 <lyxia> (:*:) is only used in the generic representation of a data type, which is handled by the FieldNames typeclass.
17:31 hsk3 joined
17:31 <brynedwards> _sras_: There are also libraries which allow for higher level abstractions such as persistent, hasql, opaleye. persistent and opaleye allow for composable queries similar to Linq
17:32 fizruk joined
17:32 <lyxia> codedmart: also a more common naming convention would be FieldNames/GFieldNames rather than ToFieldNames/FieldNames
17:32 <_sras_> brynedwards: Yes. been playing with opaleye for a while now....
17:32 replay joined
17:32 <codedmart> lyxia: But if I don't I have to have the implementation for say `instance ToFieldNames a => ToFieldNames (Maybe a)` or I get an error https://gist.github.com/codedmart/bc1113ffd56b72ac3f47b15221f2bc63
17:33 <codedmart> lyxia: ok I will change those when I get this working.
17:34 <lyxia> codedmart: implement instance FieldName (f :+: g)
17:35 jbiesnecker joined
17:35 BlueRavenGT joined
17:35 <lyxia> codedmart: The error message is saying that there is no instance FieldName (... :+: ...).
17:36 <codedmart> lyxia: I don't suppose that is the same instance as `:*:`?
17:38 e14 joined
17:38 <lyxia> I think it is
17:38 igniting joined
17:38 <lyxia> Don't you just want to get field names from both branches?
17:39 megaTherion joined
17:39 <cocreature> _sras_: if you are using hasql there is https://hackage.haskell.org/package/hasql-pool-0.4.1/docs/Hasql-Pool.html
17:40 <codedmart> lyxia: Yeah so I assumed it was the same.
17:41 ninegrid joined
17:41 coltfred joined
17:41 <shapr> glguy: is there an easy hack for the parseLines (from your advent of code) to drop lines that don't parse?
17:42 <thoughtpolice> _sras_: postgresql-simple and the 'resource-pool' package are what I use, FWIW (I looked at Hasql but you'd need to write an Opaleye adapter ofc)
17:42 Arban_ joined
17:43 <shapr> I wish tshark would just output one event per line, but NO
17:43 <thoughtpolice> (I use both of those specifically with Opaleye, is what I meant)
17:44 <shapr> Perhaps it would be easier to write an FFI binding to libwireshark?
17:44 <shapr> Insanity ensues
17:44 <codedmart> lyxia: Thanks a ton. This has been a great learning experience.
17:45 <lyxia> You're welcome!
17:46 <glguy> shapr: Maybe replace the parser with: catMaybes <$> many ((Just <$> p <|> Nothing <$ skipMany (noneOf "\n")) <* eol)
17:47 <glguy> or: catMaybes <$> many (Just <$> p <* eol <|> Nothing <$ skipMany (noneOf "\n") <* eol)
17:47 <glguy> so that if the parse suceeds without eating the whole line it can still skip
17:48 tag joined
17:48 funkshun joined
17:50 vydd joined
17:51 <_sras_> thoughtpolice: in resource pool's createPool function, the second argument "Action that destroys an existing resource.", what do you usually use there?
17:51 fizruk joined
17:52 <thoughtpolice> _sras_: Database.PostgreSQL.Simple.close is all I use and has the perfect type you need already
17:53 oisdk joined
17:54 <shapr> glguy: thanks, I'll try that
17:54 henriksod joined
17:54 <thoughtpolice> _sras_: https://gist.github.com/thoughtpolice/e89d370f91039774f98bccf21e0cd877
17:54 <thoughtpolice> _sras_: That's a simple wrapper I wrote
17:54 <_sras_> Yes.
17:54 halogenandtoast joined
17:55 bartcopp joined
17:55 bartcopp joined
17:55 uv4smt joined
17:55 <cocreature> thoughtpolice: oh resource-pool looks like a really useful package, thanks for mentioning it
17:55 <freechips> hello guys the other day i asked about precise calculations with haskell, but then i had to go
17:55 JavaSucksMan joined
17:55 <freechips> im not sure i got my point across though
17:55 <freechips> id like to use mathematical functions which have error correction
17:55 <thoughtpolice> cocreature: Yeah, it's my go-to for a long time now.
17:56 <freechips> so as i said 125 ** (1/3) should return 5, as it does in octave
17:56 takle joined
17:56 <freechips> you pointed out haskell is not mathematica. i understand simple float math functions must forgo precision to allow for speed. are there math libraries in haskell with error correction?
17:56 <cocreature> thoughtpolice: I love packages like this that have a really small and simple API but just do everything you need them to in most cases
17:57 <freechips> check out this error correction function in python https://ptpb.pw/wKKg
17:57 bartcopp joined
17:57 bartcopp joined
17:57 <thoughtpolice> cocreature: Bonus points because resource-pool is really very small (maybe ~300 LOC?) on top of it, so it's not too hard to fully understand, either
17:57 <freechips> this is what im currently using. i'd like to have a library do this for me
17:58 <thoughtpolice> (The API is actually a pretty dead give-away at how you might roughly implement the idea, too)
17:58 <shapr> freechips: what about using Ratio?
17:58 <cocreature> shapr: heh I just tried freechips’s example using ratio but ratio doesn’t support (**)
17:58 <cocreature> now I’m slightly annoyed by that fact :)
17:59 <shapr> aw
17:59 mrpavo joined
17:59 <freechips> it was pointed out ratio could not be used as a power function does not always return rationals
17:59 <freechips> understandable
17:59 <freechips> i actually need error correction techniques
17:59 <freechips> they are pretty standard and have been used for years in mathematical precision calculations
18:00 <freechips> they are default in matlab and such programmimng environments
18:00 <cocreature> wait, the power of a rational with a rational exponent is always a rational no?
18:00 <dolio> 2^(1/2)
18:00 <freechips> but error corrections require multiple loops and sometimes advanced expressions. so they are not the default in general purpose languages
18:00 <cocreature> dolio: ah ofc I’m stupid
18:02 <cocreature> freechips: are you asking if such a library already exists or if you can implement this in haskell?
18:02 <freechips> cocreature: if it exists
18:02 <APic> Is there already an LLVM-Backend for Haskell?
18:02 <freechips> i'd like to do some scientific calculations so i need error corrections
18:02 <cocreature> APic: yep
18:02 <APic> Yay 🙌
18:02 <cocreature> APic: -fllvm
18:02 sellout-1 joined
18:02 <APic> Thanks
18:02 <freechips> some people stated i can accept 4.99999999 instead of 5. i think they are missing the point
18:03 <bjobjo> freechips: interesting discussion that I know next to nothing about; but a quick search of hackage lead me to this: https://hackage.haskell.org/package/exact-real
18:03 <freechips> i don't want floating errors to creep up in my results, i need guaranteed error correction
18:03 <cocreature> APic: but you need to have installed some specific llvm version so it is slightly annoying to use
18:03 <bjobjo> I've never used it however.
18:03 <APic> cocreature: I do not actually want to use it, just wanted to know whether it existed 😎
18:03 asmyers joined
18:03 <cocreature> APic: heh, fair enough
18:04 bjz joined
18:04 <ClaudiusMaximus> freechips: interval arithmetic can give you results like "4.9999999999999982 ... 5.0000000000000018
18:04 <ClaudiusMaximus> freechips: but i guess that isn't precise enough...
18:04 <freechips> bjobjo: might be what im looking for, but i think i also need the functions to have been edited, not only the representations of the numbers
18:05 <freechips> ClaudiusMaximus: im more looking for something as guaranteed precision.
18:05 <freechips> might look into interval arithmetic though
18:05 <freechips> interval seems to imply i can restrict the error amount?
18:05 free_beard joined
18:07 kgadek joined
18:07 Yuras joined
18:10 <thoughtpolice> freechips: You could use MPFR, perhaps? (Correct rounding, arbitrary precision) There is a Haskell binding out there.
18:10 Itkovian joined
18:11 marsam joined
18:11 <freechips> thoughtpolice: that's a good thought
18:12 <hsk3> lol
18:12 jbiesnecker joined
18:12 takle joined
18:14 <codedmart> lyxia: Can I ask you another question? I added the instances back in because if I don't have this one and allow it to use the default one it just continues looping and never terminates: https://gist.github.com/codedmart/bb4fc17d93c98fb90fb53dace422b329#file-main-hs-L58-L59
18:14 <ClaudiusMaximus> thoughtpolice:, freechips: edwardk's 'rounded' binding even has interval arithmetic on top (which is what i used for my example)
18:14 <JavaSucksMan> Ahh, the eternal question FFI with unsafePerformIO vs. native Haskell port (for mathy stuff)
18:14 <codedmart> Can you tell me why?
18:15 uglyfigurine joined
18:15 sz0 joined
18:15 <ClaudiusMaximus> thoughtpolice, freechips: i've been hacking on it a bit, here's my version https://github.com/ekmett/rounded/pull/27
18:15 snowalpaca joined
18:16 <thoughtpolice> ClaudiusMaximus: I was going to mention `rounded` since it's MUCH nicer than hmpfr, but it bitrotted. Glad to see someone bring it back!
18:16 arpl joined
18:16 andrss joined
18:16 <lyxia> codedmart: [a] is defined as [] | (:) a [a] right?
18:17 <cocreature> ClaudiusMaximus: nice diff stats! :)
18:17 <lyxia> codedmart: as a Generic is more or less defined as that sum of products
18:17 <thoughtpolice> ClaudiusMaximus: With ghc-typenats-normalize you could even get the compile-time rounding mode stuff working with more complex constraints, too.
18:17 <codedmart> Ah right so is it better for me to leave that on in?
18:17 <lyxia> codedmart: right
18:18 <andrss> is there execv() in System.* modules?
18:18 <ClaudiusMaximus> thoughtpolice: you mean things like doubling precision each iteration of Newton's method, for example?
18:19 e14 joined
18:19 <ClaudiusMaximus> thoughtpolice: currently i'd do that with the reflection mechanism, but if you have a static number of iterations it could be nicer
18:20 <cocreature> andrss: https://hackage.haskell.org/package/unix-
18:20 phyrex1an joined
18:20 <thoughtpolice> ClaudiusMaximus: I mean if you have something like 'Rounded TowardZero 128' you can replace '128' with a more complex constraint (GHC's typenat solver isn't very good today, typenats-normalize makes it much better). You can use reify for this, but this is convenient e.g. if you want to have the rounding size provided by the user, as a type Nat, but maybe
18:20 <thoughtpolice> enforce some other constraints
18:21 hololeap joined
18:21 <thoughtpolice> ClaudiusMaximus: As a completely unrelated example I need some constraints like calculating the clog between of a typenat, and GHC can't do that today.
18:21 <thoughtpolice> s/between//
18:21 <andrss> thanks
18:22 <hololeap> i'm looking for a standard function that looks like (a -> a -> b) -> a -> b
18:22 <hololeap> in other words, it takes a single value and applies it twice to a two-argument function. i tried hoogle and didnt find anything
18:23 <ClaudiusMaximus> :t join :: (a -> a -> b) -> a -> b -- maybe this
18:23 <lambdabot> (a -> a -> b) -> a -> b
18:23 Ptival left
18:23 snowalpaca joined
18:23 <danharaj> don't do that tho :p
18:23 <thoughtpolice> danharaj: no, do it
18:24 <danharaj> thoughtpolice i will find you and spit you like a pig
18:24 <hololeap> ClaudiusMaximus: sweet :)
18:24 <thoughtpolice> D:
18:24 tobill joined
18:24 <danharaj> do you really like playing "guess the monad" :p
18:24 <eschnett> the function a -> (a, a) is usually called dup
18:25 ner0x652 joined
18:25 robotroll joined
18:25 <shapr> Hm, I wish Data.Map.insertWith made partial application easier by moving the map near the front... oh well.
18:25 <eschnett> so you can combine uncurry and dup
18:26 <freechips> thanks for the input guys ill see if i can work with mpfr, or maybe ill just implement my own function since that's all i need
18:26 alx741 joined
18:27 dawehner joined
18:27 JuanMiguel joined
18:27 <shapr> freechips: what got you into Haskell? Did you mention that in the earlier conversations I missed?
18:27 <shapr> I like the narratives.
18:27 balor joined
18:29 <hololeap> danharaj: were you talking to me?
18:29 <lispy> shapr: "What would it take to get you into a nice shiny Haskell today?"
18:29 <andrss> http://lpaste.net/353822
18:29 jbiesnecker joined
18:29 tobill joined
18:29 <andrss> is there a more generic/monadic way to turn foldr to scanr?
18:30 <shapr> lispy: do I have that used language salesman look?
18:30 <freechips> shapr: just wanting to play with functional
18:30 <shapr> oh, that's a good reason
18:30 <lispy> shapr: No not at all
18:30 <hololeap> all it costs is your time and 20% of your sanity
18:31 <lispy> shapr: But what you said made me think of that
18:31 <shapr> hololeap: how do YOU use Haskell?
18:31 <hololeap> shapr: as a device for masochistic pleasure
18:32 <lambdafan> really? haskell reduces my pain levels.
18:32 oish joined
18:32 <shapr> yeah, same here
18:32 <lispy> hololeap: have you seen this? https://pdfs.semanticscholar.org/8b79/2f78825bad68cf7a2267ea03db5b4273df33.pdf
18:33 <lispy> "The Pleasure and Pain of Dependently Typed Haskell Programming"
18:33 <hololeap> i'm striving to build concurrent networked systems but i haven't gotten there yet. i have recently "grokked" monads and io, so i am still a noob by most standards
18:34 <lispy> Sounds like you're on a good path
18:34 <lpaste_> lambdafan pasted “One-Off detection. Complexity Analysis Question” at http://lpaste.net/353823
18:35 <hololeap> lol, hasochism... i'm going to have to remember that Xp
18:35 <shapr> hololeap: hey, you beat the part that scares off most people
18:35 <shapr> When I was first learning programming people were equally scared of objects, now it's monad. It's all about the same. New things are scary, I guess.
18:36 <lambdafan> Achievement Unlocked: Monad Comprehension (not to be confused with monad comprehensions)
18:36 <lispy> hololeap: basically anything by Conor McBride is going to have a sense of humor in the writing (and be interesting/thoughtful in the content)
18:36 <hololeap> shapr: it's just wrapping your head around monads and monad transformers is hard when you have come from a different background. i now understand that i was using them all the time, just implicitly
18:37 <shapr> hololeap: yeah, objects were hard when there were only functions / procedures.
18:37 <ggVGc> objects are crap
18:37 <hololeap> my first language was ruby, so... yeah
18:38 <hololeap> i realized that my favorite part of the language was the functional stuff, so i decided to jump into haskell
18:38 coltfred_ joined
18:38 <shapr> hololeap: yeah, I did exactly that from Python, though I didn't realize that cool thing was FP until later.
18:39 `^_^v joined
18:39 <hololeap> i may or may not stick with haskell, but there are a couple projects i want to complete in it first, just so i know i really understand the concepts
18:39 tobill joined
18:39 jbiesnecker joined
18:39 <hololeap> so far it is a beautiful language
18:39 <shapr> with lots of cool tools!
18:39 <shapr> mind you, other lanugages have different cool tools
18:40 snowalpaca joined
18:40 <lispy> ggVGc: I don't think objects are crap. They are one of many abstractions with pros/cons. I do think OO subtyping is often a mistake.
18:41 nonzen joined
18:41 <hololeap> i think that mutable objects in a concurrent environment is generally a mistake
18:41 <lispy> shapr: yeah, I've been learning rust recently and I'm so grateful to have a straight up systems language with good support for memory safety.
18:41 <ggVGc> I think beginning to write a computer program is generally a mistake
18:41 <ggVGc> but not entirely always
18:41 <lispy> heh
18:41 <hololeap> true
18:42 andrss left
18:43 dawehner joined
18:43 connrs joined
18:44 takle joined
18:44 <shapr> silly question, how do I get the differences between each number in a list of numbers?
18:44 <shapr> it's not fold, or scan, not really
18:44 <boxscape> zipWith (-) (drop 1 xs) xs?
18:45 <JavaSucksMan> shapr: I got into Haskell because all the cool kids are doing it...
18:45 <JavaSucksMan> No, It's because of lambdacats.
18:45 <shapr> boxscape: oh!
18:45 <boxscape> This is the third time this came up in here today :)
18:45 <shapr> boxscape: oh wow
18:45 <shapr> yeah, that's a super simple solution, thanks!
18:45 <orion> JavaSucksMan: I got in to Haskell because it challenged my ego.
18:45 <boxscape> no problem
18:46 <JavaSucksMan> Seriously though... I worked at a behavior finance firm.... the front end was Haskell and the back end was PHP. (no, I did not get those backwards... they did)
18:47 conal joined
18:47 <JavaSucksMan> I'm working on my own Haskell milestone... my very first lambdacat
18:48 augur joined
18:48 <JavaSucksMan> damn... I missed it... but cats are SO effectful
18:48 <MarcelineVQ> boxscape: zipWith (-) <*> drop 1 if you want to look fancy
18:48 <boxscape> yeah, that looks nice
18:49 Itkovian joined
18:50 <AWizzArd> How are records implemented under the hood? If I have a big one, is the access to every field O(1)? Is it an array when it’s fewer than, say, 10 fields, and a hashmap otherwise?
18:51 <JavaSucksMan> lispy: Thanks for the Conor McBride paper... hadn't seen it.... Epigram looked really cool
18:51 <Athas> AWizzArd: O(1), yes.
18:51 <Athas> They're just tuples.
18:51 <lispy> JavaSucksMan: yw. I recommend looking at his other publications.
18:52 <Athas> For a given field name, the offset in the record is known at compile-time, so no need to carry the field names around at run-time (for hashing or whatever).
18:52 <lispy> JavaSucksMan: for instance, he was behind some of the initial work on bringing applicative to Haskell
18:52 <JavaSucksMan> I need to level up on types to understand them.... I'm mostly a Smalltalk dude (resisting urge to defend objects)
18:52 <AWizzArd> Athas: and when I „change” the contents of one field, I have a new/fresh instance of my record, where this one field has changed. How is this done under the hood? Is structure shared?
18:52 <AWizzArd> Or would it have to copy all values into the new instance?
18:53 <JavaSucksMan> I tried OCAML, but it looked just to ugly.... Haskell is the first language I seriously used that made types palatable
18:53 AntiSpamMeta joined
18:53 <reactormonk> How do I escape a literal = inside a QQ expression?
18:54 <JavaSucksMan> Im still trying to understand Applicative as being usefully between funtors and monads... got a motivating example?
18:54 <Athas> AWizzArd: think of every field to be a pointer to the value. When you create a new record, the pointers are copied, but not what they point to.
18:55 <Athas> AWizzArd: basically, record updates are cheap, don't worry about it.
18:55 <AWizzArd> Athas: okay I see, so indeed, all pointers need to be copied.
18:55 <Athas> JavaSucksMan: I recommend the chapter on applicative parsers in Real World Haskell. I find they look nicer than the corresponding monadic parsers.
18:56 ikke joined
18:56 <AWizzArd> Athas: In principle this should be fine, with records having 3-4 fields. But if it should be 100+ fields, which are updated in a call to map/fold, it may be a bit more costly.
18:56 <Athas> Why would you ever have 100 fields in a record?
18:56 <AWizzArd> Athas: So maybe not having everything in one level could be helpful.
18:56 <ClaudiusMaximus> Athas, AWizzArd: the pointer behaviour can be changed with {-# UNPACK #-} pragma for strict fields whose size is known (it stores the data directly in the record, avoiding pointer indirection)
18:57 <AWizzArd> Athas: I don’t have that many yet, I am just curious.
18:57 mmachenry joined
18:57 bodisiw joined
18:57 <AWizzArd> However, for holding configurations, there could indeed be easily a hundred fields.
18:58 <AWizzArd> Of course I don’t plan to update configs in tight loops ;-)
18:58 <AWizzArd> ClaudiusMaximus: this sounds good for faster access. But this could be more costly when updating fields.
18:58 Philantrop1 joined
18:58 <JavaSucksMan> OK, folks... for the first time in public, here it is..... Be kind
18:58 <JavaSucksMan> http://hakaru.ml/lambdacats.html
18:58 bollu joined
18:58 <JavaSucksMan> I look the photo, as well.
18:59 <JavaSucksMan> I also ran it through the GHC typechecker
18:59 t7 joined
18:59 <ClaudiusMaximus> AWizzArd: sure, but for small data (comparable in size to a pointer) it can be a win - you lose laziness though
19:00 nomotif joined
19:00 jbiesnecker joined
19:01 Itkovian joined
19:02 t0by joined
19:03 Berra joined
19:03 tobill joined
19:04 <JavaSucksMan> Request For Comments: http://hakaru.ml/lambdacats.html
19:04 mmachenry joined
19:04 <dmwit> phew, let's hope a refactor never changes that `snd` to a `fst
19:04 <dmwit> ` -- delimiters!
19:05 <JavaSucksMan> Record syntax is awkward for image macros
19:05 meoblast001 joined
19:06 <JavaSucksMan> but, whoever out there is toing 15+tuples... consider it
19:06 ramzifu joined
19:08 guampa joined
19:08 cfricke joined
19:10 nonzen joined
19:11 wraithm joined
19:11 harfangk joined
19:15 tobill joined
19:16 strykerkkd joined
19:16 spacedog82 joined
19:18 jbiesnecker joined
19:18 bjz joined
19:19 marsam joined
19:21 jomg joined
19:21 oish joined
19:22 ThorsHammer joined
19:22 sleblanc` joined
19:23 locallycompact joined
19:25 Guest81894 joined
19:25 systadmin joined
19:25 bryanlemon joined
19:26 moongazer joined
19:27 <bryanlemon> I am using snap for a RESTfull API, and having problems with the wrong hander being used to process a request. I assume it is something I am doing wrong.
19:28 <bryanlemon> There are two routes: process/specific and process/:var1/somethingelse
19:28 takle joined
19:28 <bryanlemon> If I make a call to process/specific/somethingelse, it calls the handler for process/specific
19:28 <bryanlemon> rather than /process/:var1/somethingelse
19:29 <bryanlemon> Any ideas?
19:30 <AWizzArd> How is Haskell versioning done? From looking at the roadmap it seems version 8.2 will be out in roughly one month. Where is 8.1? And the next version after 8.2 seems to be 8.4.
19:30 detrumi joined
19:30 <geekosaur> odd numbers are devel versions
19:30 <geekosaur> so the thing that will be 8.2 is currently 8.1.<yyyymmdd>
19:31 t7 joined
19:34 edwtjo joined
19:34 edwtjo joined
19:34 <sm> very relevant for haskell, I think: https://news.ycombinator.com/item?id=13932806
19:34 jbiesnecker joined
19:36 <reactormonk> How can I shorten https://gist.github.com/c5a1ab605930afc1c7bc625048f1a332 ?
19:36 takle joined
19:37 <* geekosaur> can't think of a good way aside from CPP or TH
19:37 <geekosaur> (I don't think Generics will fly for this)
19:38 <lyxia> reactormonk: GeneralizedNewtypeDeriving
19:38 <XaNterous> what stands for head or tail in psudeocode ?
19:39 oisdk joined
19:39 Putonlalla joined
19:39 marcopullo joined
19:39 <lyxia> reactormonk: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#generalised-derived-instances-for-newtypes
19:39 <reactormonk> lyxia, thanks, was easily googlable
19:42 mstruebing joined
19:42 dylukes joined
19:42 <AWizzArd> I read about GC improvements in Haskell 8.2. What are they good for? Will they support bigger amounts of long-lived data?
19:43 <dylukes> Hello all. Any suggestions on a solid idiomatic GL library?
19:44 <dylukes> Or resources for building my own engine?
19:44 PennyNeko joined
19:44 <Rembane> dylukes: Gloss. Depending a bit on what you want to do.
19:44 <eacameron> AWizzArd: You may be referring to compact regions. If so, then yes they help with long-lived data. They allow you to put data into regions that don't undergo GC
19:44 <dylukes> Ideally I'd like to have the ability to display normally, but also ray trace.
19:44 <dylukes> Thing model viewer (for biochemistry type stuff).
19:44 zv joined
19:44 mrpavo joined
19:45 <dylukes> So, ideally, as declarative as possible should be a good fit.
19:45 jbiesnecker joined
19:45 <eacameron> AWizzArd: The API for compact regions looks really simple: https://github.com/ezyang/compact
19:45 <dylukes> Ah I need 3D stuff, more OpenGL type.
19:45 <dylukes> I'd like to write a ray tracer, would be fun.
19:46 <Putonlalla> There's `not-gloss`, dylukes, but I haven't tried it.
19:46 <AWizzArd> eacameron: thx for the link, this sounds very interesting, because we have data of which we know it will live as long as the application does.
19:46 MatrixTraveler[m joined
19:47 <eacameron> AWizzArd: Sure; yes a lot of folks are excited about this feature.
19:48 takle joined
19:49 rafael_cgs joined
19:50 wraithm joined
19:50 <Putonlalla> Reminder to back up your Haskell projects now so that you don't see a SMART warning and get thrown into Grub rescue like I just did.
19:52 mmachenry joined
19:54 jbiesnecker joined
19:55 umib0zu joined
19:57 raduom joined
19:59 Ranhir joined
20:01 insitu joined
20:01 bollu joined
20:01 nycs joined
20:01 jbiesnecker joined
20:01 mmachenry joined
20:01 wraithm joined
20:05 titivos left
20:06 doodlehaus joined
20:06 wraithm joined
20:07 biglama joined
20:08 fDev2179 joined
20:09 curious_corn joined
20:09 dylukes joined
20:10 <codedmart> lyxia: Or anyone else I am trying to add options to my generic stuff but am getting an error I don' understand: Cannot apply expression of type ‘[Text]’ to a visible type argument ‘a’ • In th
20:10 <codedmart> Sorry pasted wrong things: https://gist.github.com/codedmart/7ea593bc10044c320ae490a46fbd0819#file-error
20:11 <codedmart> The error is talking about this line specifically: https://gist.github.com/codedmart/7ea593bc10044c320ae490a46fbd0819#file-main-hs-L8
20:11 ramzifu joined
20:11 cyborg-one joined
20:11 <dfeuer> They be newtypes.
20:12 <dfeuer> Er...
20:12 <dfeuer> Sorry, wrong point in time.
20:12 <codedmart> dfeuer: Is that directed at me?
20:13 Snircle joined
20:13 <dfeuer> No.
20:13 <dfeuer> codedmart: I was responding to something someone said hours ago, without realizing it.
20:13 SuprDewd joined
20:13 <codedmart> Oh ok
20:14 <lyxia> codedmart: apply @a before the option
20:14 <lyxia> gFieldNames @a
20:15 tctara_ joined
20:16 oisdk joined
20:17 erisco joined
20:17 acarrico joined
20:17 <codedmart> lyxia: Hmm... ok. I assume there is a reason for that. Thanks!
20:18 augur joined
20:19 takle joined
20:19 dylukes joined
20:20 insitu joined
20:22 e14 joined
20:22 featherlessbiped joined
20:23 <shapr> glguy: thanks for your parser help, I got to write Haskell for work purposes and it worked great! :-)
20:23 carlomagno joined
20:23 <erisco> wow, I bet you get paid lunches too
20:24 <Sornaensis> does anyone here have comparable experience in rust as haskell
20:24 <Sornaensis> ?
20:25 mizu_no_oto_work joined
20:25 <erisco> yeah, mine is LT
20:25 fDev2179 left
20:26 titivos joined
20:26 <MarcelineVQ> I Ord-er you to be less silly!
20:26 <shapr> erisco: only on Fridays
20:27 oish joined
20:27 curious_corn joined
20:27 <pleiosaur> Sornaensis: what are you looking to compare between rust and haskell/
20:27 <titivos> Let's say I have a list xs and use takeWhile (condition) xs. then how can I use the rest of the list (ie the list after takeWhile)?
20:28 <erisco> use dropWhile
20:28 <erisco> :t span
20:28 <lambdabot> (a -> Bool) -> [a] -> ([a], [a])
20:28 <Sornaensis> pleiosaur: garbage collection and concurrency
20:28 <erisco> or that
20:28 <erisco> > span (<3) [1..10]
20:28 <shapr> Sornaensis: I thought rust doesn't do GC?
20:28 <lambdabot> ([1,2],[3,4,5,6,7,8,9,10])
20:28 <titivos> thanks very muchh that should work
20:28 <titivos> much*
20:29 <pleiosaur> Sornaensis: rust uses uniqueness types to do static automatic memory management, no GC needed (though you can optionally use reference counted types to make memory management dynamic, in case you have a graph)
20:30 <lispy> pleiosaur: reference counting doesn't work very well for graphs
20:30 <erisco> a non-cyclic graph?
20:30 <pleiosaur> Sornaensis: uniqueness typing also means that rust statically prevents data races, which is obviously good for concurrency, but rust prefers to have a multitude of concurrency/parallelism primitives rather than any one blessed implementation
20:30 <lispy> There is an experimental gc crate for the times when your data may have cycles
20:31 <pleiosaur> lispy: you're right, it doesn't work well for graphs, but everything else in rust works worse for graphs IMO :P
20:31 <lispy> Rust's type system hasn't been proven to prevent data races, but there are people working on formalizing it.
20:32 <lispy> See for instance: http://plv.mpi-sws.org/rustbelt/
20:32 <pleiosaur> I'm pretty convinced that the model is sound, but yes formalization is desirable
20:33 <pleiosaur> Sornaensis: the tldr is that you can use plain old threads in rust and it's not a nightmare, which is very interesting
20:33 <dfeuer> twanvl: Ping
20:33 <rafael_cgs> register 055291 rafaelcgs10@gmail.com
20:34 <geekosaur> "oooops"
20:34 <erisco> a hunter2 moment
20:34 asthasr joined
20:35 eazar001 joined
20:37 eazar001 joined
20:37 lynnard joined
20:38 <nshepperd_> How would uniqueness types prevent data races? Apart from just not having any shared variables at all
20:38 cpup joined
20:38 <Sornaensis> pleiosaur: auto alloc/dealloc differs from gc how?
20:39 <Sornaensis> wouldn't that just be really inefficient if you have lots of short lived objects
20:39 <Sornaensis> :C
20:40 marcopullo joined
20:41 reynir joined
20:42 <nshepperd_> Sornaensis: it's auto in the sense that running destructors of disappearing stack objects is auto
20:43 lattenwald joined
20:44 <nshepperd_> As opposed to doing any kind of recursive liveness checking
20:45 mdarse joined
20:45 <AWizzArd> What is the „default” test lib for Haskell? Pure QuickCheck? A wrapper around it?
20:46 sleblanc joined
20:46 <erisco> in the best case you want to allocate a block of memory, allocate in this block without cleanup, then free the whole block when done
20:46 <mmachenry> AWizzArd: HSpec which orchestrates HUnit tests as well as quickcheck.
20:47 <erisco> individually freeing objects can be disastrously expensive
20:47 <mmachenry> Quickcheck won't replace hunit, it works side by side really well.
20:47 <pleiosaur> Sornaensis: a garbage collector is inherently a dynamic operation, but having the compiler itself insert malloc/free is a static operation, which lets you put stronger guarantees on resource usage
20:48 <AWizzArd> mmachenry: good, thx
20:48 <erisco> in the best case it is one expensive alloc and free
20:48 <erisco> every alloc in the block just bumps a pointer up
20:48 <pleiosaur> Sornaensis: short lived objects live on the stack anyway, which has always been fast, and note that C has always had an automatic storage duration anyway for stack-allocated items
20:48 <Sornaensis> mm
20:48 rafaelcgs10 joined
20:49 <pleiosaur> Sornaensis: what rust does (via uniqueness) is allow you to extend a stack discipline across arbitrary function calls
20:49 coot joined
20:49 curious_corn joined
20:50 locallycompact joined
20:51 <pleiosaur> nshepperd_: uniqueness means that, logically, variables aren't shared. this is achieved differently in rust than it is in e.g. erlang, but it's sorta kinda the same basic principle
20:51 <pleiosaur> though rust lets you mutate things if there's a unique handle to it, since mutable state is fine as long as it isn't shared mutable state (fine from a correctness standpoint)
20:52 SexHendrix joined
20:52 <codedmart> Can you not apply functions to proxys? This always ends up as "" rather then what I would expect: https://gist.github.com/codedmart/ccdec83cd49d1d8d9bbfccaab343f884#file-main-hs-L4 and https://gist.github.com/codedmart/ccdec83cd49d1d8d9bbfccaab343f884#file-main-hs-L13
20:52 <codedmart> @lyxia ^^
20:52 <lambdabot> Unknown command, try @list
20:52 <codedmart> lyxia: ^^
20:53 <codedmart> Sorry might have pinged you twice.
20:53 nur0n joined
20:53 rafaelcgs10 joined
20:53 <codedmart> It seems to work fine on lines: 3 and 12.
20:54 <shapr> AWizzArd: I've been using hspec recently, it's nice.
20:55 <erisco> codedmart, is there an error message?
20:55 <nur0n> Hello, would this this be the right place to ask a question about installing a package through stack?
20:55 <codedmart> erisco: There is no error message.
20:55 <codedmart> Just not getting the outcome I am expecting.
20:56 mrpavo joined
20:56 insitu joined
20:56 sjpet joined
20:57 <erisco> if the function takes Proxy then you can pass Proxy, no issue
20:58 <AWizzArd> shapr: will be trying it.
20:58 <shapr> AWizzArd: I've used quickcheck and hunit separately in the past, and hspec does integrate them.
20:59 Henri joined
20:59 <erisco> if you have a self-contained example then we can take a closer look
21:00 <codedmart> erisco: Let me paste more: https://gist.github.com/codedmart/7c42983d24f71ae41c6a0beeadffb8a2
21:00 louispan joined
21:00 <codedmart> I want to apply the `fieldNameModifier` function but this: https://gist.github.com/codedmart/7c42983d24f71ae41c6a0beeadffb8a2#file-main-hs-L24
21:01 fosskers joined
21:01 <codedmart> fromMaybe always returns "".
21:01 <codedmart> But if I remove applying `fieldNameModifier` I get a value back.
21:01 <codedmart> As I would expect.
21:01 petervaro joined
21:01 rafaelcgs10 joined
21:02 wtetzner joined
21:03 conal joined
21:03 <erisco> I am missing a bunch of stuff still
21:04 xaviergmail joined
21:05 takle joined
21:06 takuan joined
21:06 <erisco> I need to at least know what headMay is and what your test case is
21:06 acro joined
21:06 acro joined
21:06 ramzifu joined
21:06 <erisco> and what the expected output is versus what you are getting
21:06 JDevlieghere joined
21:07 silentcontrib joined
21:08 prions joined
21:08 augur joined
21:08 <codedmart> erisco: ok let me add that.
21:10 rafaelcgs10 joined
21:10 oisdk_ joined
21:10 hybrid joined
21:12 <hybrid> I had a question about the strict positivity condition in some dependently-typed languages. Is this a good place to ask it?
21:12 <joneshf-laptop> Is http://hackage.haskell.org/package/base- useful if you have GADTs or Leibniz available to you?
21:12 mmachenry joined
21:12 <shapr> hybrid: ##dependent might have more help
21:13 <hybrid> Ok, I'll try there first. Thanks
21:15 <erisco> I am not sure what is meant by propositional equality there
21:16 <erisco> I thought a ~ b was definitional equality, and that is just what Refl gives you
21:16 <geekosaur> if programs are proofs, types are propositions, iirc?
21:18 <erisco> yes but propositional equality, if I understand, is P is propositionally equal to Q if forall x. P(x) <=> Q(x)
21:18 <erisco> so you might have different propositions syntactically but they have the same meaning
21:19 <erisco> but definitional equality is saying they are defined the same way
21:20 mhrh3 joined
21:20 <erisco> so, for types, String is definitionally equal to String
21:20 <erisco> so I must be misunderstanding how these terms are applied here
21:21 ph88_ joined
21:22 marsam joined
21:22 IRCFrEAK joined
21:22 IRCFrEAK left
21:23 <Sornaensis> pleiosaur: thanks
21:25 lifter joined
21:25 Destol joined
21:25 Itkovian joined
21:25 <lifter> Does anyone know if I need to do anything special to get autocomplete to work in Spacemacs?
21:26 <brynedwards> lifter: see https://github.com/syl20bnr/spacemacs/tree/master/layers/%2Blang/haskell#completion-support
21:27 <lifter> brynedwards: OK, somehow I thought it was just supposed to work out of the box, I'll try this stuff.
21:27 solarus joined
21:30 zar joined
21:30 <codedmart> erisco: Nevermind, as I was writing out examples I saw what the problem was. Thanks!
21:31 Arguggi joined
21:31 e14 joined
21:31 uglyfigurine joined
21:31 oisdk joined
21:36 <c_wraith> that new dependent haskell paper is really cool. glad to see the underpinnings concretely specified and proven to have the desired properties
21:36 kshukla joined
21:36 oisdk_ joined
21:37 <erisco> published where?
21:37 crobbins joined
21:38 <c_wraith> Stephanie Weirich's page
21:39 electrostat joined
21:41 <lifter> brynedwards: I got it to work, thanks for pointing me in the right direction.
21:42 tomphp joined
21:42 pie__ joined
21:44 zennist joined
21:45 JeanCarloMachado joined
21:45 marcopullo joined
21:46 IanKelling joined
21:49 <brynedwards> lifter: np =)
21:50 <lifter> It was a case of "read the f'ing docs"
21:50 <brynedwards> :D
21:52 hiratara joined
21:58 Micamo joined
21:59 Lord_of_Life joined
22:00 <erisco> I feel like there is a nasty bug in this library
22:01 wjm joined
22:01 peterbecich joined
22:01 nshepperd1 joined
22:03 danpalmer joined
22:04 alphor joined
22:05 niteria joined
22:05 Koterpillar joined
22:07 zero_byte joined
22:08 a3Dman joined
22:09 uglyfigurine joined
22:11 insitu joined
22:13 epsilonhalbe joined
22:14 ChaiTRex joined
22:15 ebzzry joined
22:15 augur joined
22:16 bollu joined
22:16 anuxivm joined
22:18 epsilonhalbe left
22:20 JeanCarloMachado joined
22:21 briansteffens joined
22:22 wjm joined
22:22 rdococ joined
22:22 coot joined
22:22 mikeizbicki joined
22:22 dfranke joined
22:23 <erisco> all the parts seem to work, but it fails when I run it all together
22:24 <erisco> I think something is screwed up with the FFI in the library
22:25 <erisco> at a certain problem size it begins giving me back garbage
22:26 mda1 joined
22:26 jre2 left
22:28 _ashbreeze_ joined
22:28 locallycompact joined
22:29 burtons joined
22:29 louispan joined
22:29 jre2 joined
22:31 gugah joined
22:31 hiratara joined
22:32 yinn joined
22:33 ddere joined
22:33 bollu joined
22:34 <erisco> maybe it is Z3, who knows... will try a different solver
22:37 a3Dman joined
22:37 dopey__ joined
22:37 takle joined
22:41 kriztw joined
22:41 staafl joined
22:44 takle joined
22:45 danharaj joined
22:47 jabbslad joined
22:49 <erisco> hm, nope, changing solving from z3 to cvc4 fixed nothing
22:52 doodlehaus joined
22:53 pandeiro joined
22:55 <t7> what are you solving?
22:55 benl23 joined
22:56 ScarieBlowfish joined
22:57 KarboniteKream joined
22:57 bjz joined
22:57 uglyfigurine joined
22:58 xaviergmail joined
22:59 <erisco> existentials
23:00 justanotheruser joined
23:05 eacameron joined
23:05 <erisco> this library design is so goofy though
23:05 <erisco> there is no way to print out the problem case that I can discern
23:06 ramzifu joined
23:06 iandeb joined
23:07 <erisco> I'll have to rip out sbv and use a different library altogether
23:07 <erisco> this is the nightmare of 3rd party libs
23:08 <erisco> they rarely work right
23:11 takle joined
23:11 burdges joined
23:12 Disavowed joined
23:13 <t7> solve it in coq yourself ya lazy bum
23:13 <erisco> heh, well that defeats the purpose
23:13 <erisco> the purpose is automation
23:15 takle joined
23:15 freeside joined
23:15 <t7> amazon turk?
23:16 Jesin joined
23:17 <thoughtpolice> erisco: Report an issue to Levent if you actually think it's corruption (I'm somewhat skeptical of that claim considering it does not use the FFI at all but emits SMT-Lib files that the solvers ingest. I also don't know what you mean by 'print out the problem case' -- you can just emit the SMT-Lib file?)
23:17 alunduil joined
23:18 <erisco> where is this file? doesn't show anywhere for me
23:18 <thoughtpolice> http://hackage.haskell.org/package/sbv-5.15/docs/Data-SBV.html#g:53
23:18 <erisco> and if FFI is not involved then I am a bit confused as to why kill commands are not handled correctly
23:18 <erisco> it will keep printing at the REPL even after I've killed it
23:19 <erisco> okay thanks thoughtpolice
23:19 <erisco> I am glad someone knows this lib
23:20 <thoughtpolice> It's possibly something to do with signal handling, child process control. (Those are maybe in a bit different category but same results, I guess). You'd have to provide some kind of test case (what program are you killing? Z3 or the Haskell program?)
23:20 yrdz joined
23:20 <erisco> Ctrl+C at the REPL
23:20 <erisco> Z3 keeps running
23:20 <thoughtpolice> GHCi? That's probably a result of the interrupt not actually sending a kill signal to Z3. That might be worth reporting.
23:21 dmiles joined
23:21 <thoughtpolice> (Ctrl-C in GHCi by itself will not kill subprocesses; in theory I think there could even be background forkIO'd threads still that might exist in the ether, which could still be monitoring it. Things like this get complicated inside a nested environment like GHCi where anything can sort of be immediately interrupted)
23:22 <erisco> as an SBV issue?
23:23 <* erisco> looks up how to write to a file in Haskell
23:23 <thoughtpolice> Yes. I'd suggest reporting it to Levent; there could very well be an easy fix on his end (e.g. during `prove`, by just handling if you can provide a reliable reproduction case. He's quite good at responding (from memory, anyway)
23:23 <erisco> sorry when I said FFI I was also thinking IPC
23:24 <thoughtpolice> erisco: something just like `compileToFile ... thingToProve >>= writeFile "testcase.smt2"` should work.
23:24 <thoughtpolice> np
23:25 marcopullo joined
23:26 <erisco> I don't know what dumping the file is going to show
23:26 <erisco> if the file is exactly what is being sent to z3 then the problem exists before that
23:26 <erisco> because it isn't z3 that is wrong, I've also tried cvc4
23:27 c_my_nick joined
23:27 <thoughtpolice> Well, if this is the issue then the SMT-lib output is fairly irrelevant, I suppose. It doesn't look like anything handles interrupts in SBV, so yes this is probably "expected". A signal sent to stop a running `prove` command will not propagate the signal to Z3. This is probably an oversignt.
23:27 <erisco> I run z3 on the file and it tells me sat when I know it is not
23:27 <erisco> well that is a separate issue that isn't that important
23:28 <thoughtpolice> erisco: Ah, then that is an actual bug that should also be reported, too. The SMT-lib output is going to give you a file that you can run offline through a prover of your choice; in this case it sounds like the actual translation is bugged, so that's irrelevant. You should just report the Haskell test case, of course.
23:29 <thoughtpolice> (You sort of seem to have multiple problems here so I'm not sure exactly what _all_ could be wrong, but that's at least 2 clear things.)
23:29 <erisco> but I need something to report, so I am trying to extract the case somehow
23:29 <erisco> if there was a more direct way to print an SBool I would use that
23:29 <erisco> but show on an SBool just prints <<symbolic>>
23:30 <erisco> it would take me a darn long time to read the smt2 file and discern what is inconsistent
23:30 _ashbreeze_ joined
23:30 <thoughtpolice> Right, it's symoblic. I'd just suggest reporting a bug; Levent can likely boil down a cause fairly quick.
23:30 acarrico joined
23:31 <thoughtpolice> Minimizing test cases is always good but tedious, of course. I tend to use HPC to minimize tests to some good effect but I don't know how well it would work here.
23:31 <erisco> I can't just send in my whole program, that is too much
23:31 ccomb joined
23:31 Lord_of_Life joined
23:32 <thoughtpolice> Well, you will have to minimize it then. I of course can't set your standards for what a valid bug report is. Even if there's a large amount of code, reporting it so you can begin to work piece-by-piece is probably best.
23:32 grayjoc joined
23:32 <erisco> it doesn't get smaller
23:32 mmachenry joined
23:32 <thoughtpolice> Then you're completely out of luck if you're not willing to report it, I'm afraid.
23:32 <erisco> so I am just trying to get the symbolic expression itself
23:33 louispan joined
23:34 dan_f joined
23:35 rafaelcgs10 joined
23:37 <thoughtpolice> erisco: You can look at the internal module. The SVal constructor and show instances are exposed there, at least. But if you're seeing a symbolic value, I'm not sure it will change anything. Do you mean like, if you have `\x -> x `shiftL` 2 .== 4 * x` -- you want 'show $ 4 * x' to print "4 * <<x>>" or something, kind of like the AST?
23:37 suls joined
23:37 <erisco> yes, that is right
23:37 marsam joined
23:37 <erisco> with the AST I have a much better chance of seeing the inconsistency
23:38 ChaiTRex joined
23:38 ebzzry joined
23:39 <erisco> I can't completely rule out a mistake on my part
23:40 <erisco> it is only that it succeeds for many other cases
23:40 <erisco> but once a certain problem size is reached it stops working
23:40 <erisco> and answers I get are wrong
23:40 hybrid joined
23:41 <rafaelcgs10>
23:41 <erisco> in the meantime I can try and reconstruct the AST from the 300+ lines of the smt2 file
23:41 rafaelcgs10 left
23:42 systemfault joined
23:42 rafaelcgs10 joined
23:42 <rafaelcgs10>
23:42 <rafaelcgs10>
23:42 <thoughtpolice> erisco: Using runSymbolic and the Result constructor looks roughly like the best you'll get at the moment. (This does have the benefit the AST is a bit more typeful than a simple file)
23:42 <thoughtpolice> You can see this if you just look at the code for compileToSMTLib
23:42 farrioth joined
23:42 <rafaelcgs10>
23:43 ChaiTRex_ joined
23:45 arpl left
23:46 <erisco> hm, this is the output I get thoughtpolice http://lpaste.net/353836
23:47 <erisco> any knowledge of what bvult is?
23:47 ebzzry joined
23:49 <thoughtpolice> erisco: "Bit vector unsigned less than"
23:49 <erisco> thanks
23:54 YongJoon joined
23:56 magnusgbr joined
23:57 <thoughtpolice> erisco: I was going to try to link to some reference on those internals but apparently that does not exist outside the C++ code in Z3 :)
23:57 <thoughtpolice> Well, defined functions in z3's smtlib environment, I mean