<     May 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 24 25 26 27  
28 29 30 31
00:01 fragamus joined
00:03 <lyxia> :t \a -> preview (_1 . _1 . _1) a -- more dots look more point free
00:03 <lambdabot> (Field1 a b b2 b2, Field1 a1 b1 a b, Field1 s s a1 b1) => s -> Maybe b2
00:03 infinity0_ joined
00:03 infinity0 joined
00:04 Bruno joined
00:04 sleffy joined
00:04 wroathe joined
00:04 davr0s joined
00:05 araujo joined
00:06 infinity0 joined
00:07 ContessaTP joined
00:07 <muyfine> oh nice!
00:07 <muyfine> thanks lyxia !!!
00:08 <lyxia> don't forget to eta-reduce
00:08 infinity0 joined
00:09 <Guest38510> Hi, is there a type class that is like a functor, but for higher kinded type? Like this `(m a -> n a) -> f m a -> f n a`
00:09 <lyxia> https://hackage.haskell.org/package/mmorph-1.1.0/docs/Control-Monad-Morph.html
00:09 aplund joined
00:10 jbiesnecker joined
00:10 halogenandtoast joined
00:10 plutoniix joined
00:11 infinity0 joined
00:11 Jesin joined
00:11 <Guest38510> thanks! Why is 'm' a monad and not 'n' in the hoist function?
00:13 <c_wraith> Guest38510: That's an excellent question. I can't see a single reason for m to have that constraint
00:14 <Clint> :t hoist
00:14 <lambdabot> error: Variable not in scope: hoist
00:14 <* Clint> sniffs.
00:14 infinity0 joined
00:14 <lyxia> The package is about monad morphisms
00:14 wroathe joined
00:15 lamduh joined
00:15 <c_wraith> Oh, I can see one reason for it. If they discovered most instances require m to be a monad, you either put that constraint on hoist, or you have to make it a MPTC
00:16 <c_wraith> because there's no way to add constraints to m with the existing class definition
00:16 <Guest38510> mptc?
00:16 <andromeda-galaxy> multi parameter type class
00:17 acarrico joined
00:17 infinity0 joined
00:19 <Guest38510> yeah that make sense, thanks! :)
00:19 Gurkenglas joined
00:20 nnplv joined
00:20 thmannnnn joined
00:20 sproingie joined
00:20 sproingie joined
00:20 adwin_ joined
00:22 path[l] joined
00:24 <EvanR> Sonolin: would be even nicer if kinds didnt exist!
00:24 <EvanR> and it was just more Types
00:24 <thmannnnn> How can I represent types in template haskell? For instance runQ [d| data X = X { f1 :: String }|] gives me [DataD [] X_0 [] Nothing [RecC X_1 [(f1_2,Bang NoSourceUnpackedness NoSourceStrictness,ConT GHC.Base.String)]] []] How do I represent GHC.Base.String in my TH code?
00:26 halogenandtoast joined
00:27 <thmannnnn> I essentially want to be able to generate a record with different names/types. I'm stuck on how to represent the type. I tried putting GHC.Base.String there but it didn't work
00:27 <Sonolin> EvanR that... would work well with the burrito analogy ;)
00:28 <EvanR> grothendieck burritos
00:30 <Cale> thmannnnn: ''String
00:30 <thang1> aka the grothendieck double prime type
00:30 <Cale> lol
00:31 <ski> c_wraith : looks like no instance in there requires anything of `m'
00:31 <c_wraith> ski: well then, it's a mystery.
00:32 cp__ joined
00:32 <Cale> thmannnnn: See https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#th-syntax
00:32 <Cale> If you scroll down a little from there, you'll see all the various sorts of quotation that TH supports.
00:33 <ski> .. apparently `embed' has a `Monad' constraint on `n' instead .. which is actually used by instances there, thought `Functor' would be enough
00:35 nnplv joined
00:35 saurabhnanda joined
00:45 wroathe joined
00:45 sillyotter joined
00:45 juanpaucar joined
00:45 Rotaerk joined
00:46 mizu_no_oto joined
00:48 dihuteno joined
00:48 andyhuzhill joined
00:49 mjora7 joined
00:49 n_blownapart joined
00:52 eschnett joined
00:53 <thmannnnn> Cale: Thanks!
00:54 huza joined
00:54 joco42 joined
00:59 seliopou joined
01:02 hybrid joined
01:03 <* hackage> sbp 2.2.3 - SwiftNav's SBP Library https://hackage.haskell.org/package/sbp-2.2.3 (markfine)
01:04 conal joined
01:04 dfeuer joined
01:04 |sync| joined
01:05 geekosaur joined
01:05 wroathe joined
01:07 erisco joined
01:08 juanpaucar joined
01:08 drewbert joined
01:08 <Lokathor> Map Char [V2 GLfloat]
01:09 <Lokathor> this should be a map from Char to 6-tuple, but writing out a 6-tuple's type is just horrible
01:09 <Lokathor> alas
01:09 andyhuzhill joined
01:09 <spoonm> hey, I'm using what little I know of haskell to write a few things, can you tell me what cool features I'm missing on here? http://ix.io/v54
01:10 <spoonm> by that I mean "what's not there that I could've used to simplify/optimize my job?", I want to learn more
01:10 <Lokathor> spoonm, for not knowing much about Haskell, you sure seem to have got yourself quite the fancy code bit
01:11 <Lokathor> if you would like, "mod a b" can be rewritten as "a `mod` b" using backticks like that to have it be infix. Some of the time it reads better that way
01:11 <spoonm> Lokathor: lol really? I read maybe 4 pages or so of "learn you a haskell for great good" long ago
01:11 <spoonm> any other contact with haskell is due to configuring/extending xmonad, which I've been told usually results in very ugly, improper haskell
01:12 <Lokathor> I'm not sure what improper haskell is, but if you're not using unsafePerformIO or unsafeCoerce you're probably okay
01:12 andyhuzhill joined
01:13 <spoonm> well, xmonad config examples include a lot of $, and the same people who told me that really dislike do blocks
01:13 erikd joined
01:13 <spoonm> as to `mod`: I was using it that way, but I wanted to save two columns to keep myself from going over the 80 limit, which I wound up doing anyways
01:15 <Lokathor> I like to stay under 80 for comments, which my editor re-wraps for me, and for code itself I drift out to 100 or so as needs demand
01:15 primal joined
01:16 <Lokathor> putStrLn $ "WARNING: Requested: " ++ show (fbWidth,fbHeight) ++ ", Actual:" ++ show (fbx,fby))
01:16 <spoonm> I try to stay under 80 everywhere, I think it helps make things simple
01:16 <Lokathor> not really a good way to break up that putStrLn I think
01:16 <spoonm> :(
01:17 cdg joined
01:17 epsilonhalbe joined
01:17 <Lokathor> you could do it after the second ++, if you really wanted to
01:18 <Lokathor> I've got a widescreen monitor, and a standard definition monitor. Even on the SD monitor my editor has over 100 columns in it with the sidebar open and everything
01:18 andyhuzhill joined
01:19 <spoonm> yeah, I'd probably do something like Python: http://ix.io/v59
01:19 <spoonm> granted in a 8print() call that's not how it'd be done lol
01:19 <spoonm> but in case I needed to do string concat elsewhere, that's probably how I'd go about it if 8str.format() was awkward
01:20 <Lokathor> oddly, i was lamenting the lack of a python2 style print ability in Haskell just earlier today
01:20 <drewbert> python's print is sooooooo nice
01:21 <spoonm> as in 8print a b c ... calling 8show for all arguments or...?
01:21 <spoonm> drewbert: it is!
01:21 alexknvl joined
01:21 <Lokathor> spoonm, yeah something like that. One catch: the show instance for String isn't actually helpful at printing out a string, because it's not identity
01:21 <spoonm> speaking of which, I think I looked this up when I was reading that haskell book, but are there variadic functions in Haskell?
01:21 <Lokathor> instead, it's what you'd type into a Haskell file to get that string value, which means that it has " around it and escapse " within it and so on
01:22 <Lokathor> spoonm, there are not as far as I've ever heard
01:22 <Lokathor> though, with enough GHC extensions i'm sure anything might be possible
01:23 lambdamu_ joined
01:23 <ski> spoonm : if i wanted to conserve horizontal space, i'd pull back the definitions under `where' to the same column as it, possibly change the `where' into being indented only two spaces, possibly define a `divides' function to avoid repeating the `== 0' part. then perhaps pull the list comprehension down to (two spaced indented) on the next line
01:23 <spoonm> I imagined it'd be one of the first things to pop up, but I come from very imperative C, I wouldn't dare dabble with functional programming purity or anything
01:23 <alexknvl> Can someone explain how liftControl works to me? I am trying to implement MonadControlIO for ReaderT manually
01:23 <alexknvl> And failing
01:23 <Lokathor> Haskell would be better if there was some sort of quasiquoter that could take a list and python print them, but I haven't the foggiest how one would write that. Perhaps someday
01:23 <spoonm> ski: I was thinking of renaming 8tuples, too, but dunno, it looks ok
01:24 <spoonm> but hey, thanks, I'll do that
01:24 <Lokathor> spoonm, in fact, you can even put the where on the same line
01:24 <* ski> often tries to keep pages at most sixtysix lines, preferably more than forty lines
01:25 <Lokathor> main = mapM_ print tuples where
01:25 <spoonm> that's a thing? I didn't know
01:25 wroathe joined
01:25 <Lokathor> where is a keyword so it won't be eaten up as an expression argument
01:25 <ski> spoonm : you could also give a name to `spacing + iborder + border' in the list comprehension, using `let'
01:26 cdg joined
01:26 kaychaks joined
01:27 <* ski> personally prefers `where' on a separate line, occasionally continuing the remainder on the rest of the same line, if it's only one line
01:27 vaibhavsagar joined
01:27 <spoonm> ski: oh, initially I thought I could use the where to bind `fwid - 2*hgap' to `uwid', but I realized it doesn't "see the inside" of the list comprehension
01:27 <spoonm> didn't know how `let' could work in the list comprehension
01:28 <ski> @undo [() | let]
01:28 <lambdabot> let { } in [()]
01:29 <spoonm> I'll be back in a bit, hopefully making you proud
01:29 chao-tic joined
01:29 jbiesnecker joined
01:29 <Lokathor> so if i want to have String errors, is "instance Exception [Char]" considered kosher? or should i just use error? or should i really really make my own error type and use throwIO with it?
01:30 <Lokathor> note: in this situation the error case is 99% likely to be unrecoverable from within the program anyway, without the user making a change to their system and trying it again
01:30 <ski> spoonm : you can kludge variadics with type classes .. `printf' uses that. it's not that pretty, though
01:31 sleffy joined
01:31 <ski> i think there's one or two other ways to (at least sometimes) do it, as well. involving using polymorphic combinators of some sort, and possibly (internally) continuations
01:31 <EvanR> Lokathor: make your own error type, its not that hard
01:31 <* ski> doesn't recall details offhand
01:32 <lyxia> spoonm: http://lpaste.net/355846 shorter and less readable!
01:32 <EvanR> Lokathor: instance Exception String probably doesnt work without extensions and would be bad form i say
01:32 <Lokathor> EvanR, oh alright, but it's only going on the TODOs
01:33 <EvanR> data LokathorsError = LokathorsError String deriving (Show,Typeable); instance Exception LokatheorsError; myError = LokathorsError
01:33 <EvanR> but spelled right
01:33 <Lokathor> what's that last line?
01:34 <EvanR> the equivalent of userError
01:34 <EvanR> but you dont really need it
01:34 ghbr joined
01:34 darjeeli1 joined
01:35 <EvanR> :t userError
01:35 <lambdabot> String -> IOError
01:35 <ski> spoonm : oh, it's also possible to say `(fwid,fhei) = (1920,1080)' and `(cwid,chei) = (7,14)', should you prefer that
01:35 juanpaucar joined
01:35 <EvanR> throwIO . userError is also an option but the name is horrible
01:35 <EvanR> if a user saw "User Error..." they would probably resent it!
01:36 wroathe joined
01:37 <ski> Lokathor,spoonm : sometimes i go like `(putStrLn . concat) ["WARNING: Requested: ",show (fbWidth,fbHeight),", Actual:",show (fbx,fby)]'
01:38 <ski> spoonm : using `printf' :
01:38 <ski> > let (fbWidth,fbHeight) = (80,25); (fbx,fby) = (8,40) in printf "WARNING: Requested: (%d,%d), Actual:(%d,%d)" fbWidth fbHeight fbx fby :: String
01:38 flatmap13 joined
01:38 <lambdabot> "WARNING: Requested: (80,25), Actual:(8,40)"
01:39 <ski> (you could use `IO ()' instead, to have it automatically output to `stdout'. most commonly (but not in interactive queries like this), the context would determine the return type, so that the type ascription wouldn't be needed)
01:40 <Lokathor> printf might ease my senses a bit I suppose
01:41 louispan joined
01:43 renzhi joined
01:43 jship joined
01:45 louispan joined
01:45 <* ski> isn't that fond of `printf'. would often rather name each "spliced" expression, and put it "inline" with `++' or `concat'
01:45 <ski> ("string interpolation" aka quasi-quotation would be acceptable as well)
01:46 <* hackage> versions 3.0.2 - Types and parsers for software version numbers. https://hackage.haskell.org/package/versions-3.0.2 (fosskers)
01:46 <Lokathor> well within the greater function it looks like this https://gist.github.com/Lokathor/d69260f765a2bc735802b6771960fb75
01:48 conal joined
01:48 systadmin joined
01:51 <andromeda-galaxy> ski: re polyvariadics, are you thinking of anything other than oleg's set of techniques (http://okmij.org/ftp/Haskell/polyvariadic.html)? I think those are all typeclass based, if you know non-typeclass-based ones I'd be interested in that...
01:52 codygman joined
01:52 louispan joined
01:53 coltfred joined
01:53 <spoonm> I thought the lack of parentheses was the problem, but ghc is asking me if I "intended to use TemplateHaskell", what am I doing wrong with `$'? http://ix.io/v5l
01:53 <spoonm> (@@ is meant to work like default divides notation, a | b => a divides b)
01:54 meba joined
01:54 <lyxia> you can't mix infix operators like this
01:54 <andromeda-galaxy> spoonm: dollars is an infix operator, you can't mix it with another
01:54 erikd joined
01:54 <andromeda-galaxy> $() is also the syntax for TH splices, so ghc assumes that $ = TH whenever the operator doesn't parse right
01:54 <ski> andromeda-galaxy : i think there was something that was used in O'Caml ?
01:55 <lyxia> you can set the precedence of your custom operator
01:55 <spoonm> oj
01:55 <spoonm> oh*, thanks andromeda-galaxy
01:55 <andromeda-galaxy> like lyxia said, the precedence setting is probably the way to do this
01:55 <andromeda-galaxy> np
01:55 <spoonm> really? that's a thing? how do I do it?
01:56 <andromeda-galaxy> infixr <levuel> opp
01:56 <andromeda-galaxy> *op
01:56 <ski> d `divides` n = mod n d == 0 -- how i'd probably define it, spoonm
01:56 wroathe joined
01:56 <ski> or using n `mod` d in there
01:56 jleon joined
01:56 anodium joined
01:57 <andromeda-galaxy> spoonm: http://zvon.org/other/haskell/Outputsyntax/fixityQdeclaration_reference.html
01:58 <ski> infix 5 `divides`,@@
02:00 <andromeda-galaxy> ski: pointfree! ((.).(.)) (==0) mod
02:00 hucksy_ joined
02:00 <andromeda-galaxy> (also am I the only one that wishes that you could put arbitrary exprs inside backticks?)
02:00 <MarcelineVQ> andromeda-galaxy: nay
02:01 cschneid_ joined
02:01 <andromeda-galaxy> MarcelineVQ: on which?
02:02 <MarcelineVQ> the latest
02:02 Scip joined
02:04 louispan joined
02:04 <andromeda-galaxy> hmm, I guess there is https://wiki.haskell.org/Infix_expressions at least
02:05 <clamchowder> help: ghci complains "fail to load Data.List.Split" - what shall I do?
02:05 <lyxia> install split
02:07 <clamchowder> lyxia: thanks that works
02:07 systadmi1 joined
02:07 Sgeo joined
02:07 <erisco> seemed strange to me why you couldn't use arbitrary expressions in backticks
02:08 <erisco> there is an awkwardness with nested backticks though
02:08 <andromeda-galaxy> hm, you can just require that if there are nested backtics, they are inside parentheses
02:09 <andromeda-galaxy> that way it's readable for the vast majority of cases and also unambiguous
02:10 <Lokathor> so, will a Vector.Storable of lists store all the values directly in line? or since it's a list you just get the heads of the lists in line?
02:11 <Lokathor> oh i take it all back
02:12 machinedgod joined
02:12 <Lokathor> i guess list isn't storable so you can't /actually/ put a list into a Vector.Storable, even though you can declare a vector of such a t ype
02:12 amiri joined
02:13 <clamchowder> how does "a $ b <$> c <$> d" resolve? is it a $ (b <$> (c <$> d))?
02:13 <andromeda-galaxy> @t \a b c d -> a $ b <$> c <$> d
02:13 <lambdabot> Maybe you meant: tell thank you thanks thesaurus thx tic-tac-toe ticker time todo todo-add todo-delete type v @ ? .
02:13 <andromeda-galaxy> :t \a b c d -> a $ b <$> c <$> d
02:13 <lambdabot> Functor f => (f b -> t) -> (a1 -> b) -> (a -> a1) -> f a -> t
02:14 <Lokathor> infixl 4 <$>
02:14 <andromeda-galaxy> a $ (b <$> (c <$> d)) yes
02:14 WhiskyRyan joined
02:14 <andromeda-galaxy> clamchowder: ^
02:14 <clamchowder> andromeda-galaxy: thanks.
02:16 flatmap13 joined
02:16 wroathe joined
02:18 <andromeda-galaxy> clamchowder, Lokathor: wait no I'm confused. the types make me think tha it is doing b <$> (c <$> d) but infixl should parse as (b <$> c) <$> d, right?
02:19 <andromeda-galaxy> *now I'm confused
02:19 <Lokathor> and (,,,) aren't storable either :/
02:20 mac10688 joined
02:22 <lyxia> that's odd
02:22 tromp joined
02:22 louispan joined
02:23 <andromeda-galaxy> clamchowder: oops I may have gotten that backwards wrt the <$> sorry, hang on one sec
02:23 <lyxia> <$> is associative
02:23 <andromeda-galaxy> oh if it is parsed as (a <$> b) <$> c then that fmaps the a argument over the -> in b so it composes them.
02:23 drewbert joined
02:24 cretiq joined
02:24 <andromeda-galaxy> so a <$> b <$> c = (a <$> b) <$> c = (a . b) <$> c?
02:24 <c_wraith> All the applicative-oriented operators seem to be infixl 4
02:24 erikd joined
02:25 Goplat joined
02:25 <Lokathor> ah, but my good wraith, <$> is clearly Functor oriented, entirely different rules might apply :P
02:25 <andromeda-galaxy> Lokathor: but the infix declaration is indeed infixl 4
02:25 <andromeda-galaxy> :i <$>
02:25 <lyxia> Lokathor: https://hackage.haskell.org/package/storable-tuple
02:26 <Lokathor> i know I'm the one who said that
02:26 <andromeda-galaxy> oh does lambdabot not do info?
02:26 <andromeda-galaxy> oops nvm, sorry
02:26 <Lokathor> :3c
02:26 <Lokathor> lyxia, ho! mia diino!
02:26 sellout- joined
02:27 <MarcelineVQ> mia hoomon, grr
02:27 filterfish joined
02:27 <Lokathor> lyxia, so do I have to call storeQuadruple?
02:27 <Lokathor> or do I just import the module and it'll find the instance?
02:28 <lyxia> Lokathor: there are instances yes
02:29 wroathe joined
02:32 jle` joined
02:32 jle` joined
02:32 <clamchowder> andromeda-galaxy: sorry I left. I think I'll just do brackets for now
02:33 <ski> andromeda-galaxy : .. or `((0 ==) .) . mod', aka `(0 ==) .: mod' :)
02:34 rullie joined
02:35 LHoT10820 joined
02:35 juanpaucar joined
02:35 pavonia joined
02:35 <spoonm> ski: I was gonna do `divides`, but I thought it'd look best if I used `a | b', like real maths, but sadly | is reserved for other things
02:35 peterbecich joined
02:36 j-em joined
02:36 Costar joined
02:36 <lyxia> real maths also knows to use words
02:38 <Rotaerk> I'm always disappointed when my haskell code compiles and doesn't run correctly
02:38 <Rotaerk> with C# I'm pleasantly surprised when it does...
02:38 <andromeda-galaxy> ski: ah yes, I always forget the right way to infix that
02:38 <ski> lyxia : not that often .. considering
02:39 <ski> (i intended `.:' to have the same number of dots as `(.) . (.)', and have the same number of characters as is "passed on" to the right operand)
02:40 <clamchowder> is there a variant of foldl that use the head of the list as the base and iterate over the tail of the list?
02:40 brynedwardz joined
02:40 <lyxia> foldl1
02:41 <andromeda-galaxy> (.: isn't Prelude-ified though, unfortunately)
02:41 <MarcelineVQ> I'm okay with Prelude not being jammed up withe every tool in the box
02:41 Koterpillar joined
02:42 <clamchowder> lyxia: thanks.
02:42 <EvanR> im not id like exactly each tool i use to be in prelude! ;)
02:43 <MarcelineVQ> :> I admit that's a bit of hyperbole, .: isn't a rare thing to need
02:43 <EvanR> <> :(
02:43 <EvanR> when, forever,
02:43 <dmwit> :t \f g x -> f <$> g <$> x
02:43 <lambdabot> Functor f => (a1 -> b) -> (a -> a1) -> f a -> f b
02:43 <j-em> Hello - I'm trying to use interface with git from haskell with this lib https://hackage.haskell.org/package/gitlib-3.1.1/docs/Git-Types.html but i'm having a bit of a hard time figuring how to use it. Any pointers ?
02:43 <dmwit> Ah, the second `(<$>)` forces the first one's `Functor` to be `(a->)`.
02:44 <dmwit> j-em: Did you look at the included tutorial?
02:44 erikd joined
02:44 <j-em> dmwit: it is unfortunately out of date
02:44 <dmwit> Okay, bummer.
02:44 <j-em> there are multiple references to functions that doesn't exist anymore
02:45 <j-em> Pretty sure the only docs are the types
02:45 <Lokathor> I'm not even clear when I'd use .:
02:45 <dmwit> I suspect if you spend 5-10 minutes with this library, you will be more expert with it than most others in the channel.
02:45 spacecadetbrown joined
02:45 <ski> (.. and ditto for `(.::) = (.) . (.) . (.)', &c.)
02:45 mikecaruso joined
02:46 <dmwit> j-em: Except, perhaps, for johnw. ;-)
02:46 <EvanR> Lokathor: unless you want to frighten small children and people who are on the fence about haskell syntax... never
02:46 <ski> Lokathor : when you'd otherwise use `(f .) . g' ?
02:46 <* ski> smiles at EvanR
02:46 exferenceBot joined
02:47 <Lokathor> concat $ map (\(a,b) -> [a,b]) $ zip first second
02:47 louispan joined
02:47 <Lokathor> this was already too much for my non-haskeller friends to deal with
02:47 <EvanR> yeesh
02:47 <EvanR> too much $
02:47 <dmwit> :t zipWithM
02:47 <lambdabot> Applicative m => (a -> b -> m c) -> [a] -> [b] -> m [c]
02:47 <jle`> dmwit: you could say that <$> is commutative
02:48 <jle`> er
02:48 <dmwit> Lokathor: zipWithM (\a b -> [a,b]) first second -- so much clearer ;-)
02:48 <jle`> associative
02:48 <jle`> (f <$> g) <$> x = f <$> (g <$> x)
02:48 <EvanR> (concat . map (\...) . zip first) second ;)
02:48 verement joined
02:48 <dmwit> jle`: Yeah, assuming law-abiding instances. Neat!
02:48 <Lokathor> dmwit, but try to explain that version to a beginner who doesn't know Haskell :P
02:48 <jle`> dmwit: don't even have to assume that :o
02:48 <EvanR> also concatMap at least
02:49 <lyxia> > zipWithM (\a b -> [a, b]) [1,2,3] [4,5]
02:49 <lambdabot> [[1,2],[1,5],[4,2],[4,5]]
02:49 <dmwit> jle`: I think you do. You have to assume `f <$> (g <$> x) = (f . g) <$> x`, which is a Functor law.
02:49 <Lokathor> ew no that's not the right result
02:49 <jle`> that wasn't what i meant
02:49 <jle`> i meant f <$> (g <$> x) = (f <$> g) <$> x
02:49 <jle`> hehe
02:49 tristanp joined
02:50 <Lokathor> > (\first second -> concat $ map (\(a,b) -> [a,b]) $ zip first second) [1,2,3] [4,5,6]
02:50 <jle`> oh i suppose you do need to assume it
02:50 <lambdabot> [1,4,2,5,3,6]
02:50 <jle`> darn
02:50 <dmwit> jle`: I agree that `(f <$> g) <$> x = (f . g) <$> x` without any laws. But I don't agree that `(f <$> g) <$> x = f <$> (g <$> x)` without laws.
02:50 <jle`> i see the flaw in my reasoning
02:50 <dmwit> Lokathor: Yes, I introduced a bug. =(
02:50 afarmer joined
02:51 chao-tic joined
02:51 khumba joined
02:51 hexagoxel joined
02:51 <lyxia> Lokathor: map ... $ zip is zipWith ...
02:51 ghbr left
02:51 <j-em> dmwit: I tried understanding by only reading the types and playing with it in a REPL, without much success. :-(
02:52 <dmwit> > concat $ transpose [[1,2,3],[4,5]] -- in case you don't care about the behavior when the list sizes don't match
02:52 <lambdabot> [1,4,2,5,3]
02:52 <* dmwit> lobbies for list sections: `[,] 4 5 == [4,5]`
02:53 <Lokathor> sure, sure to everyone, but the very first version was this http://lpaste.net/355851 :P
02:53 <MarcelineVQ> :t \first second -> [[x,y] | x <- first | y <- second]
02:53 <lambdabot> [t] -> [t] -> [[t]]
02:53 <Lokathor> and then going from that to actual combinators while simultaneoutly explaining every bit of syntax and operation involved doesn't lead to the most combinator'd code
02:53 <MarcelineVQ> I wish I had more uses for parlistcomps, they look neat
02:53 <dmwit> Lokathor: Oh, then `concat . transpose` is a more faithful translation than your `zip`y one, since yours sometimes throws elements away.
02:53 darlan joined
02:54 <duckqlz> ((.)$(.)) (==) 1 (1+) 0
02:54 <Lokathor> throwing elements away was actually a bug :/
02:54 <dmwit> Do you mean "not throwing elements away was actually a bug"?
02:55 <dmwit> ...or are you agreeing with me?
02:55 jbiesnecker joined
02:55 <Lokathor> i didn't want it to throw elements away
02:56 <Lokathor> when i made a version using zip, it did, and that's the bug
02:56 <dmwit> Right.
02:56 wroathe joined
02:56 sleffy joined
02:57 <spoonm> here http://ix.io/v5F
02:57 <spoonm> hope you're proud
02:58 halogenandtoast joined
02:58 <spoonm> couldn't get `infixr 5 `divides`' to work with `$', but hey, looks cool this way
02:58 juanpaucar joined
02:59 <lyxia> spoonm: these `divides` conditions can actually be simplified
03:00 <spoonm> lyxia: how?
03:00 <spoonm> oh, lemme do the tuple thing too
03:00 <ski> spoonm : with the `infix' declaration i suggested, you don't need the four pair of brackets there
03:00 <lyxia> cwid `divides` gaps
03:00 <lyxia> instead of any one of the two cwid
03:00 <ski> spoonm : also, did you see my suggestion about `(fwid,fhei)' ?
03:01 <spoonm> ski: yeah, that's what I'm gonna do right now
03:01 <spoonm> got distracted, ate dinner and all
03:01 <ski> (no need to use `$' here, anywhere that i can see)
03:01 <ski> no worry
03:01 <lyxia> cwid `divides` uwid, cwid `divides` 2 * gaps
03:02 <spoonm> lyxia: are you implying if `a | b - c', `a | b' and `a | c'?
03:03 <ski> lyxia : i don't think that's equivalent
03:03 <spoonm> ^
03:03 <andromeda-galaxy> lyxia: definitely false. 2 | (5 - 1) but ! 2 | 5 or 2 | 1
03:03 <spoonm> it isn't, 3 `divides` (8 - 2), but you can't distribute it
03:04 <lyxia> If `a | b - c` and `a | b - 2 * c` ...
03:05 <ski> hm, ok, then `a | c', and so `a | b'. you're right
03:05 <spoonm> o
03:05 <andromeda-galaxy> or ight
03:06 <andromeda-galaxy> *o right
03:06 <* lyxia> takes a cookie.
03:06 <spoonm> I did not see that
03:06 <andromeda-galaxy> sorry
03:06 <lyxia> you can also abuse the fact that cwid happens to be odd
03:06 <spoonm> 10/10 lyxia, you're my favorite person right now
03:06 <spoonm> oh, I'll be changing that around
03:07 ghbr joined
03:07 <ski> lyxia : yeah, but i'd suspect that's more of an accident that might change
03:09 buoto joined
03:09 <spoonm> http://ix.io/v5L how is it now?
03:10 felixsch1 joined
03:10 <spoonm> wondering if at this point `let' is actually needed to make it cleaner looking
03:11 <* ski> is still not happy with the brackets around `2*gaps', which requires an `infix' declaration on `divides' to get rid of
03:11 <lyxia> you still need chei `divides` (2 * gap)
03:11 <ski> spoonm : instead of those three `let's, you can have just one, containing your three (local) definitions (obviously aligned properly with each other)
03:12 <spoonm> ski: I'm not happy either, but what do you mean by `infix' declaration? do I have to change it to `(`divides`)' or...?
03:12 <ski> add
03:12 <spoonm> lyxia: oh, true, didn't see that, thanks
03:12 <ski> infix 5 `divides`
03:12 <ski> on the top-level of the file
03:12 <spoonm> ski: I thought it was infixr
03:12 <spoonm> lemme try that
03:12 <lyxia> I'd put 2 or 3
03:12 <ski> i see no reason to make `divides' `infixr'
03:13 <plugin> I have some code that crashes at runtime with: printf: argument list ended prematurely. I think it has to do with a storeable-vector's withStartPtr call but I'm not sure how to proceed debugging. does anyone have any advice? gist is here: https://gist.github.com/o1lo01ol1o/6744a18c973407facb11aa3f121373d4
03:13 <lyxia> oh + is at 6
03:13 <lyxia> nvm
03:13 <ski> you're not going to type d0 `divides` d1 `divides` n anyway, that's a type error
03:13 <EvanR> similar to a < b < c
03:13 <ski> `||' is at `2', and `&&' at `3'. i think it makes sense to have it above those
03:13 <spoonm> ski: remind me how let would work, do I need {}?
03:14 <ski> spoonm : you don't (but you can, if you really want to)
03:14 erikd joined
03:14 <spoonm> o w8, I see it now, I think
03:14 <ski> just align the starts of the individual definitions inside the single `let'
03:15 <spoonm> check this baby out http://ix.io/v5M
03:15 <ski> if you really wanted to put the definitions on the same line, you'd have to separate them by `;'s
03:15 <codygman> I have a template Haskell error and can't figure out what to do, "Expected type: [VarBangTypeQ]; Actual type: Q VarBangTypeQ": https://pastebin.com/wxzEibgN I don't know how to make a function of type (Q VarBangTypeQ) -> [VarBangTypeQ]
03:17 jbiesnecker joined
03:17 ortmage joined
03:17 <ski> spoonm : personally, i often prefer aligning the `]' in the same column as the `[' (especially if i might be expected to move around, or add or remove lines inside). but if you think the `]' on a separate line would look lonely here, feel free to ignore this
03:17 codygman_ joined
03:17 xinming joined
03:17 mantovani joined
03:17 <ski> this is obviously style and personal taste
03:18 <spoonm> ski: I was thinking the same thing, I still don't know what I like the mos
03:18 shapr joined
03:18 <spoonm> t
03:18 <ski> (another such matter is that i prefer `Integral a =>' over `(Integral a) =>')
03:18 <lyxia> plugin: try enabling stack traces, see 1.1 https://wiki.haskell.org/Debugging
03:18 turnage joined
03:18 brailsmt joined
03:18 <codygman_> Leaving on my main account, but still here I'm secondary if anyone has an answer for my TH problem
03:19 <spoonm> ski: I wasn't sure leaving the parentheses would work, but I agree with that
03:19 <ski> (and ditto for `deriving' clauses with only a single type class, fwiw)
03:19 <glguy> codygman_: {-# LANGUAGE TemplateHaskell, QuasiQuotes #-}
03:19 <ski> (you need the brackets, when you have multiple constraints/classes, obviously)
03:19 <glguy> https://paste.fedoraproject.org/paste/PozZfPgicgZ1Qni9DWP33V5M1UNdIGYhyRLivL9gydE=
03:20 <spoonm> ski: ok, that I couldn't follow, what is this "deriving" clause?
03:20 <spoonm> do you mean instead I could use idk, Integral -> Integral -> Bool?
03:20 aaaasdfsadfdsaf joined
03:20 <glguy> codygman_: and you probably don't want to use newName for the field name, mkName would be better
03:21 <ski> it's when you're making `data' or `newtype' declarations, for defining a new data type. `deriving' allows you to automatically get an implementation for a few fixed type classes (like `Eq',`Ord',`Show',`Read' and a couple more)
03:21 Destol joined
03:22 <ski> spoonm : no, `Integral -> ...' is a type error. `Integral' is a type class, not a concrete type
03:22 renzhi joined
03:22 MJ joined
03:22 <spoonm> huh
03:23 <spoonm> ski: I thought you meant I had those in my file
03:23 <spoonm> gonna have to read up on that later :/
03:23 <codygman_> glguy: thanks! Hm *looks up difference between newName and mkName*
03:23 gestone joined
03:23 ertesx joined
03:24 eklavya joined
03:25 juanpaucar joined
03:25 systemfault joined
03:25 <ski> (what you had in mind was probably something like `(exists a. Integral a *> a) -> (exists a. Integral a *> a) -> Bool' / `forall a b. (Integral a *> a) -> (Integral b *> b) -> Bool' / `forall a b. (Integral a,Integral b) => a -> b -> Bool' .. or perhaps even `forall a. Integral a => a -> a -> Bool' .. but `exists' and `*>' doesn't exist in GHC)
03:26 <ski> spoonm : nah, sorry. just a related pet peeve :)
03:26 <spoonm> is it bad I only understood loose words?
03:27 <spoonm> ski: I have a question, and you might suggest I use monads or something else I don't understand yet, but hear me out
03:27 conal joined
03:28 wroathe joined
03:28 <spoonm> `divides` shouldn't accept a null first argument, but I think `mod' already handles that
03:28 <spoonm> suppose it didn't, how could I go about restricting the first argument to non-null integrals? is there a typeclass for it? do I have to do something like Maybe or whatever?
03:29 <ski> (only understood loose words from what ? my last comment involving `exists' and `forall' probably is beyond you at the moment. presumably, without you learning a bit more about polymorphism and type classes, it would be hard for me to explain it. you can safely ignore it at this point)
03:29 <spoonm> (yeah, that's what I'll do ;-;)
03:30 <ski> what do you mean by "a null first argument" ?
03:30 <ski> and by "non-null integrals" ?
03:31 <spoonm> 0
03:31 <Lokathor> https://gist.github.com/Lokathor/e8af714d48da6bbe80307ac8727eb7c1 I have created a thing that I believe to be a rather clean way of building up some texture info
03:32 <dmwit> spoonm: Haskell doesn't really have a good way to do that. See also https://stackoverflow.com/q/44068734/791604
03:32 andyhuzhill joined
03:32 <dmwit> (and the linked questions, as well; each adds a fun detail that the others miss, I think)
03:32 uglyfigurine joined
03:33 <ski> > let infix 5 `divides`; d `divides` n = n `mod` d == 0 in 0 `divides` 5 -- unfortunately, at this point, n `mod` 0 aborts, rather than evaluating to `n', which i think would be the sensible choice
03:33 <lambdabot> *Exception: divide by zero
03:34 <ski> if this choice was taken, then 0 `divides` n would hold exactly when `n' is zero
03:34 SeMas joined
03:34 codygman joined
03:34 <spoonm> huh
03:34 <dmwit> However, doing this correctly in `divides` should be easy.
03:35 <dmwit> Just add clauses `divides 0 0 = True; divides 0 n = False`
03:35 <dmwit> or, like, `divides 0 n = n == 0` if you're feeling fancy
03:35 <ski> so, from this point of view, i'd prefer it if `divides' accepts zero as left operand as well
03:36 <ski> spoonm : but to answer your question, no there's no easy and nice way to express the type consisting of all the values in type, say `Integer', *except* `0'
03:36 <spoonm> dmwit: oh, I wasn't talking about actually returning something, but restricting it so that calls to `0 `divides` n' would error out, but of course, I know `mod' already handles it, I just wanted to know how without actually dividing by zero
03:36 <spoonm> ski: rip
03:36 <ski> there's something called Liquid Haskell, which has some form of dependent types, which could possibly do it
03:37 <ski> otherwise i think there's no nice way
03:37 <spoonm> rip
03:37 <dmwit> ski: You should read my link, too, so you don't waste time repeating the info that other people have already nicely explained. ;-)
03:37 <spoonm> reading the link dmwit sent
03:37 <ski> partly because if you e.g. subtract a non-zero number from another non-zero number, you could get a zero result
03:37 <ski> so it's hard to keep track of such things, across various arithmetic operations
03:38 <ski> dmwit : huh ? .. which link ? -- oh, the one i completely didn't notice :)
03:43 <ski> spoonm : in *some* cases, it can be worth it to define a new, abstract, data type, that by construction doesn't allow you to make the values that you want to exclude. but it only makes sense to do this when you have a bunch of useful operations which "preserve" (alt. "is closed under") the subset of values you want to consider
03:43 gestone joined
03:43 <EvanR> "type minus" seems to be such a naively obvious thing to posit, but
03:43 <* ski> . o O ( "Subtractive logic", Tristan Crolard )
03:44 saurabhnanda joined
03:45 aarvar joined
03:45 systadmi1 joined
03:45 <EvanR> reading
03:46 jgertm joined
03:49 texasmynsted joined
03:50 Geekingfrog joined
03:50 luis joined
03:50 <ski> "Dual-intuitionistic logic" by Igor Urbas, revisited by Rajeev Gore, is probably also related
03:50 <ski> however, "The Mysteries of Counting: Euler Characteristic versus Homotopy Cardinality" by John Baez in 2005-07-14 at <http://math.ucr.edu/home/baez/counting/> might be closer to what you had in mind
03:51 halogenandtoast joined
03:53 wroathe joined
03:53 ynyounuo joined
03:53 louispan joined
03:54 ericsagnes joined
03:54 meba joined
03:54 ianandrich joined
03:55 Sh4rPEYE joined
03:56 <Sh4rPEYE> Hello. I have several small files and I want to use BasePrelude in them. Can I somehow "wrap them up" in one project with dependencies even though they are standalone?
03:56 <* hackage> haiji 0.2.1.0 - A typed template engine, subset of jinja2 https://hackage.haskell.org/package/haiji-0.2.1.0 (NoriyukiOhkawa)
03:57 jleon joined
03:58 <Lokathor> Sh4rPEYE, that should be possible using a normal project setup. Have you used the stack or cabal programs to manage a project before?
03:59 otto_s_ joined
03:59 <Sh4rPEYE> No. I've been working with small files (-> didn't need a project) and used cabal just to download the packages and use them globally.
03:59 Scip joined
04:00 <Lokathor> ah ha, well if you're already using cabal then "cabal init"
04:00 <Lokathor> it will guide you through the cabal file making process
04:01 erikd joined
04:01 <Lokathor> i think it makes it in the current directory of wherever you are
04:02 <codygman> Can you use Control.Monad.Catch.MonadCatch like you used to be able to use MonadCatchIO with newtype deriving? Attempting to update this library to use exceptions package: https://github.com/the-real-blackh/cassandra-cql/blob/master/Database/Cassandra/CQL.hs#L1874
04:02 <ski> EvanR : there were also two other papers about negative and rational types that i found somewhere, but i can't seem to find them atm. (i have a print-out of them, i think, but not here)
04:04 davr0s joined
04:04 hybrid joined
04:05 <EvanR> mysteries of counting looks wild
04:07 <fresheyeball> how can I write a show instance for this type?
04:07 <fresheyeball> https://zerobin.net/?bc12316ed42e449e#0Mg4UkqFwYgCeJ2JtZTox9c7+VJpXJ6dRqsCNy6ak80=
04:08 <jle`> fresheyeball: are you asking about best practices
04:08 <jle`> or like about how to implement show
04:08 <fresheyeball> jle`: just how to do it
04:09 <fresheyeball> I can't figure out how to get a show for `Sing k`
04:09 <fresheyeball> https://zerobin.net/?76f8519af83e4167#dS5lduzepOTGaMKFkLrNp26IdYcloNejIhT/Vt32AOA=
04:09 <jle`> Sing (a :: k) is a different type for every kind k
04:09 <fresheyeball> jle`: here is more context
04:09 <jle`> k is kind of a misleading variable name here too
04:10 <jle`> doesn't Sing (a :: AreaName) have a Show instance for every a?
04:10 <jle`> if not you can just use fromSing and show the AreaName you get
04:10 cschneid_ joined
04:10 <fresheyeball> jle`: I am still new to singletons
04:10 <fresheyeball> let me try that
04:11 <jle`> but your Sing (a :: AreaName) should have a Show instance, I believe
04:11 <fresheyeball> yeah fromSing works
04:11 path[l] joined
04:11 <fresheyeball> ok
04:11 <fresheyeball> so now I am somewhat confused
04:11 <fresheyeball> what is the difference between `Sing k` and `DemoteRep k`?
04:12 <fresheyeball> I thought `Sing k` was the term level rep, what is DemoteRep then?
04:12 <jle`> careful about using the type variables there
04:12 <jle`> you are talking about Sing (a :: k) and DemoteRep k
04:13 <jle`> you have `SStudy :: Sing 'Study`
04:13 <fresheyeball> hmm ok
04:13 <jle`> SStudy is a term level rep that has the type Sing 'Study, and is the only value with that type
04:13 <jle`> DemoteRep is a type family/associated type
04:13 <fresheyeball> ok
04:13 <fresheyeball> ok
04:14 <fresheyeball> so why can't I show SStudy?
04:14 <jle`> i believe it should have a Show instance
04:14 <fresheyeball> I'm confused about the difference between (a :: k) and k
04:15 <jle`> a is a type variable whose *kind* is k
04:15 <jle`> and k is the kind we are talking about
04:15 <jle`> so you have values of type Sing 'Study
04:15 <jle`> and values of type DemoteRep AreaName
04:16 <jle`> or to use a more interesting example, you have values of type Sing 'True, Sing 'False
04:16 saurabhnanda joined
04:16 <jle`> and you also have values of type DemoteRep Bool. (type DemoteRep Bool = Bool)
04:16 <jle`> so you'd have values of type `Sing (a :: Bool)`, which are STrue :: Sing 'True and SFalse :: Sing 'False
04:17 <fresheyeball> so fromSing
04:17 <fresheyeball> is kind of abstractly
04:17 <jle`> DemoteRep is sort of a "hack" so you can associate the *kind* Bool with the *type* Bool
04:17 <fresheyeball> (s :: k) -> k
04:17 <jle`> fromSing :: Sing 'True -> Bool, and fromSing :: Sing 'False -> Bool
04:17 <fresheyeball> gotcha
04:17 wilkie1 joined
04:17 <fresheyeball> ok
04:17 <fresheyeball> jle`: I think I get it now
04:17 <jle`> in your case it's forall (a :: AreaName). Sing a -> AreaName
04:18 <jle`> Sing 'Study should have a Show instance, but if not, you can write one too pretty simply
04:18 <jle`> by pattern matching
04:18 <jle`> showSingAreaName = \case SStudy -> "SStudy"
04:21 zcourts joined
04:21 n_blownapart joined
04:23 <Lokathor> "oh, i forgot i have a command window open. I wonder what it was doing" *checks* "oh right it's generating the haddock for the entire gl package. whee"
04:23 jbiesnecker joined
04:23 <EvanR> handy
04:24 <n_blownapart> hi I downloaded the haskell-stack package. with stack --version I get correct info. but when I try to run ghci I get "command not found". any help?
04:24 <Lokathor> n_blownapart, you need to run it "through" stack, so 'stack ghci'
04:24 mjora7 joined
04:24 <Lokathor> for ease of switching ghc versions, stack doesn't actually put its ghc into your whole system level stuff
04:25 <n_blownapart> Lokathor, bingo, thanks I'm getting an update now
04:25 <n_blownapart> excellent thanks
04:27 <Lokathor> EvanR, I just wanted to see the docs on my own lib :/
04:27 <EvanR> heh
04:28 <fresheyeball> jle`: can I get the singleton when I only have its kind?
04:28 <EvanR> cabal haddock?
04:29 <Lokathor> EvanR, yeah but my lib depends on gl so now it's building up all that first :P
04:29 <EvanR> didnt know it built deps docs first
04:29 <Lokathor> well
04:29 <Lokathor> stack does
04:29 <Lokathor> not sure if cabal does
04:29 <EvanR> well there you go
04:30 <Lokathor> it finally finished!
04:30 <Lokathor> 83% doc coverage :/
04:31 wroathe joined
04:32 mjora7 joined
04:32 <saurabhnanda> Just broadcasting this here -- https://stackoverflow.com/questions/44193630/how-to-customise-show-read-instances-on-the-lines-of-fromjson-tojson -- yet another place where Haskell's boilerplate is getting in my way of getting the job done. Why can't string literals itself be used as data constructors?!
04:34 <Lokathor> i don't get what you mean by "as data constructors"
04:34 flatmap13 joined
04:35 torei joined
04:36 <Koterpillar> saurabhnanda: implement your own genericShow
04:37 <Koterpillar> as to why it's not already there: Show is generally not used for outside purposes
04:39 lambda-11235 joined
04:40 erikd joined
04:40 DioticDrone joined
04:43 begriffs joined
04:43 <Lokathor> if only base supported both Debug and Display like certain new but rising languages :3
04:43 hybrid joined
04:44 <Koterpillar> err, __repr__ and __str__ ?
04:45 <Rotaerk> hmm is there some way to have a DMap that contains Pipes i o m r where o m and r are fixed, but the tag determines the type for i?
04:45 louispan joined
04:45 <Rotaerk> s/Pipes/instances of Pipe/
04:46 Sh4rPEYE joined
04:46 <Rotaerk> tried doing: type PipeReordered o m r i = Pipe i o m r
04:46 <Rotaerk> and then DMap k (PipeReordered o m r), but it didn't like that...
04:47 Sh4rPEYE joined
04:47 jedws joined
04:48 zcourts joined
04:48 <jle`> fresheyeball: what do you mean?
04:49 zcourts joined
04:52 pookleblinky joined
04:52 sighingnow joined
04:53 CurryWurst_ joined
04:53 uglyfigurine joined
04:55 CurryWurst_ joined
04:55 Sh4rPEYE joined
04:55 zero_byte joined
04:56 path[l] joined
04:59 slackman joined
04:59 <Lokathor> Koterpillar, rust :P
04:59 zcourts joined
05:01 jbiesnecker joined
05:04 eklavya joined
05:04 howdoi joined
05:05 <codygman> Using lens can you delete the first item of a tuple? For maps you can use sans. I want: (0,1) ^? sans _1 -- result: (1)
05:05 Johan_L joined
05:05 <jle`> do you mean using lens
05:06 <jle`> or using the library
05:06 <jle`> *lenses
05:06 <jle`> > (0,1) ^? _2
05:06 <lambdabot> Just 1
05:06 <jle`> > view _2 (0,1)
05:06 <lambdabot> 1
05:07 saurabhnanda joined
05:07 <Koterpillar> codygman: if you want it to work on both (0, 1) and (0, 1, 2), then my guess is not easily
05:07 n_blownapart joined
05:07 <jle`> you could easily write a lens to do individual cases, but doing the general case would probably require a typeclass
05:08 <jle`> which is what the lens library does for _1 and _2
05:10 <glguy> codygman: The various sized tuples are unrelated to each other, so any operation from one to another will be separately specified
05:10 jbiesnecker joined
05:10 <glguy> Beyond that, lenses don't delete structure
05:11 dec0n joined
05:11 leat joined
05:12 kritzcreek joined
05:12 ericsagnes joined
05:13 erikd joined
05:14 <Rotaerk> the reason I want a DMap that contains Pipes is I want something like: split :: (Monad m, GCompare k) => (i -> DSum k Identity) -> DMap k (ReorderedPipe o m r) -> Pipe i o m r
05:14 meandi_2 joined
05:14 <Rotaerk> is there a better way to achieve that?
05:15 <Rotaerk> to have a pipe where the input values are partitioned such that each group of inputs is processed by a different sub-pipe
05:16 <Rotaerk> (the inputs are also mapped to be compatible with their corresponding pipe)
05:16 P1RATEZ joined
05:16 xall joined
05:17 <mikeplus64> anyone want to try write unsafeCoerce with "void" and "bivoid" from http://lpaste.net/355854 . it ought to be possible... right?
05:18 <Rotaerk> hmm I guess it works if I: newtype PipeReordered o m r i = PipeReordered (Pipe i o m r)
05:19 flatmap13 joined
05:19 <Rotaerk> but that's gonna be ugly
05:19 plugin joined
05:20 halogenandtoast joined
05:20 <halogenandtoast> Howdy all.
05:20 davr0s joined
05:22 jbiesnecker joined
05:23 <codygman> jle`: I meant using the lens library
05:23 <codygman> Koterpillar: Yeah
05:23 <codygman> jle`:, glguy Ah, I see.
05:23 <Koterpillar> how did you get this use case at all?
05:24 mjora7 joined
05:25 Swizec joined
05:25 shayan_ joined
05:25 Guest25__ joined
05:25 <lyxia> mikeplus64: this looks pretty safe actually
05:26 <mikeplus64> lyxia: hm... you can definitely get it with if you use unsafeVacuous as well, but you can use unsafeVacuous to get unsafeCoerce anyway
05:27 ludat joined
05:27 inad922 joined
05:28 darjeeli1 joined
05:28 Costar joined
05:28 zolamusic joined
05:29 jbiesnecker joined
05:31 <lyxia> mikeplus64: newtype I a = I { runI :: a } ; instance Foldable I where foldr = const const ; uc :: a -> b ; uc = runI . unsafeVacuous . fromJust . void . I
05:33 <mikeplus64> lyxia: yeah, refresh the lpaste, i did the same thing (though not as artfully :-))
05:33 <lyxia> void relies on foldr traversing all fields of type "a", but that isn't enforced, hence the abuse.
05:35 jbiesnecker joined
05:35 takuan joined
05:36 <Koterpillar> I have a ConduitM i o m r which I want to apply foldC to. How do I do that _and_ keep my result (r)?
05:37 jbiesnecker_ joined
05:37 uglyfigurine_ joined
05:37 geekosaur joined
05:37 uglyfigu_ joined
05:40 <n_blownapart> hi if I'm using the atom haskell-ide environment, I can get the app to build but when I go to run it with "$ stack exec -- factorial" I get "not found on path." hints?
05:40 mbuf joined
05:41 <n_blownapart> How does it find the path for the build but not exec ?
05:41 <cocreature> n_blownapart: are you sure the executable is called factorial?
05:41 <cocreature> n_blownapart: the executable name and the package name can be different
05:42 hera joined
05:43 hellworld joined
05:43 hellworld left
05:44 zcourts joined
05:44 <n_blownapart> cocreature, well I guess it's Main.hs ? I tried this a few months ago and it worked. I thought it was .....
05:44 <n_blownapart> "stack exec factorial.exe
05:44 <n_blownapart> "
05:44 juanpaucar joined
05:45 DioticDrone joined
05:46 jbiesnecker joined
05:46 <cocreature> n_blownapart: can you show us your cabal file?
05:46 <n_blownapart> sure
05:46 <lyxia> Koterpillar: there are fuse* combinators https://hackage.haskell.org/package/conduit-1.2.9/docs/Data-Conduit.html#v:fuseUpstream
05:46 xtreak joined
05:46 davr0s joined
05:48 zolamusic joined
05:48 <Koterpillar> lyxia: thank you, fuseBoth is what I needed!
05:48 <n_blownapart> cocreature, http://lpaste.net/6718530591383355392
05:49 yoneda joined
05:49 <cocreature> n_blownapart: "executable factorial-exe" means that the resulting executable will be called factorial-exe
05:50 <n_blownapart> sorry cocreature yeah got it I was using a "." and not a "-" . thanks kindly it ran
05:50 yoneda joined
05:51 afarmer joined
05:52 fakenerd joined
05:55 meba joined
05:57 jleon joined
05:58 ThomasLocke joined
05:59 erikd joined
05:59 CurryWurst_ joined
06:00 slack1256 joined
06:00 zcourts joined
06:01 luigy joined
06:05 zcourts_ joined
06:05 fiddlerwoaroof joined
06:05 <* Axman6> hates it when people add -exe to executables...
06:06 <cocreature> Axman6: the fact that stack defaults to this in its standard template doesn’t help here
06:06 <Axman6> do we really need some weird form of hungarian notation for files?
06:06 vlatkoB joined
06:06 <Axman6> cocreature: yeah, "people" mostly consisted of "the stack template" :P
06:06 <cocreature> I’m often just too lazy to change it :)
06:07 <Axman6> yeah me too :(
06:07 jedws joined
06:07 <Axman6> actually.. no, I think i always change it eventually
06:07 hurkan joined
06:08 jbiesnecker joined
06:09 ianandrich joined
06:10 <codygman> I made some code to generate data types from cassandra's system schema table. I'm not sure how I can update this library to allow something like aeson does with decode :: Maybe MyCustomDataType. It's function I envision as "executeRows QUORUM query () :: Maybe MyCustomDataType". Here is the current code which takes the tuple type: https://github.com/the-real-blackh/cassandra-cql/blob/master/Database/Cassandra/CQL.hs#L1496
06:10 zcourts joined
06:14 <vaibhavsagar> Axman6: I assumed you couldn't have a library and an executable with the same name for the longest time
06:14 osa1 joined
06:14 osa1 joined
06:14 <vaibhavsagar> only figured out it was a stack thing a few weeks ago
06:18 yobohohoz joined
06:21 spacecadetbrown joined
06:22 <Axman6> yeah :\
06:23 FreeBirdLjj joined
06:23 osa1 joined
06:23 osa1 joined
06:27 bigos joined
06:27 erikd joined
06:28 <andromeda-galaxy> exit
06:30 fakenerd joined
06:31 tristanp joined
06:31 juhp joined
06:32 zcourts_ joined
06:34 c137 joined
06:34 luigy joined
06:36 alfredo joined
06:36 <Axman6> but I don't want to :( is there a fire?
06:38 tromp joined
06:38 brailsmt joined
06:39 davr0s joined
06:39 jedws joined
06:41 zcourts joined
06:41 mfukar joined
06:41 refold joined
06:43 Costar joined
06:46 primal__ joined
06:47 quchen joined
06:47 Sh4rPEYE joined
06:48 bablisok joined
06:48 <halogenandtoast> Just bought Hutton's Programming in Haskell and Pierce's Types and Programming Language (man was TaPL expensive!)
06:48 <osa1> TaPL is worth it though (not sure about Hutton's)
06:49 tomboy64 joined
06:49 juanpaucar joined
06:50 erikd joined
06:51 <halogenandtoast> I've heard good things about Hutton's book.
06:51 <halogenandtoast> Otherwise I wouldn't have bought it of course.
06:51 mkoenig_ joined
06:51 btk joined
06:51 hurkan left
06:53 zcourts joined
06:54 <Lokathor> if i use a function inside another function, but define it to be undefiend without a type signature, GHCi won't infer the type of it based on the type it needs to be
06:54 <Lokathor> it'll just stay as ":: a"
06:54 <Lokathor> how odd
06:54 <phadej> :t undefined
06:54 <lambdabot> a
06:54 ilyaigpetrov joined
06:54 louispan joined
06:55 <phadej> it infers the most general type, which is "forall a. a"
06:55 <Lokathor> phadej, ...yes but if a function foo is used in another function bar (which has a definition and type) and then you say foo = undefined
06:55 <Lokathor> it feels like it should limit foo based on how you used it in bar
06:55 <cocreature> Lokathor: why should it
06:55 <cocreature> Lokathor: if it has type forall a. a you can definitely use it in bar
06:56 <Lokathor> feels like cheating
06:56 CacoS joined
06:56 <halogenandtoast> That's the point of a bottom value is it not?
06:56 <cocreature> if polymorphism is cheating, then we are cheating a lot in Haskell
06:56 primal joined
06:56 <Lokathor> any type more specific than :: a would need to be some much more specific type, and i feel it should limit it to that subtree of types
06:57 <halogenandtoast> you can't change the definition of undefined
06:57 <halogenandtoast> any more than you can change the definition of any function.
06:58 <halogenandtoast> You've defined an equivalence.
06:58 <phadej> Lokathor: undefined *is* cheating :)
06:58 <cocreature> undefined is cheating but this problem is not specific to undefined
06:58 <Lokathor> i guess I'm imagining that there's an undefined *in* every type, but Haskell thinks that there's an undefined *of* every type :P
06:59 <halogenandtoast> undefined is a function.
06:59 <cocreature> you are expecting GHC to infer a less polymorphic type than it could and it won’t do that by default (maybe except for the MonomorphismRestriction)
06:59 jedws joined
06:59 <Lokathor> cocreature, only based on the restrictions that a binding would have to follow for another binding to have ended up valid
07:00 <Lokathor> halogenandtoast, a function? it seems more like a data to me, no -> in the type and all
07:00 <halogenandtoast> undefined :: forall (r :: RuntimeRep). forall (a :: TYPE r).
07:00 <halogenandtoast> HasCallStack => a
07:00 <halogenandtoast> undefined = error "Prelude.undefined"
07:00 <halogenandtoast> that's the definition
07:00 <cocreature> Lokathor: GHC follows the restrictions just fine. in fact it infers an even more polymorphic type than the restrictions require!
07:00 <Lokathor> :P
07:01 primal_ joined
07:02 <halogenandtoast> so um sure, a "data" but it has to return whatever error returns
07:02 <halogenandtoast> which is a function
07:02 <halogenandtoast> error :: forall (r :: RuntimeRep). forall (a :: TYPE r).
07:02 <halogenandtoast> HasCallStack => [Char] -> a
07:02 <Lokathor> but error has been applied to a string already? so you're saying what you get back is still a function?
07:03 <halogenandtoast> Lokathor: you know I'm not, I'm failing at semantics.
07:03 <halogenandtoast> I'm always bad at semantic jousting.
07:04 <Lokathor> well i don't know which it is because there's a lot of forall in there and that usually means dark magic
07:04 <Lokathor> for all i know data values are functions within GHC's internals somehow
07:04 connrs joined
07:04 <* halogenandtoast> shrugs
07:05 <halogenandtoast> I wouldn't know either.
07:05 <* ski> isn't sure what "data values" mean
07:06 <Lokathor> Well I was once taught that "values" are classified into either "data" or "functions". That "data" is the term to use for "a non-function value"
07:06 <halogenandtoast> ski: I assume the opposite of a thunk
07:06 <ski> however, `a' here *could* be instantiated to a type of general shape `... -> ...', and so `undefined' is *potentially* a function
07:06 <Lokathor> gha! polymorphism morphs again!
07:07 <ski> just like `id' can *potentially* be applied to more than one argument, curriedly
07:07 <halogenandtoast> :t flip id
07:07 <lambdabot> b -> (b -> c) -> c
07:07 <halogenandtoast> bam ^^
07:07 hasnoob joined
07:07 <Lokathor> :O
07:07 <halogenandtoast> :t flip undefined
07:07 <lambdabot> b -> a -> c
07:07 <ski> thunk is an implementation detail, not something at the semantic reasoning level
07:07 poxar joined
07:08 <halogenandtoast> ski: I'll avoid it's use in the context in the future.
07:08 <halogenandtoast> s/in the/in this/
07:08 <ski> Lokathor : ok, so then `undefined' is potentially a "data value", and potentially a function (but not both at the same time)
07:09 <Lokathor> a billion curses upon the type 'a'
07:09 <hasnoob> In Real world haskell chapter 3 defines binary tree like this http://lpaste.net/355857 . Chapter 3 Exercise 2 on page 60 says "Define a tree type that has only one constructor, like our Java example. Instead of the Empty constructor, use the Maybe type to refer to a node's children."
07:09 <halogenandtoast> Lokathor: but it's elegant and beautiful!
07:09 <hasnoob> So I did this
07:09 govg joined
07:09 <hasnoob> http://lpaste.net/355856
07:09 <Lokathor> halogenandtoast, i'm gonna go implement two nearly-identical functions with similar names instead of being polymorphic
07:10 <hasnoob> But it is giving me No instance for (Show (a (Tree a) (Tree a))
07:10 <halogenandtoast> thats sounds ダメ
07:10 <* ski> would probably use the term "non-function (value)" rather than "data value", in case they wanted to talk about that
07:10 bablisok joined
07:11 <Lokathor> well however you care to classify String and Int together into one group and putStrLn and (+) in another group is probably fine
07:11 <halogenandtoast> hasnoob: why not: Tree (Maybe a) (Maybe a) (Maybe a) as your constructor?
07:11 <halogenandtoast> err
07:11 <Lokathor> er, individual strings and ints, that is
07:11 <ski> hasnoob : you possibly meant `MkTree (Maybe (a,Tree a,Tree a))' ?
07:11 <halogenandtoast> Tree (Maybe a) (Tree a) (Tree a)
07:12 <halogenandtoast> ski: Where is MkTree coming from?
07:12 <ski> data constructor of `Tree', which looked like it was forgotten
07:12 <ski> so i just invented a name for it
07:12 <ski> hasnoob : you'll need to adapt the definition of `formtree' as well
07:13 <halogenandtoast> ski: data Tree a = Maybe( a (Tree a) (Tree a) ) is a syntax error
07:13 <ski> exactly
07:13 uglyfigurine joined
07:13 ertes-w joined
07:14 <halogenandtoast> data Tree a = MkTree (Maybe a) (Tree a) (Tree a) or data Tree a = Tree (Maybe a) (Tree a) (Tree a) I assume would work
07:14 <ski> hasnoob : what halogenandtoast suggested is another interpretation of what you might have wanted. in this case, the data constructor was named `Tree' (the first `Tree' in the suggestion. the latter two occurances are occurances of the *type* constructor that you're defining)
07:14 <* ski> prefers not naming the data constructor the same as the type constructor
07:14 <halogenandtoast> ski: Interesting, why not?
07:15 <hasnoob> If I do Tree (Maybe a ) (Maybe a ) (Maybe a) . Wgat will the formtree look like
07:15 primal joined
07:15 <halogenandtoast> hasnoob: replace the first Maybe with Tree
07:15 <halogenandtoast> in formtree
07:15 <ski> hasnoob : yes, but that (your first of those two) is not the same as (not even in bijection to) my suggestion `data Tree a = MkTree (Maybe (a,Tree a,Tree a))'
07:15 <halogenandtoast> well hold on your nodes are wrong too
07:15 <ski> er, that was to halogenandtoast
07:16 vlatkoB_ joined
07:16 <ski> halogenandtoast : why not what ?
07:16 <halogenandtoast> ski, true, but why use an n-tuple?
07:16 <halogenandtoast> ski: > prefers not naming the data constructor the same as the type constructor
07:16 <ski> hasnoob : we should first determine which shape of the tree you want
07:17 <hasnoob> Binary tree
07:17 <ski> hasnoob : halogenandtoast is suggesting that you possibly meant a tree node to *maybe* contain an element, and *always* two subtrees
07:18 <ski> hasnoob : i was suggesting that you possibly meant a tree to to *maybe* contain : all three of an element, and two subtrees
07:18 <ski> these are different suggestions
07:18 <hasnoob> Not always two subtree. Child can be empty
07:18 <ski> perhaps you in fact had something else in mind ..
07:18 <hasnoob> but i have to use Nothing for empty child
07:18 <ski> if child is empty, are the two subtrees always lacking as well ?
07:19 <hasnoob> I am not following.
07:19 <james999> hey sorry to interrupt but you're talking about trees in here
07:19 <hasnoob> yes
07:20 <james999> is there a way to apply regular expressions to trees?
07:20 <james999> or is that not possible to do?
07:20 <halogenandtoast> james999: No
07:20 torstein joined
07:20 <james999> e.g. I was thinking something like an expression that says "match trees with root node "foo" and right grandchild "baz" or something
07:20 <halogenandtoast> I mean not with the standard definition
07:20 <james999> ok
07:20 <ski> halogenandtoast : "not naming the data constructor the same as the type constructor" -- because it tends to lead to confusions for newbies, who aren't yet clear on which syntax positions in `data' and `newtype' declarations are types and type constructors, and which are data constructors, or even aren't clear on what the difference between a data and a type constructor are, confusing the value and type level
07:21 <halogenandtoast> DFAs don't handle recursion well.
07:21 <james999> is that why you can't write a regular expression which parses a java source file for example?
07:21 thc202 joined
07:21 <halogenandtoast> james999: and a reason you can't write one to parse HTML or XML
07:21 <ski> halogenandtoast : and because it's easier to discuss things with other people, if you don't have to insert qualifications like "the data constructor `X'" or "the type constructor `X'" (not that this is always needed)
07:22 etehtsea joined
07:22 <ski> james999 : not really, in Haskell
07:22 bvad joined
07:22 <Axman6> the reason is that Java isn't a "regular" language
07:22 <halogenandtoast> ski: I see, yeah I think I had some trouble with that when I was first learning.
07:22 <ski> james999 : there are something like regular expressions for trees, though
07:22 <james999> yeah i've heard of regular languages before
07:22 davr0s joined
07:23 <Axman6> https://en.wikipedia.org/wiki/Regular_language might be interesting
07:23 kvda joined
07:23 <ski> (iirc, it was called something like hedges)
07:23 <halogenandtoast> hasnoob: btw ignore any of my answers from before, my type has no way to terminate.
07:23 <halogenandtoast> I think ski is on the right path.
07:23 <ski> hasnoob : sorry for the diversion
07:23 <james999> so if I were to do something like that I have to represent a tree myself like (a (b (c d))) and use that to match another tree?
07:24 <Axman6> halogenandtoast: not that that's actually a problem in Haskell :)
07:24 <halogenandtoast> Axman6: I had no way to construct one...
07:24 <Axman6> sure you did
07:24 <* ski> thinks james999 needs to be less vague, in order for people to understand the desired goal
07:25 <james999> well my intended use case was java source files if that's helpful
07:25 <halogenandtoast> Axman6: okay, I might be derping, it happens. Am I missing some haskelly goodness
07:25 jhrcek joined
07:25 <Axman6> mkTree n = Tree (Just n) (mkTree (2*n) (mkTree (2*n+1))
07:25 <Axman6> uh, MkTree as the constructor
07:25 <halogenandtoast> lol sure
07:25 <halogenandtoast> I see
07:25 <Lokathor> halogenandtoast, okay it turns out i was a lot closer than i thought when i said that i was going to make two funcs that were nearly identical
07:25 <ski> hasnoob : with my definition, a tree can either (a) be empty (`Nothing'), or (b) containing an element (`a'), a subtree (`Tree a'), and another subtree (`Tree a')
07:26 <halogenandtoast> james999: I wouldn't touch a java source file with a regular expression
07:26 <halogenandtoast> just write a recursive descent parser or something like that.
07:26 <Axman6> jhrcek: sounds like you want a parser...
07:26 primal_ joined
07:26 <james999> so something like "verify this java file contains 1 class with 2 function definitions and the first function has 1 if statement".
07:26 <ski> hasnoob : it's easy to change the definition so that in the (b) case, the element can possibly be missing (`Maybe a'), without touching the two subtrees there (which might still, each of them, recursively, be the empty tree (a))
07:26 <Axman6> writing a parser for Java will not be a trivial exercise though
07:27 <hasnoob> Ski : data Tree a = Tree Maybe( a (Tree a) (Tree a) ) deriving (Show) . This is your definition right?
07:27 <james999> yeah i just thought there'd already be a fancy gadget for that like
07:27 <james999> "hedges"
07:27 lonokhov joined
07:27 mohsen_ joined
07:27 <Axman6> hasnoob: no, tht's not really valid
07:27 <ski> hasnoob : no, i think halogenandtoast wrote that (and it's still a type error, need to be corrected in order to make any sense)
07:27 <Axman6> (well, it might actually be, but it's not what you want)
07:28 <halogenandtoast> ski: I didn't write that, I copied his definition and said it was an error
07:28 <Axman6> hasnoob: MkTree (Maybe (a, Tree a, Tree a))
07:28 <ski> hasnoob : my definition was `data Tree a = MkTree (Maybe (a,Tree a,Tree a)) deriving Show', which was what i was interpreting (perhaps incorrectly) you as wanting
07:28 <hasnoob> ok
07:28 <james999> Axman6: sure, i wanted to make it a small exercise. really i guess i ask how to represent the AST to be checked in a file or text
07:28 <ski> halogenandtoast : hasnoob didn't write the `Tree' right after the `=' there
07:28 <ertes-w> Axman6: for languages like C and java you would typically use a parser generator, so it's not even that bad
07:29 <Axman6> we have better tools than parser generators IMO
07:29 <hasnoob> ski: Yes i didn't wrote value constructor and that was also an error
07:30 <ski> halogenandtoast : or, they didn't do it before. i suppose they actually added that `Tree' in there just now. sorry for misremembering what you actually said
07:30 <james999> The best I can think of is to take in a skeleton, e.g. a string "class A { function B {} function C {} }" and then parse that and also the input file
07:31 <james999> but that seemed too simplistic, idk
07:31 <halogenandtoast> ski: It's okay, I just didn't want my name attached to that somewhere on the internet :p
07:31 beekill95 joined
07:31 <ski> no worry. i stand corrected
07:32 dni joined
07:32 <halogenandtoast> james999: with infinite time, I would write something that generated an AST for a java program and use the visitor pattern to do my checks.
07:32 <halogenandtoast> but that's the OO programmer in me.
07:32 <james999> I can never remember how to code the visitor pattern either without looking it up
07:32 <halogenandtoast> Oh that's really easy
07:32 <Axman6> we have better tools than the visitor pattern...
07:33 <halogenandtoast> pass in a generator, call the corresponding visit function
07:33 <ab9rf> heh
07:33 <james999> right. and the class you make has to have the function to take in the generator
07:33 connrs joined
07:33 <halogenandtoast> Axman6: Yeah in Haskell I'd probably use the Free monad (but I'm dumb and crazy)
07:33 <Axman6> the visitor pattern is a hacky way to do what we do do all the time, traverse data
07:34 <james999> This matching of ASTs might be simpler in haskell lol
07:34 <halogenandtoast> I've used it in OO a few times. Don't feel like it's that bad there.
07:34 <james999> really it's just checking if one AST is equal to a subtree of another
07:35 <halogenandtoast> james999: Axman6 keeps implying there's some great tool for this problem.
07:35 <halogenandtoast> I really want to know what it is :p
07:35 ubsan_ joined
07:35 <halogenandtoast> Mechanical Turk seems like a valid tool to me.
07:35 <Axman6> the "tool" is functional programming :\
07:35 <ab9rf> the visitor pattern is how java solves the expression problem. haskell solves it in the opposite direction.
07:36 <james999> ab9rf: the more i think about the expression problem the less sense it makes to me
07:36 <halogenandtoast> ab9rf: java... and other OOP languages :p I haven't touched Java since highschool.
07:36 lamduh joined
07:36 primal joined
07:36 <ab9rf> halogenandtoast: yeah pretty much
07:37 <halogenandtoast> anyways how does one solve it in the opposite direction?
07:37 <halogenandtoast> I'm intersted in this.
07:37 <halogenandtoast> *interested
07:37 <Axman6> classy lenses/prisms offer some nice ways to deal with the expression problem
07:37 <ab9rf> halogenandtoast: http://eli.thegreenplace.net/2016/the-expression-problem-and-its-solutions/ may or may not help
07:37 <halogenandtoast> I'm 70% of the way to understading lenses and 30% of the way to understanding Prisms.
07:38 <ab9rf> i still need to make more sense out of lenses
07:38 <halogenandtoast> So if I add those together I understand them 100%
07:38 <halogenandtoast> ab9rf: thanks for the link. I'll read it soon.
07:38 brailsmt joined
07:39 <ab9rf> halogenandtoast: the general term for this is the "expression problem" and it's not new to haskell or to java
07:39 <halogenandtoast> Oh when they say "expression problem" they literally just mean expression as in the language construct.
07:40 <halogenandtoast> I've written a lot of interpreters... never named this problem.
07:40 <tdammers> parser generators have a place
07:40 <tdammers> but in languages where they are popular, they are overused
07:41 <tdammers> "I need a parser" -> lex, yacc, done
07:41 <halogenandtoast> tdammers: that's my usual method
07:41 <halogenandtoast> or rexical, racc, done
07:41 <tdammers> problem is, lex/yacc code is hard to maintain
07:41 <ab9rf> tdammers: very much so, indeed
07:42 <ab9rf> and extremely hard to refactor
07:42 miklcct joined
07:42 <tdammers> in Haskell, the all-else-being-equal approach is "I need a parser" -> {mega,atto}parsec, done
07:43 dihuteno joined
07:43 <tdammers> most parsers are not performance bottlenecks, but they are maintainability bottlenecks
07:44 <tdammers> so it makes sense to optimize parser code for readability and refactorability
07:44 <ab9rf> the exception being some attoparsec parsers, but the people who write those know what they're doing
07:44 <tdammers> and parser-combinator style recursive-descent parsers are great for that, especially in a typed language like Haskell
07:44 <james999> ok i'll write a rdp then
07:44 <james999> also completely different to this but is haskell a good lang to learn concurrency in?
07:45 <james999> i typed in concurrency on amazon and got java books
07:45 <ab9rf> concurrency is so much eaiser in haskell than most other languages
07:45 <james999> hmm. maybe i should rephrase that. will learning it in haskell help in learning it in other langs?
07:45 <tdammers> yes, no, it depends
07:45 <ab9rf> well, it may help you to undertsand the theoretical limits of concurrency
07:46 <Axman6> Haskell is one of the besty languages to learn concurrency IMO, but it eon't really help you with other languages because they don't offer as good tools
07:46 <tdammers> Haskell has pretty solid concurrency primitives, and good abstractions
07:46 erikd joined
07:46 <Axman6> brst*
07:46 <ab9rf> it won't help yhou deal with the limitations of other languages' implementations of concurrency management
07:46 <james999> hmm ok
07:46 <ab9rf> very few languages have good concurrency abstractions
07:46 <tdammers> many of them depend on compiler-enforced purity though, so you can't naively port these ideas to other languages as-is
07:46 <ab9rf> it's fairly hard to deadlock haskell, for example
07:46 primal_ joined
07:46 <james999> odd considering the plethora of multi core processors that exist now
07:46 <tdammers> but the general approaches are good, and work elsewhere too
07:47 <ab9rf> you can do it, but you have to work at it
07:47 <james999> is Go among them ab9rf?
07:47 <tdammers> well, concurrency is hard
07:47 <Axman6> james999: http://chimera.labs.oreilly.com/books/1230000000929/index.html is available for free, and it's an excellent, short book on the subject by one of the main developers of most of the concurrency and parallelism features in Haskell
07:47 <ab9rf> james999: can't say, haven't used go
07:47 sternmull joined
07:47 <james999> Axman6: actually that book is why i'm asking the question. :)
07:47 dni joined
07:47 <Axman6> go read it, don't even think about it
07:47 <james999> since haskell and java seem the easiest (read cheapest) ways to learn it
07:47 <Axman6> go!
07:47 <ab9rf> concurrency is fundamentally hard, and while it's easier in haskell it's not easy
07:48 <ab9rf> java concurrency is ... punitive
07:48 <tdammers> java kind of pioneered concurrency / parallelism primitives built into the language
07:48 <ski> @let data ListVisitor a o = LV {visitNil :: o,visitCons :: a -> [a] -> o}
07:48 <lambdabot> Defined.
07:48 <ab9rf> tdammers: are they stil buggy?
07:48 <ski> @let acceptList :: [a] -> ListVisitor a o -> o; acceptList [] vis = visitNil vis; acceptList (a:as) vis = visitCons vis a as
07:48 <lambdabot> Defined.
07:48 <ab9rf> i know the first two tries at concurrency primitives in java were profoundly defective
07:48 <ski> @let sumVisitor :: Num n => ListVisitor n n; sumVisitor = LV {visitNil = 0,visitCons = \n ns -> n + acceptList ns sumVisitor}
07:48 <lambdabot> Defined.
07:49 <ski> > acceptList [2,3,5,7] sumVisitor -- Visitor Pattern in Haskell, oh my !
07:49 <lambdabot> 17
07:49 <ab9rf> heh
07:49 <ski> halogenandtoast,Axman6 ^
07:49 <sternmull> the go programming language is also nice for concurrency. Unfortunately its not very nice in general for my taste.
07:49 <ab9rf> the visitor pattern is, in haskell, a solution in search of a problem
07:49 biglama joined
07:50 <Lokathor> james999, I'll add that rust has a very good concurrency story, while being closer in many ways to Java. However, like with Haskell, learning Rust concurrency will mostly teach you that Java's concurrency is dangerous and unfun
07:50 Yuras joined
07:50 plugin joined
07:50 <james999> sternmull: the entire Go wikipedia page is basically saying "We wanted to make this language nice and fix all the problems of C++" lol
07:51 <tdammers> doesn't Go roughly pull the same trick as JavaScript wrt concurrency? that is, run everything as coroutines on a single thread?
07:51 <james999> Lokathor:noted
07:51 ErinvanderVeen joined
07:51 sz0 joined
07:51 <ertes-w> sternmull: is it? go has coroutines more than proper concurrency like in erlang and haskell
07:52 <Axman6> james999: Go is what you get when you actively decide "I want to invent a new language, but completely ignore the last 40 years of programming language research... but add CSP"
07:52 <Axman6> they don't even have generics FFS
07:52 gawen joined
07:52 <Lokathor> Go 2.0 might :P
07:52 <Axman6> "Just use interface {}, it'll be fine"
07:52 <james999> the wiki article says repeatedly it will have generics. maybe. possibly. in the future
07:53 <ski> halogenandtoast : "implying there's some great tool for this problem" -- namely pattern-matching
07:53 <Lokathor> james999, Erlang (or Elixir if you like, same VM) is a top grade concurrency-capable language
07:53 <james999> also define research. real-world experience would be more valuable in this kind of matter i think
07:53 <sternmull> ertes-w: The channels in go make communication between threads very nice. Also the threads are lightweight (as in haskell). So i would say concurrency is a strength of go.
07:53 <Lokathor> but Erlang is, as far as I understand it, kinda mostly suited to server types of things
07:53 <ertes-w> sternmull: and it seems to be self-aware in that regard, because it calls its "threads" "goroutines" =)
07:53 juanpaucar joined
07:53 <Axman6> james999: they've ignored really dumb things, there's nothing new or interesting in the language, and it barely makes any efforts to make programming any safer
07:54 ralu joined
07:54 <Axman6> what it has going for it is good libraries for specific areas, like web services
07:54 bollu joined
07:54 <james999> so in other words like java at first. not that amazing but has great libraries
07:54 <ertes-w> sternmull: i consider concurrency "proper", if it's bound to a form of I/O scheduler… does go have that? in other words: would you create one thread for every network client and use semantically blocking calls?
07:54 <Lokathor> ab9rf, visitor pattern in Haskell would let you make a python style print command, for one (it looks like at least)
07:54 <Axman6> it's just a frustrating language, which won't teach you anything interesting
07:54 <ertes-w> sternmull: or do you need an explicit I/O goroutine?
07:54 <Axman6> james999: I would take Java any day over Go TBH
07:56 <james999> yes Axman6 I would as well, but for the simple reason of the libraries. so not necessarily saying something inherent to the language
07:56 <Lokathor> ertes-w, from what i know of Go, it's more like the first thing you suggest. "one handler thread per connection"
07:56 meba joined
07:56 <sternmull> ertes-w: In go you create one goroutine per "request" an things like that. Thats specifically what they are meant to be used for. And yes, then you use blocking calls inside of them.
07:56 primal joined
07:56 <ertes-w> ok, i could live with that
07:56 <Axman6> sternmull: the problem with channels is that they are the only mechanism of communication between goroutines, which leads to convoluted hacks when you want to do something that isn't well modeled by them.
07:57 <ertes-w> (or course i still can't live with most of the other language features of go, like its lack for parametric polymorphism)
07:58 <Axman6> ertes-w: but it does have polymorphism, including parametric polymorphism... as long as you only use the map type
07:58 <Axman6> (or interface {})
07:58 <ab9rf> heh
07:58 jleon joined
07:58 <ertes-w> you mean like C has parametric polymorphism, if you use (void *)?
07:58 <sternmull> Axman6: Maybe, i am no Go expert. I just tried Go for a little project to see how it fits. I liked the concurrency and missed lots of other stuff. So decided against ist.
07:58 <Axman6> yeah, that's the latter
07:58 <Lokathor> ertes-w, rust does NOT do the "thread per connection" style by default. Though you use this crazy (and somewhat immature) async IO library to (in haskell terms) build up a crazy IO action that the tokio library then manages the exection of for you.
07:59 <Axman6> sternmull: have you used much concurrency in Haskell? IMO it is vastly superior, in basically every way
07:59 <Lokathor> sternmull, when you start to mix withAsync and the STM library in Haskell you've got a delicious program in the making
08:01 <sternmull> Axman6: I had a look at it and played a little bit with it. It is nice and the async package is very helpful. One thing that i diskliked where that channels in Haskell are difficult to set up a 1:1 connection because they broadcast to all ends.
08:01 <james999> yeah ertes, I thought when I read the article that a lot of the stuff Go does you could just as well do in C
08:02 <Lokathor> sternmull, https://hackage.haskell.org/package/stm-2.4.4.1/docs/Control-Concurrent-STM-TQueue.html ?
08:02 <Axman6> sternmull: not sure what you mean, only one process can take a value off the front of a channel, unless you've used dupChan
08:02 <Lokathor> or do you mean having specific in and out sides?
08:03 <halogenandtoast> ski: Thanks for taking the time to write that out
08:03 <halogenandtoast> I will try out the visitor pattern for lols
08:03 <sternmull> i don't remember exactly what i used. But i wanted 1:1 communication between a producer and consumer thread. The problem was that i had to close the read-side in the producer to avoid leaks.
08:03 <reynir> is an 'everything monad' a common uh word?
08:04 <Axman6> reynir: given I have no idea what you mean, I'm going to say no :P
08:04 <Lokathor> sounds like 2 words
08:04 dni joined
08:05 <Axman6> that too
08:05 <Lokathor> sternmull, that does sound like a problem i guess
08:06 mekeor joined
08:06 <Lokathor> once the producer thread ends and drops the TChan, and the consumer ends and drops the TChan, the memory is picked up. If one side goes on without dropping their end the channel stays there, yeah
08:06 cyborg-one joined
08:07 <Axman6> that's the nature or garbage collection though... if anything holds a reference to something it is still "live"
08:07 <mivael_> :t (*2)
08:07 <lambdabot> Num a => a -> a
08:07 <mivael_> > (*2)
08:07 <lambdabot> <Integer -> Integer>
08:07 <mivael_> hmm... why Integer?
08:07 <Axman6> defaulting
08:08 <Axman6> also, the fact that that works is pretty much a hack
08:08 <sternmull> Lokathor: No that wasn't what i meant. It was that the produced values where echoed to the producer and is was not so obvious how to stop that.
08:09 <Lokathor> ah, well just don't read from the channel you're writing to?
08:09 <Axman6> sternmull: why was the producer reading from the channel? o.O
08:09 jadrian joined
08:09 <sternmull> i think there was an example that had this problem... lets see if i can find it.
08:09 jleon joined
08:09 xtreak joined
08:10 <reynir> Axman6: OK, I saw it on twitter
08:10 Beetny joined
08:10 <ski> halogenandtoast : hopefully it should be clear how to apply to other data types. btw, `maybe' and `either' basically are `accept' implementations for `Maybe' and `Either', with the visitor unboxed (separated over multiple arguments, rather than being combined into a single thing of its own)
08:11 filterfish joined
08:11 fakenerd joined
08:11 <ertes-w> i don't know much about go concurrency, but i know how advanced haskell's is… even clojure's concurrency felt primitive to me, and that one has many of the surface features of haskell's concurrency like preemptiveness, STM, etc.
08:12 cschneid_ joined
08:12 <ertes-w> i doubt that i would find go's concurrency very interesting
08:12 <sternmull> Lokathor, Axman6: This is what i was thinking about: https://wiki.haskell.org/Implement_a_chat_server#Cleanups_and_final_code
08:13 davr0s joined
08:13 xtreak joined
08:14 <sternmull> ertes-w: If you compare Go to Python, Java and C++ then its concurrency can be the better choice for some types of applications.
08:14 <Lokathor> sternmull, it's a little late for me to go into it, but almost none of that is how I'd do concurrency in Haskell >_<
08:14 <ski> halogenandtoast : btw, note that it's a small step from `data ListVisitor a o = LV {visitNil :: o,visitCons :: a -> [a] -> o}' to `data ListFrequenter a o = LF {frequentNil :: o,frequentCons :: a -> o -> o}' (i just made up the term "frequent" here), where the corresponding (recursive !) `inviteList :: [a] -> ListFrequenter a o -> o' now corresponds to a fold (/ catamorphism), in this case `foldr'
08:15 <Axman6> yeah that looks like pretty old code
08:15 <sternmull> Lokathor: Oh, ok. This was the example that i used when i had a first look at concurrency in haskell.
08:15 cdg joined
08:15 <Lokathor> sternmull, try this book (free to read on the website) http://chimera.labs.oreilly.com/books/1230000000929/index.html
08:16 <cocreature> that book is awesome
08:16 <ski> halogenandtoast : with `a -> [a] -> o -> o' instead of `a -> o -> o', it'd correspond to a paramorphism, where one has direct access both to the tail itself, and the recursive result resulting from looping/recurring over the tail
08:16 <Axman6> the wiki isn't exactly a very up to date resource for learning... pretty much anything to do with Haskell
08:16 <sternmull> Lokathor: Thank you! Will use that the next time i do parallel stuff.
08:18 <cocreature> sternmull: even if you don’t do parallel stuff, the sections on exceptions in Haskell are worth a read
08:19 <Axman6> yeah, that book should be considered essential reading for the beginner-intermediate haskeller
08:19 juhp joined
08:20 renzhi joined
08:21 ragepandemic joined
08:21 bollu joined
08:21 ragepandemic left
08:22 <sternmull> a completely different question: I am about to read many lines with values from a textfile using megaparsec. What is the recommended way to efficiently store that values? List would waste a lot of space and would store them in the reverse order. I see sequence and dlists as possible candidates.
08:24 <Lokathor> https://hackage.haskell.org/package/text-1.2.2.2/docs/Data-Text-IO.html probably what you want
08:24 <Axman6> would only reverse the order if you add them to the list as you do... see traverse parse . lines
08:24 arpl joined
08:24 bendo joined
08:24 unK_ joined
08:25 primal_ joined
08:26 <sternmull> is there no way to efficiently construct a sequence of values from megaparsec parsers?
08:26 ertes joined
08:26 <Axman6> that's what I just showed you :\
08:27 <Axman6> assuming you have a parser for a single line, traverse parserOfOneLine . lines will give you String -> Parser [Value]
08:27 <Axman6> um, maybe
08:27 <sternmull> Axman6: Oh! That sound nice.
08:28 freusque joined
08:29 <mbrock> with Brick, is there some way to merge adjacent borders, using ASCII art and stuff for corners and intersections?
08:30 gestone joined
08:32 litchblade joined
08:33 <Axman6> can you set one of the borders to no border?
08:33 cschneid_ joined
08:33 <Axman6> IIRC you had quite a lot of control over borders in Brick
08:33 wroathe joined
08:33 <Geekingfrog> Is there a way to store on disk (almost) any data structure? A bit like python's pickles ?
08:34 <Lokathor> Geekingfrog, https://hackage.haskell.org/package/cereal-0.5.4.0/docs/Data-Serialize.html ?
08:35 <Axman6> also, GHC 8.2 will introduce compact regions, which will basically allow you to serialise any haskell structure, as long as it contains no mutable references anywhere inside it
08:35 <Geekingfrog> Looks perfect for me, thanks
08:35 primal joined
08:36 <Geekingfrog> Data.Serialize fits the bill nicely for me
08:36 <Axman6> cerial/binary are quite good though
08:36 <Axman6> I would probably opt for binary, it has wider support IIRC
08:36 <Axman6> (the main difference between the two is one targets lazy bytestrings, the other strict
08:37 toby1851 joined
08:38 toby1851 joined
08:40 <Geekingfrog> No instance for (Serialize Text) /o\
08:40 lep-delete joined
08:40 <peddie> Geekingfrog: https://hackage.haskell.org/package/cereal-text
08:41 cretiq joined
08:41 louispan joined
08:43 <Axman6> you could also encode it to UTF-8 and serialise the bytestring
08:43 <Axman6> (which is probably what that package does)
08:43 raichoo joined
08:43 <ertes-w> sternmull: sure, but there is no reason for me to compare it ot python, java or C++
08:44 refold joined
08:44 <ertes-w> if i use language A, which is better than B and C, why would i care if B is better than C? ;)
08:44 louispan joined
08:44 tomphp joined
08:45 <ertes-w> sternmull: also i would probably choose C++ over go anyway, because parametric polymorphism is valuable to me
08:45 <sternmull> true. But when you encounter a problem where language A is no longer a good fit then you have to pick the least evil of the others. And then you start comparing them :)
08:45 <* hackage> servant-auth-client 0.2.7.1, servant-auth-server 0.2.8.0 (phadej): https://qbin.io/qd7xtc1y
08:46 primal_ joined
08:48 <james999> hmm clojure also has concurrency stuff in it
08:48 target_i joined
08:48 <james999> but idk if it counts as doing java concurrency though. prob not
08:49 <Axman6> IIRC clojure has STM, but it suffers from the same problem STM implementations in nearly all non-Haskell languages do - no way to controlling IO inside transactions
08:50 acidjnk22 joined
08:50 kamog joined
08:50 Kreest__ joined
08:51 filterfish joined
08:52 Bardusbasium joined
08:52 <ertes-w> clojure's STM is vastly inferior to haskell's
08:52 <halogenandtoast> I wish I had a project to work on that needed something like STM
08:52 <ertes-w> all it does is give you memory atomicity
08:52 <halogenandtoast> I spend all day not knowing want to make in Haskell
08:53 <srhb> halogenandtoast: I want a very fast proxy server, so if you want to do concurrency, there's that! :-)
08:53 <ertes-w> in particular it does not have the 'orElse' monoid (the Alternative instance of haskell's STM)
08:53 <ertes-w> halogenandtoast: feel free to take inspiration from my 'progress-meter' library =)
08:53 <ertes-w> halogenandtoast: https://hackage.haskell.org/package/progress-meter
08:54 <halogenandtoast> srhb: I'd be happy to work "with" you
08:54 <ertes-w> halogenandtoast: even just waiting for two 'async' threads at the same time is a legitimate use case for STM
08:54 fizruk joined
08:54 <halogenandtoast> ertes-w: I'll check it out.
08:54 <ertes-w> and ironically a use case that clojure's STM can't handle =)
08:54 <halogenandtoast> I basically never have any async code to write.
08:55 <srhb> halogenandtoast: Could be fun. I'll poke you if I ever get started. :-P
08:55 <halogenandtoast> srhb: awesome. I'm halogenandtoast everywhere if you ever want to track me down
08:55 <halogenandtoast> in case I'm not on IRC
08:55 <ertes-w> halogenandtoast: it's one of those abstractions that you really never miss, until you use it once
08:55 <james999> did that book Axman6 told me to read earlier mention STM in haskell?
08:56 <Axman6> yes
08:56 <ertes-w> james999: in detail
08:57 mmn80 joined
08:57 jleon joined
08:57 <ertes-w> james999: The Book covers a lot of ground on concurrency/parallelism in haskell… IMO every haskell programmer should read it at some point
08:57 <halogenandtoast> Which book was it?
08:59 <ertes-w> halogenandtoast: http://chimera.labs.oreilly.com/books/1230000000929/
08:59 <halogenandtoast> Ah yeah, that book. I was in the process of reading it.
08:59 <halogenandtoast> Among a number of other Haskell books.
08:59 prophile joined
08:59 <james999> halogenandtoast: will reading multiple Haskell books make you rich?
09:00 primal joined
09:00 <ertes-w> (and please stop linking to the table of contents! it's disrespectful to simon, because it hides the "buy" option!)
09:00 marr joined
09:00 <halogenandtoast> james999: no, I don't think Haskell will make me rich any time soon.
09:00 <halogenandtoast> So far ruby is doing a decent job.
09:00 <* hackage> fastparser 0.3.0 - A fast, but bare bones, bytestring parser combinators library. https://hackage.haskell.org/package/fastparser-0.3.0 (SimonMarechal)
09:00 <james999> hah
09:00 <halogenandtoast> But the only Haskell opportunity Ive seen is a huge step down.
09:01 <halogenandtoast> There aren't a lot of opportunities here in Tokyo.
09:01 <vaibhavsagar> halogenandtoast: http://www.tsurucapital.com/en/jobs.html?
09:01 chichou joined
09:01 aphorisme joined
09:01 <james999> Tokyo eh? Must.. resist.. making jokes.. about.. vending machines...
09:02 cur8or joined
09:02 <halogenandtoast> vaibhavsagar: Well, I haven't applied there...
09:02 <halogenandtoast> I looked at their test though
09:02 bollu joined
09:03 <vaibhavsagar> same here :)
09:03 meinside joined
09:03 <james999> halogenandtoast: aside from humor, it would be interesting to hear your experiences working in japan.
09:03 <vaibhavsagar> someone linked this a while ago: https://arow.info/index-en.html
09:04 <halogenandtoast> vaibhavsagar: probably me.
09:04 <james999> some people report different levels of culture shock
09:04 <vaibhavsagar> probably
09:04 <halogenandtoast> james999: I love it here, I didn't experience any negative culture shock.
09:04 <halogenandtoast> My company is perhaps a little atypical though.
09:04 <halogenandtoast> <- Cookpad
09:05 andyhuzhill joined
09:05 <james999> idk that sounds suspicious to me. like if someone moved to germany and reported the work place culture was no different than in slovenia
09:05 <halogenandtoast> james999: Hmm, most things were an improvement
09:05 tsmish joined
09:05 <halogenandtoast> that's why I prefaced it with "negative"
09:05 <vaibhavsagar> where did you move from?
09:06 <halogenandtoast> America
09:06 <halogenandtoast> Boston
09:06 <james999> lol well the traffic at least would be an improvement i'll grant that
09:06 <vaibhavsagar> interesting
09:06 juanpaucar joined
09:06 <halogenandtoast> james999: The subway system here is amazing.
09:06 xtreak joined
09:06 <halogenandtoast> I guess my one complaint is that they still allow smoking in restaurants
09:06 <james999> the only thing i know about that is those ytube vids of people being stuffed into subways like sardines
09:07 <halogenandtoast> That happens, but that doesn't bother me.
09:07 <james999> in fact most of my knowledge of japan is from funny youtube videos
09:07 <halogenandtoast> Mainly because everyone has accepted it.
09:07 <halogenandtoast> There's no confrontation
09:07 <bartavelle> james999: same thing happens in Paris, except people don't seem as nice :)
09:07 <halogenandtoast> If that happened in Boston there would be fist fights
09:07 <halogenandtoast> I once saw two Japanese people crash their bicycles into each other.
09:07 <halogenandtoast> They got up, didn't say a word, and rode off.
09:08 twomix joined
09:08 <james999> that is pretty unreal
09:08 <halogenandtoast> It was. Especially coming from Boston.
09:08 <capisce> didn't even say "sumimasen"?
09:08 <halogenandtoast> capisce: nope.
09:08 <capisce> tssk tssk
09:08 <james999> but in line with what i've heard. there's an obsession with saving face and avoiding conflict in japanese culture
09:08 <capisce> youth these days
09:08 <halogenandtoast> They kind of gave each other a rough look, but that was it.
09:09 <capisce> maybe they were both recovering hikikomoris
09:09 <halogenandtoast> lol
09:09 <james999> so for example halogenandtoast one potential issue would be resolving project problems. in japan it seems like your supervisor would just look away and hope you left the room instead of solving the problem
09:10 <halogenandtoast> james999: my company is atypical
09:10 primal__ joined
09:10 <halogenandtoast> It doesn't operate like a Japanese company at all.
09:10 oisdk joined
09:10 <james999> ahh ok, makes sense. I've even heard tales of overworked and underpaid manga artists quitting and moving to china
09:10 freusque joined
09:10 <james999> b/c it's basically like being a comic book slave or something
09:11 <halogenandtoast> Sure overworking and underpaying happens everywhere. The overworking part is pretty typical in Japan from what I'm aware of.
09:11 <halogenandtoast> I work 40 hours a week.
09:11 <halogenandtoast> Sometimes less, but they just take that out of my pay.
09:11 <capisce> they even have a word "death from overwork": karoshi
09:11 <james999> TIte Kubo the author of "Bleach" was a drawing genius, but partly to illness and partly the overwork culture basically started phoning it in
09:12 <james999> capisce: that is scary
09:12 <capisce> https://en.wikipedia.org/wiki/Kar%C5%8Dshi
09:12 <halogenandtoast> Yeah, apparently 人身事故 is so common they don't even report it anymore.
09:12 zuck05 joined
09:12 <halogenandtoast> which might be related to overworking
09:12 <halogenandtoast> but not necessarily
09:12 tomphp joined
09:12 <james999> but idk, i guess to avoid conflict you wouldn't leave your company for a different one? so everybody just keeps overworking
09:13 <halogenandtoast> james999: idk, that's changing more and more.
09:13 <halogenandtoast> A lot of companies are adopting a more "western" style.
09:13 bablisok joined
09:13 cdg_ joined
09:13 <halogenandtoast> There are more startups popping up.
09:13 Wizek_ joined
09:13 <james999> like denying them health care?
09:13 <james999> (i kid, I kid!)
09:13 <halogenandtoast> Well health care is a national scheme here
09:14 <halogenandtoast> so that would be very difficult :p
09:14 <james999> how did you wind up there anyway?
09:15 <james999> email someone and they were like Hai domo arigatou American-sama
09:15 danvet_ joined
09:15 <halogenandtoast> I always wanted to live in Japan. I previously worked for a consultancy and convinced them to let me open up an office here.
09:15 <halogenandtoast> The company was bleeding money and shut down all remote offices.
09:16 yellowj joined
09:16 <halogenandtoast> So 2 months after moving here I was jobless. But I had already contacted and talked to a bunch of companies as potential clients for the consultancy
09:16 rcat joined
09:16 dc0de joined
09:16 <halogenandtoast> so I just picked the best one and got in touch with them, asked if they were hiring and had a job lined up in 3 days time.
09:16 <capisce> what kind of consultancy do you do?
09:17 <halogenandtoast> capisce: I used to work for a "mostly" ruby on rails consultancy called thoughtbot
09:17 <halogenandtoast> They did some non rails sites, and also mobile applications (mostly iOS, but some Android)
09:18 <halogenandtoast> They even had a blog comment service written in Haskell called Carival
09:18 RegEchse joined
09:18 oisdk joined
09:18 Sampuka joined
09:18 <tdammers> I guess the manga industry operates under similar pressures as the video game industry in the US
09:18 <capisce> halogenandtoast: how is your Japanese?
09:19 <james999> tdammers: that's likely true. supposedly the industry is shutting down anime studios atm
09:19 Sampuka joined
09:19 <halogenandtoast> capisce: bad, I *might* be N4 level.
09:19 <halogenandtoast> But probably not.
09:20 <james999> halogenandtoast: if you could go back in time and go to china or south korea would you?
09:20 <halogenandtoast> james999: I dreamed of moving to Japan since I was 6 years old and started doing Origami. I visited Japan 4 times in 3 years before I moved here. This is where I want to be and the only place I want to be right now in my life.
09:21 <halogenandtoast> I don't see that changing any time soon either.
09:21 <james999> ah ok, fair enough
09:22 <halogenandtoast> james999: If I found myself at a shitty company that would probably be different.
09:22 <james999> being jobless in an asian country would be like a nightmare for me though
09:22 <james999> i'd be like kaiji, wandering the streets trying to find a pachinko parlor to get rich off of
09:22 xtreak joined
09:23 <halogenandtoast> james999: When I got let go I had several weeks and severance pay.
09:23 <halogenandtoast> I had a job in 3 days from finding out I was going to be let go
09:23 primal joined
09:23 <halogenandtoast> technically I could have moved back to the US
09:23 <halogenandtoast> I did very little wandering, I wish you the same luck if it ever happens to you :p
09:23 <james999> well it sounds like your had a combo of skill and luck and are in a good position
09:23 cschneid_ joined
09:23 <james999> i'm kinda envious. :D
09:23 tremon joined
09:24 <capisce> I wouldn't mind living in Japan although I'd worry about dealing with the bureaucracy and tax implications
09:25 bennofs joined
09:26 <halogenandtoast> capisce: I'll let you know how it goes, I've only been here a year
09:26 <halogenandtoast> Actually 1 year, 1 day!
09:27 <ski> @where PCPH
09:27 <lambdabot> "Parallel and Concurrent Programming in Haskell" by Simon Marlow in 2013 at <http://community.haskell.org/~simonmar/pcph/>,<http://chimera.labs.oreilly.com/books/1230000000929/>
09:27 litchblade joined
09:27 xtreak joined
09:27 tristanp joined
09:28 louispan joined
09:29 primal_ joined
09:30 Gurkenglas joined
09:30 bollu joined
09:31 <halogenandtoast> Anyways james999 if you ever find the time come and checkout Tokyo yourself
09:31 <halogenandtoast> the vending machines are plentiful and full of soft drinks and ice cream
09:31 <halogenandtoast> and that's about it.
09:32 meandi joined
09:32 balor joined
09:34 wroathe joined
09:34 oisdk joined
09:35 locallycompact joined
09:36 ErinvanderVeen joined
09:36 jedws joined
09:37 Icewing joined
09:38 FreeBirdLjj joined
09:38 primal joined
09:39 brailsmt joined
09:39 tromp joined
09:41 path[l] joined
09:41 fendor joined
09:42 <sternmull> it looks like i could use runParser' of megaparsec to incrementally parse input. But how do i get the initial state? There is a Text.Megaparsec.Prim.initialState which is used inside megaparsec but is not exported.
09:43 <fendor> good morning, what is the best practive for command line argument parsing in haskell? getopt?
09:43 lc_ joined
09:43 <brynedwards> fendor: check out optparse-applicative
09:44 <fendor> brynedwards, thanks!
09:44 im0nde joined
09:45 test42893121525 joined
09:47 oisdk joined
09:48 primal_ joined
09:50 inad922 joined
09:50 cretiq joined
09:50 engil1 joined
09:55 primal joined
09:59 <quchen> fendor: Depends on the complexity of your CLI.
09:59 <quchen> There is also a very crude but usable implementation in Base.
09:59 <quchen> System.GetOpt? Something like that.
10:00 <quchen> For anything more complex, optparse-applicative is the better choice.
10:00 uglyfigurine joined
10:01 primal_ joined
10:01 oisdk joined
10:02 <fendor> it's not that complicated, but i think, it is worth the time, since i hate to write IO stuff on my own
10:02 <fendor> so, i'm giving optparse a try
10:02 <fendor> and so far, i am happy with that
10:03 <brynedwards> System.Environment.getArgs would be the simple one
10:04 <brynedwards> Or another simple method
10:04 <fendor> yes, this is what i'm currently using
10:04 <brynedwards> I didn't know base had GetOpt
10:05 <fendor> i have the use case, that either two flags will be supplied or one flag, i do not want to accomplish this via pattern mathing
10:05 <fendor> since this is not the only option, the same applies for a second option
10:05 <fendor> i mean, there is some branching involved
10:06 juanpaucar joined
10:07 chichou joined
10:08 flatmap13 joined
10:09 louispan joined
10:10 vili_ joined
10:10 primal joined
10:11 mstruebing joined
10:12 zariuq joined
10:13 yellowj joined
10:15 <tobiasBora> Hello,
10:15 primal_ joined
10:16 m0rphism joined
10:16 <tobiasBora> What is the good function to do a real modulo? Which is, I want that "a `mod2` b" is always positive
10:16 balor joined
10:16 <tdammers> another option is to use something like parsec to write an argument parser
10:17 xall joined
10:17 <quchen> tobiasBora: https://hackage.haskell.org/package/base-4.9.1.0/docs/Data-Fixed.html#v:mod-39-
10:17 <tobiasBora> because with `mod` we have strange things : -2 `mod` 10 /= 8 `mod` 10...
10:17 <fendor> tdammers, optparse seems to be a parser that does exactly that
10:17 oisdk joined
10:17 <ahihi> tobiasBora: you want (-2) `mod` 10
10:17 vili_ joined
10:17 <tobiasBora> ahihi: ahhhhh
10:18 <quchen> > (-2) `mod` 10
10:18 <lambdabot> 8
10:18 <quchen> > (-2) `rem` 10
10:18 <lambdabot> -2
10:18 <tdammers> > (-10) `mod` (-7)
10:18 <lambdabot> -3
10:18 <tobiasBora> everything is clear now, thank you ^^
10:19 <tobiasBora> And by the way, I've a data where I'd like to define a (+) operation
10:20 <quchen> Unary minus is fairly broken, I know, but that -2 `mod` 10 is parsed as -(2 `mod` 10), that’s a new one.
10:20 <tobiasBora> but I don't want to define (*) because it's not defined
10:20 <tobiasBora> Is there a better option that Num ?
10:21 <tobiasBora> Or, maybe it's possible to raise an error if I multiply to instances, instead of giving a stupid result ?
10:21 louispan joined
10:22 oisdk joined
10:23 netheranthem joined
10:23 primal joined
10:23 tomphp joined
10:24 <fendor> tobiasBora, well undefined or error should work, shouldn't it? also, if you only want addition, a monoid could make sense
10:24 jedws joined
10:25 <tobiasBora> fendor: I looked at the monoid, but it seems less confortable to use, because I don't see the (+) operation, it's "append" instead
10:25 <tobiasBora> fendor: and I forgot the undefined, good idea !
10:25 <fendor> tobiasBora, if i'm right in memory, (<>) is a shortcut for `mappened`
10:25 <fendor> > "Hello " <> "World"
10:26 <lambdabot> "Hello World"
10:26 balor joined
10:26 <fendor> then you can use (<>) instead of (+)
10:26 <fendor> depending on the usecase, i could make more sense
10:27 louispan joined
10:28 meoblast001 joined
10:29 <tobiasBora> ok thank you. In my case it's really number that I want to add, so + is clearer I think, but it's good to know
10:30 bablisok joined
10:30 louispan joined
10:31 <* hackage> wryte 0.1.0.0 - Pretty output for source generators https://hackage.haskell.org/package/wryte-0.1.0.0 (TobiasDammers)
10:31 heurist` joined
10:33 oisdk joined
10:34 primal_ joined
10:34 jaspervdj joined
10:35 plugin joined
10:36 oisdk joined
10:39 fotonzade joined
10:44 primal joined
10:44 systadmin joined
10:49 <ertes-w> tobiasBora: the question is not whether it's a numeric type, but whether it's the commutative ring-like structure that Num wants it to be
10:49 primal_ joined
10:50 <ertes-w> tobiasBora: but for historical reasons Num is kind of a bullshit class… it shouldn't include both the ring operations and fromInteger, and the abs/signum stuff is also misplaced
10:51 tomphp joined
10:51 oisdk joined
10:51 balor joined
10:52 descender joined
10:53 <fendor> ertes-w, there is a num prelude that tries to fix that, haven't really looked into that, but it might be fixed there?
10:54 oisdk joined
10:55 <cocreature> ertes-w: fromInteger makes sense for rings
10:55 mstruebing joined
10:56 <ertes-w> cocreature: you're right
10:56 <cocreature> but it would be nice to have a class that only contains fromInteger and make that a superclass of Num
10:57 TCZ joined
10:57 <ertes-w> well, Num used to be much worse… it's good enough for most things these days
10:57 silver joined
10:58 <ertes-w> but you can't have integer literals for things that aren't rings, which is unfortunate
10:58 vydd left
10:58 joco42 joined
10:59 vydd joined
10:59 primal joined
11:00 <cocreature> yeah
11:00 <ertes-w> i came into haskell when Num had Eq and Show constraints
11:00 <cocreature> ertes-w: RebindableSyntax :P
11:01 <ertes-w> for some reason even haskell-beginner-me thought: "that's kinda stupid", but he couldn't yet tell why =)
11:01 <Logio> cocreature: I remember having a situation where having the fromInteger was a definite liability
11:01 <ertes-w> Logio: it can't be a liability… every ring has a 1 element
11:01 <cocreature> and you get the rest by fromInteger (1 + … + 1) = fromInteger 1 + … + fromInteger 1
11:02 <ertes-w> Logio: fromInteger doesn't have to be efficient, but its existence follows from 1 and (+)
11:02 <Logio> ertes-w: yes, but you can map the rest of the elements in quite nonobvious ways
11:02 <ertes-w> Logio: then (+) is your liability, not fromInteger =)
11:03 <ertes-w> you can't really have a situation where (+) is easy, but fromInteger is hard
11:03 vydd left
11:04 primal_ joined
11:06 <Logio> It's not that it is hard, but the fact that it can make things more error-prone
11:06 louispan joined
11:07 <cocreature> how so?
11:07 <Logio> let me see if I find the example I'm thinking of
11:07 flatmap13 joined
11:07 mr_sm1th joined
11:08 bjz joined
11:09 mheinzel joined
11:09 toby1851 joined
11:09 primal joined
11:10 juanpaucar joined
11:10 <Logio> say you have a Num instance for a Boolean ring
11:10 <Logio> is a + a == 2 * a ?
11:11 cschneid_ joined
11:14 louispan joined
11:14 bablisok joined
11:14 <cocreature> ah I think I get your point
11:15 <ertes-w> a + a = 1*a + 1*a = (1 + 1)*a = 2*a
11:15 mstruebing joined
11:15 <ertes-w> so yes
11:15 <cocreature> ofc it’s true but it’s at least slightly confusing to use integer literals in a boolean context
11:15 <Logio> yes, that's the problem
11:15 <ertes-w> why is it confusing?
11:16 <ertes-w> at least to me it's straightforward
11:16 <ertes-w> it's just a surprising law perhaps, but it's true regardless
11:16 jbiesnecker joined
11:17 <cocreature> it’s not surprising that it’s true. it’s surprising to see an integer literals when you expect to see a boolean.
11:17 ziocroc2 joined
11:17 <ertes-w> is it? aren't booleans always introduced as 0 and 1? as in: "programmers think in terms of zeroes and ones" =)
11:17 <Logio> yes, but there is no 2 :)
11:17 <ertes-w> Logio: there is
11:17 <ertes-w> 2 = 0
11:17 im0nde joined
11:18 <ertes-w> think modulo 2
11:18 <ertes-w> it may be less surprising to me, because i have some basic crypto background, so thinking modulo n is not that alien to me
11:19 louispan joined
11:20 primal_ joined
11:20 <Logio> I can think in modulo, my problem is that I'm not sure I should be hiding that using fromInteger
11:21 <ertes-w> you're not really hiding it… fromInteger is a monoid homomorphism (or rather a group homomorphism in the case of Num) from Integers and (+) to your Num instance and (+)
11:22 takle joined
11:24 oisdk joined
11:24 davr0s joined
11:24 bollu joined
11:25 <Logio> of course it should be
11:27 <Logio> but does everyone implementing a Num instance actually check that?
11:29 <Logio> like for the boolean ring, there are a lot of ways to implement fromInteger that are wrong, but intuitive
11:29 ertes joined
11:30 louispan joined
11:30 primal joined
11:31 <ertes-w> the most obvious implementation maps evens to false, odds to true
11:32 ^bschafer1 joined
11:32 Johan_L joined
11:32 Velizar joined
11:32 <Logio> that's obvious if you are used to thinking in modulo-2
11:33 <Logio> whereas quite a few programming folks would agree that mapping 0 to false and everything else to true would be perfectly fine
11:34 <Logio> which it is not, but with Num being lawless territory they might get away with
11:34 <Velizar> Which data type can I use to model a simulation with 100x100 cells, which changes individual cells a lot but still has okay-ish performance? e.g. I was considering IOArray and ByteString
11:35 <cocreature> Velizar: do you need to change individual cells or do all cells change at each frame?
11:36 <Velizar> cocreature: One cell at a time - the next step needs to be with that cell changed.
11:37 ghbr joined
11:38 jadrian joined
11:39 brailsmt joined
11:39 <cocreature> Velizar: I would go for a mutable unboxed vector
11:39 <Logio> ertes-w: another niggle I have is that with having fromInteger, people will easily expect the ring to be commutative
11:40 primal_ joined
11:40 bennofs joined
11:40 <Logio> which really might not be true
11:40 tromp joined
11:41 <cocreature> Velizar: if unboxing does not make sense in your application or you are fine with losing a bit of performance, https://hackage.haskell.org/package/matrix-0.3.5.0/docs/Data-Matrix.html provides a nice API on top of vector for matrices
11:41 <ertes-w> Logio: yeah, i get your point, but of course instances like that aren't correct and require a bug-fix
11:42 <ertes-w> Logio: the trouble here is that "Num" is just a bad name for "Ring" =)
11:43 <Logio> "Commutative Ring", I would say
11:43 pbogdan joined
11:44 <ertes-w> Logio: why? Num instances don't need to be commutative rings
11:44 <Velizar> cocreature: I'll obviously be using setElem. What is its complexity? The documentation doesn't mention that.
11:45 <cocreature> Velizar: oh sorry I forgot that you want to set individual elements. in that case matrix doesn’t help
11:45 <Logio> ertes-w: but people expect them to be, not knowing any better
11:45 <cocreature> Velizar: just use an unboxed vector and write a helper for setting two dimensional indices
11:46 <ertes-w> Logio: that's more a statement about haskell education than about Num itself =)
11:47 <Logio> well, I'm trying to make the point that having fromInteger in Num is not helping Haskell education :)
11:48 zcourts joined
11:48 <Logio> ... though any other way probably wouldn't be any better
11:49 <Logio> but the commutativity is really a hard thing to keep track of
11:49 gestone joined
11:49 bollu joined
11:49 primal joined
11:50 <Logio> with Num not having anything to say about it, I can't rely on a library handling my non-commutative Nums correctly
11:51 flatmap13 joined
11:51 raichoo joined
11:51 <ertes-w> Logio: i oppose the idea to make classes "beginner-friendly"
11:52 <ertes-w> yes, the type of foldMap is not easy to read to a beginner, but it's very powerful… here it's the teacher's job to introduce foldMap properly
11:53 <ertes-w> the "beginner-friendly foldMap" would be one that is specialised to lists, and i'm glad that's gone =)
11:53 bablisok joined
11:54 wroathe joined
11:54 <mniip> Data.OldList?
11:56 stevenxl joined
11:57 <Logio> ertes-w: Being strictly correct is actually my idea of beginner friendly
11:57 mnoonan joined
11:57 ghbr joined
11:57 <Logio> not letting people make mistakes is better than being easy
11:57 meba joined
11:58 oisdk joined
11:58 xtreak joined
11:58 quchen_ joined
11:58 <ertes-w> Logio: what do you propose? adding dependent types and strict termination checking to prove that fromInteger is actually a homomorphism? ;)
11:59 <ertes-w> and i question the beginner-friendliness of that =)
11:59 <Velizar> Is there a good implementation of a data structure similar to Scala's Vector - immutable and with effectively constant update time?
11:59 phaji joined
11:59 <* hackage> dictionaries 0.2.0.2 - Tools to handle StarDict dictionaries. https://hackage.haskell.org/package/dictionaries-0.2.0.2 (zohl)
11:59 <Logio> ertes-w: well, that would be better :P
12:00 fendor joined
12:01 asm_ joined
12:01 <cocreature> Velizar: you don’t get better than log n for updates with immutable data structures and if you take constant factors into account it’s often even significantly worse than that
12:01 <ertes-w> Velizar: it's called a 'rope' data structure, and you can construct it using the 'fingertree' package
12:01 <Logio> ertes-w: but just having Num changed to Ring would force complete beginners to look up basic algebra before implementing anything, which probably would be helpful
12:01 <Velizar> logn is fine. I'll look at rope
12:02 ghbr joined
12:06 filterfish joined
12:09 romank joined
12:09 Bardusbasium joined
12:09 primal_ joined
12:10 aphorisme joined
12:12 <Athas> cocreature: you can get O(1) updates if you are willing to accept slower indexing.
12:12 <cocreature> fair enough
12:12 jaspervdj joined
12:13 robotroll joined
12:13 <Athas> The 'Parallel Functional Arrays' paper by Ananya Kumar, Guy Blelloch, and Robert Harper even shows how the "slower indexing" need not be so bad.
12:14 wroathe joined
12:14 juanpaucar joined
12:15 bjz joined
12:16 desku joined
12:16 zcourts joined
12:17 ghbr joined
12:19 oisdk joined
12:19 primal joined
12:22 jesyspa joined
12:22 bablisok joined
12:24 plugin joined
12:24 jedws joined
12:24 ExcaliburZero joined
12:25 ExcaliburZero left
12:25 meoblast001 joined
12:28 aphorisme joined
12:29 ertes joined
12:29 primal_ joined
12:30 mbrock joined
12:30 epsilonhalbe joined
12:32 oisdk joined
12:34 fizruk joined
12:35 ph88^ joined
12:36 jbiesnecker joined
12:39 robotroll joined
12:40 <ph88^> how can i make a tarball ready for binary release with stack ?
12:41 sbodin joined
12:43 jnesz joined
12:44 jadrian joined
12:44 wroathe joined
12:45 primal__ joined
12:45 jleon joined
12:45 <jakub_> hello, I am trying to understand DT via implementing a library for handling and extending statically sorted expressions: https://github.com/jakubdaniel/expressions (beware I rewrite the commits quite a lot) and I got stuck at adding functionality such as substitution, would anybody here be willing to skim the definitions in Utils.Indexed.Functor and Expression.* and help me understand what needs to be
12:45 coltfred joined
12:45 <jakub_> changed to allow for a general substitution to be defined?
12:49 zcourts joined
12:49 mjs2600 joined
12:50 sdothum joined
12:50 jbiesnecker joined
12:51 <jakub_> I am stuck at the fact that the substitution would have to match the Sort of the "pattern" that I am looking for with the actual Sort of a subexpression deep down in the AST, since most of that information is only static I tried different things: 1. use SingI to be able to materialize the sort whenever I need it (there I conflicted with my definition of imap and nothing I tried fixed that) 2. include the
12:51 <jakub_> sort dynamically as a value which didn't really help.
12:52 <jakub_> most things I tried worked for some of my functors (VarF, BoolF, ...) but not others (ArrayF, EqualityF, ArithmeticF)
12:52 xtreak joined
12:55 yqt joined
12:55 wroathe joined
12:56 zuck05 joined
12:57 jeirosz joined
12:57 primal joined
12:58 tromp joined
13:01 mrArkwright joined
13:02 zariuq joined
13:02 jeirosz joined
13:02 vaibhavsagar joined
13:03 oisdk joined
13:05 primal_ joined
13:05 wroathe joined
13:07 jeirosz joined
13:07 rcschm joined
13:07 chlong joined
13:08 Mon_Ouie joined
13:08 jeirosz joined
13:09 mrArkwright joined
13:10 primal joined
13:13 meba joined
13:13 Wuzzy joined
13:13 iAmerikan joined
13:14 rcschm joined
13:15 <mbrock> it's always so hard to figure out how to build a static binary
13:15 wroathe joined
13:15 zcourts joined
13:16 zcourts joined
13:17 cdg joined
13:17 zcourts joined
13:17 plugin joined
13:17 alx741_ joined
13:18 <* mbrock> tries some more random command line arguments
13:19 bendo joined
13:20 <sternmull> mbrock: Why that? External libraries or because of haskell itself?
13:20 primal_ joined
13:21 oisdk joined
13:22 spacecadetbrown joined
13:23 plugin joined
13:24 beekill95 joined
13:24 plugin_ joined
13:24 Xanather joined
13:25 wroathe joined
13:26 primal joined
13:27 rukusza joined
13:28 not_on_fp joined
13:29 <mbrock> sternmull: right now ghc is trying to do something with libncurses.so and failing. I'm in an Alpine-based GHC Docker image. Actually I didn't try building non-statically, will try that now :)
13:29 uglyfigurine_ joined
13:30 brailsmt joined
13:30 jae2 joined
13:30 davr0s joined
13:31 bablisok joined
13:32 primal_ joined
13:32 ghbr joined
13:32 ristos joined
13:32 jathan_ joined
13:33 fendor joined
13:34 exferenceBot joined
13:35 cpennington joined
13:35 carlomagno1 joined
13:36 wroathe joined
13:36 mjs2600 joined
13:36 dbmikus joined
13:38 <Geekingfrog> What's the command in ghci to see what's been evaluated in a data structure ?
13:38 kritzcreek joined
13:39 ExcelTronic joined
13:39 ianclark joined
13:39 <cocreature> Geekingfrog: :print iirc
13:39 <Geekingfrog> Thanks
13:40 <Geekingfrog> Is there a strict (+) somewhere? like (+!) ?
13:40 oisdk joined
13:40 <cocreature> (+) is strict at least for the popular instances like Int, Integer, …
13:40 primal joined
13:41 arpl left
13:43 uglyfigurine joined
13:43 soporhs joined
13:43 mac10688 joined
13:43 ExcelTronic joined
13:44 prkc joined
13:44 <* hackage> json-feed 0.0.0 - JSON Feed https://hackage.haskell.org/package/json-feed-0.0.0 (fozworth)
13:46 <tsahyt> hello! I'm working with a relatively large data transformation pipeline in which each operation transforms the data such that another invariant is ensured. some parts can be reordered. some operations must assume that one invariant or another already holds. So I was thinking of adding a phantom parameter to my type and encoding which properties are required and which hold after execution of each part. Now
13:46 <tsahyt> ideally I'd like my phantom parameter to be a set such that I can check membership.
13:46 <tsahyt> iirc extensible-effects has some machinery for that, but is there something similar that doesn't require me to pull in a completely unrelated package?
13:46 bvad joined
13:47 <c_wraith> tsahyt: will you ever need to generate one of these things dynamically? ie, such that you don't know what its type is until runtime?
13:47 zuck05 joined
13:47 <tsahyt> basically I'd like to write something like transform :: Holds Invariant1 k => Foo k -> Foo (Invariant2 <| k)
13:47 <tsahyt> c_wraith: no
13:47 simendsjo joined
13:47 <tsahyt> the values start out with no property holding
13:47 ystael joined
13:47 <tsahyt> and if they do happen to hold, there's no harm in doing the operation anyway, since they're all idempotent
13:48 ziocroc3 joined
13:48 kmels joined
13:48 <c_wraith> tsahyt: then that means you can can work with any old type-promoted list and use a type family for checking if a type is in it.
13:48 <Rotaerk> hmm wonder if I should start using machines rather than pipes
13:49 <c_wraith> Rotaerk: machines is still considered experimental, whereas pipes is considered ready for real use.
13:49 <Rotaerk> ah
13:49 <tsahyt> c_wraith: currently I'm using promoted lists, but I was wondering whether I can get away without implementing elem on the type level myself
13:49 <tsahyt> not that it'd be hard
13:49 latro`a joined
13:49 <tsahyt> in the spirit of the language I'm just lazy :P
13:50 <tsahyt> I've found some open union packages but it seems that only the implementation in extensible-effects comes with the membership check type family
13:50 <simendsjo> I'm having some problems grokking monad transformers. I cannot seem to find any tutorial or examples that use it at the application level. I'd like to see the combination of Reader, State, Either and possibly other monads in action thinking it might help my understanding. Does anyone know of some simple projects using this sort of stack?
13:50 <lyxia> tsahyt: singletons and hlist have type-level list operations defined
13:50 primal_ joined
13:51 locallycompact joined
13:51 <ertes-w> tsahyt: personally i would probably just use concurrency, potentially with STM
13:51 plugin joined
13:53 Icewing joined
13:53 <tsahyt> lyxia: hlist looks interesting. I somehow prefer not to use singletons unless I really need it. it always sends me down a rabbit hole that is just way too deep.
13:53 aphorisme joined
13:53 <tsahyt> ertes-w: concurrency is orthogonal here, isn't it?
13:53 <c_wraith> yeah, singletons are great when you need to be able to round-trip between type and value. But if you don't, it's not necessary
13:53 <mheinzel> simendsjo: hython (a simple Python interpreter) uses a stack of ExceptT, ContT, StateT. About 2000 lines of code, took me 1 or 2 days to get familar with the code base and taught me a lot.
13:54 <mheinzel> simendsjo: https://github.com/mattgreen/hython
13:55 dsh joined
13:55 <simendsjo> mheinzel: Thanks. I'll look into it. I'm a pre-newbie, so hopefully it doesn't use too much advanced stuff.
13:55 bablisok joined
13:55 <ertes-w> tsahyt: it's a processing pipeline, and you can read data only once certain invariants check
13:56 <ertes-w> tsahyt: meanwhile you can keep processing other items, if applicable
13:56 wroathe joined
13:56 jleon joined
13:56 <tsahyt> ah, no. all data is available from the start and needs to be processed in full before the next step can begin
13:56 <ertes-w> ah, i see
13:56 <tsahyt> it's a rather elaborate transformation on a syntax tree
13:56 <mheinzel> Well, apart from monad transformers in themselves, the most complex concept used is continuation passing (ContT). It's used for control flow handling (exceptions, loops with break and continue etc.)
13:57 fragamus joined
13:57 <tsahyt> normalizing, rewriting, flattening, synthesis of invariants, grounding free variables, and so on. for example the grounding and synthesis of invariants can be performed in either order
13:58 darlan joined
13:58 <ertes-w> simendsjo: think simple: "transformer" is really just a fancy word for "function" (with some extra guarantees), in this case taking a monad and returning a monad… for example MaybeT is such a function: MaybeT :: (* -> *) -> (* -> *)
13:59 <ertes-w> simendsjo: (MaybeT m) happens to be a monad, whenever m is a monad: instance (Monad m) => Monad (MaybeT m)
13:59 <ertes-w> simendsjo: and there is a way to lift m-actions to (MaybeT m)-actions
13:59 Oxit_ joined
14:00 primal joined
14:01 <simendsjo> ertes-w: I've read quite a bit about monad transformers, and while it seems to make sense at the low-level, I cannot seem to wrap my head around how to use it when stacking a lot of them. Does the order matter? How can I pass only what is needed to functions rather than the entire thing, etc.
14:01 Jesin joined
14:01 <simendsjo> .. so it's obviously quite some lack of understanding :/
14:01 juanpaucar joined
14:02 <ertes-w> simendsjo: you figure it out on a transformer-by-transformer basis, and yes, the order matters
14:02 <ertes-w> @unmtl StateT s (MaybeT m)
14:02 <lambdabot> Plugin `unmtl' failed with: `StateT s (MaybeT m)' is not applied to enough arguments, giving `/\A. s -> m (Maybe (A, s))'
14:02 <tobiasBora> Hello,
14:02 r444 joined
14:02 <tsahyt> the type-fun package looks like a good middle ground
14:02 <tsahyt> and it has type level Elem for promoted lists
14:02 <ertes-w> @unmtl StateT S (MaybeT M)
14:02 <lambdabot> Plugin `unmtl' failed with: `StateT S (MaybeT M)' is not applied to enough arguments, giving `/\A. S -> M (Maybe (A, S))'
14:02 <r444> https://gist.github.com/dredozubov/7b696f3eeb6688f1198c1cb8aab33fda can someone explain why i'm getting an error on line 10?
14:02 <tobiasBora> I'd like to do a mapping on a matrix defined from Matrix.Data
14:02 <tobiasBora> *Data.Matrix
14:03 oisdk joined
14:03 <tobiasBora> however, I cannot find a map that work on all the matrix
14:03 <r444> tsahyt: what a time to join a channel, we made type-fun at work
14:03 <tobiasBora> do you have any solution for that?
14:03 <ertes-w> simendsjo: ideally you write your actions using effect classes like MonadState or MonadIO, and only when you actually run an action you should instantiate a particular stack
14:03 <simendsjo> ertes-w: It's just when I write `type App = StateT AppState (ReaderT AppGlobals (ExceptT AppError IO))`, my head starts spinning, and I have no idea where to go next :)
14:04 <mbrock> ok, got further with using stack to build static binary. next problem: stack seems to be trying to create some shared objects, which fails because of libHSghc stuff not being -fPIC. I don't want any shared objects, just a big fat static binary
14:04 <tsahyt> dredozubov_: I've never used it before but right now it looks like it could work perfectly for what I need
14:04 <dredozubov_> we just assembled some type families that were used all over the place in one package
14:04 <ertes-w> simendsjo: sometimes backtracking is the nicest option: this is the monad i would use in that case: type App = StateT AppState IO
14:04 <dredozubov_> the one I use most is AllSatisfy
14:05 shapr joined
14:05 <dredozubov_> tsahyt: feel free to contribute if you feel like it lacks something
14:05 <tobiasBora> ok I found the solution: fmap
14:06 <tsahyt> dredozubov_: I'll keep it in mind. right now my needs are rather minimal. this looks like a rather complete collection of working with '[] already.
14:06 <c_wraith> dredozubov_: that looks like a ghc shortcoming more than anything.
14:06 nut joined
14:06 aphorisme joined
14:07 codygman_ joined
14:07 <nut> with Parsec, how to match the name part of "Dan Clark’s Profile Photo"
14:07 <nut> each line contains "Dan Clark’s Profile Photo"
14:07 <tsahyt> hmm, the error messages this generates are interesting
14:07 <dredozubov_> c_wraith: it feels to me that way too
14:07 <nut> with different names
14:08 <tsahyt> I suppose they are somewhat descriptive though
14:08 <c_wraith> dredozubov: but maybe not.. I'm a bit confused about what's going on with line 6. do you mean to have a type family as an argument to a data constructor? That doesn't make much sense
14:08 primal_ joined
14:08 <tsahyt> I wish ghci didn't expand constraint synonyms when using :t
14:09 <dredozubov_> c_wraith: oh heck, there's a typo on line 6
14:09 <c_wraith> dredozubov_: well is that the cause then?
14:09 <dredozubov_> it should say Builder
14:09 <c_wraith> Ah. Ok, that should probably make it work
14:09 <dredozubov_> seems like it!
14:09 tomphp joined
14:09 <dredozubov_> it's a relief
14:09 <c_wraith> dredozubov_: I spent too much time looking at the wrong line. :)
14:10 <dredozubov_> I was afraid I stumbled upon a cryptic ghc bug
14:10 psmolen joined
14:10 <dredozubov_> it feels good when you discover you made a stupid mistake and it's not a compiler bug :)
14:11 wroathe joined
14:11 <c_wraith> :)
14:11 <* hackage> dhcp-lease-parser 0.1 - Parse a DHCP lease file https://hackage.haskell.org/package/dhcp-lease-parser-0.1 (andrewthad)
14:11 jbiesnecker joined
14:13 primal joined
14:13 tromp joined
14:14 dddddd joined
14:14 erc-current-nick joined
14:14 Bardusbasium joined
14:14 muppeth[m] joined
14:17 muppeth[m] left
14:18 etehtsea joined
14:18 zcourts joined
14:20 oisdk joined
14:20 test joined
14:20 primal_ joined
14:21 eschnett joined
14:23 simukis joined
14:24 soporhs joined
14:25 sepp2k joined
14:25 ownclo joined
14:26 afarmer joined
14:26 ownclo left
14:26 davr0s joined
14:26 halogenandtoast joined
14:27 filterfish_ joined
14:27 ownclo joined
14:27 ownclo left
14:28 soporhs joined
14:28 red_crow joined
14:30 red_crow joined
14:30 primal joined
14:31 Bardusbasium_ joined
14:31 wroathe joined
14:33 systadmin joined
14:34 aphorisme joined
14:35 mjs2600 joined
14:35 shangxiao joined
14:37 zcourts joined
14:39 cretiq joined
14:40 primal_ joined
14:42 soporhs joined
14:43 pat____ joined
14:44 Kreest_ joined
14:44 cretiq joined
14:44 <pat____> hi everybody, does anybody know a good in-depth paper on haskell types?
14:44 swalladge joined
14:45 <shapr> pat____: wait, you want just one?
14:45 <shapr> pat____: have you seen Types and Programming Languages by BC Pierce?
14:45 jbiesnecker joined
14:46 refold joined
14:46 beaups1 joined
14:46 andrei joined
14:46 <pat____> shapr: gonna check, but I was looking for something specific to haskell
14:47 <shapr> oh, TaPL is more generic
14:47 <pat____> that'd explain function signature in details, all that stuff
14:47 <shapr> pat____: do you have a specific viewpoint on types in Haskell?
14:47 <shapr> ohh
14:48 <shapr> most of the Haskell books are good about that
14:48 <shapr> I've heard good things about Graham Hutton's Programming in Haskell book
14:48 <shapr> I've read the 1st edition, and the 2nd edition arrived in the mail this week
14:48 etehtsea joined
14:49 jbiesnecker_ joined
14:49 <pat____> I have the second edition, same it's pretty basic about data types
14:50 <andrei> I have a megaparsec/trifecta question. I have this simple parser. It attempts to just parse either the string "A" or "A A". p s = parse ((string "A" >> return 0) <|> (string "A" >> space >> string "A" >> return 1) >>= (\x -> eof >> pure x)) "" s
14:50 bvad_ joined
14:50 primal joined
14:50 <andrei> But it doesn't parse "A A". It always fails. Even if I wrap every expression/subexpression in try
14:51 Achylles joined
14:51 <andrei> What's going on?
14:51 yogsototh joined
14:51 wroathe joined
14:52 HarveyPwca joined
14:53 bvad joined
14:53 ludat joined
14:54 <shapr> pat____: what sort of details do you want about type signatures? forall? skolemization?
14:55 coltfred joined
14:55 bablisok joined
14:57 red_crow joined
14:57 cretiq joined
14:58 <pat____> shapr: yes, forall, skolemization, not sure what it is :), but as muchas possible, to me it looks like a huge subject but there's little info about it, specially when working with all the abstract data types, monads applicative etc.
14:58 ingars joined
14:58 epsilonhalbe left
14:59 Eduard_Munteanu joined
14:59 plugin joined
15:01 <* hackage> watchdog 0.2.3 - Simple control structure to re-try an action with exponential backoff https://hackage.haskell.org/package/watchdog-0.2.3 (JanVornberger)
15:01 primal_ joined
15:01 perrier-jouet joined
15:03 theelous3 joined
15:05 sssilver joined
15:07 red_crow joined
15:10 primal__ joined
15:11 cschneid_ joined
15:11 FreeBirdLjj joined
15:11 <lyxia> andrei: (<|>) is not backtracking because your first parser consumes at least one character
15:11 bkonkle left
15:11 Guest70 joined
15:12 <lyxia> oh actually it's also because it succeeds
15:13 <ingars> can you recommend best vim syntax highlight plugins for haskell?
15:13 cretiq joined
15:13 <glguy> vim already highlights Haskell
15:14 <ingars> glgyu - apparently not for me ::)
15:14 meba joined
15:14 <ongy> ingars: :syntax on
15:14 <ingars> VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Apr 4 2017 18:14:54) on a Mac
15:14 bjz joined
15:15 <ingars> ongy: oh, thanks. how could I miss that :/
15:15 <[exa]> glguy: my vimrc line for haskell: autocmd FileType haskell setlocal et ts=2 sw=2
15:15 <[exa]> oh sorry, ingars ^
15:15 <glguy> http://lpaste.net/355625 normal vim has a couple of bugs in string literal syntax
15:15 <[exa]> and also 'syn on' in the vimrc
15:17 <lyxia> andrei: basically, (x <|> y) >>= f is not equivalent to (x >>= f) <|> (y >>= f)
15:17 wroathe joined
15:17 <ongy> isn't there a weird difference between syntax on and syntax enable? I think you want the 2nd in .vimrc
15:17 <glguy> [exa]: does ts=2 set the tab stops to 2?
15:17 <ongy> I think it's TabSize
15:17 <lyxia> andrei: swap the two alternatives so the longer parse comes first
15:18 cretiq joined
15:18 bendo joined
15:19 primal joined
15:19 <glguy> because if so it needs to be 8 for haskell
15:20 <glguy> you can use "soft" tabs as 2
15:21 tjayanth joined
15:21 danza joined
15:23 cretiq joined
15:24 juanpaucar joined
15:24 primal joined
15:26 bvad joined
15:26 vimalloc joined
15:29 mooooooooo left
15:30 primal_ joined
15:34 ianandrich joined
15:37 plugin_ joined
15:37 wroathe joined
15:37 wonko7 joined
15:39 saussure joined
15:41 primal joined
15:41 eazar001 joined
15:42 esph joined
15:42 zzz joined
15:42 Swizec joined
15:44 oisdk joined
15:45 zcourts joined
15:48 ubsan_ joined
15:48 afarmer joined
15:51 primal_ joined
15:52 tomphp joined
15:53 fendor joined
15:53 flatmap13 joined
15:55 yrdz joined
15:58 bvad joined
15:58 mjs2600 joined
15:59 tzh joined
16:00 tomphp joined
16:01 primal joined
16:01 alx741 joined
16:02 oisdk joined
16:02 netheranthem joined
16:02 wroathe joined
16:03 <* hackage> fortran-src 0.1.0.6 - Parser and anlyses for Fortran standards 66, 77, 90. https://hackage.haskell.org/package/fortran-src-0.1.0.6 (madgen)
16:04 oisdk joined
16:05 kmels joined
16:07 conal joined
16:08 dual joined
16:08 bvad joined
16:09 sternmull left
16:11 primal_ joined
16:12 jbiesnecker joined
16:13 tromp joined
16:14 HoierM_ joined
16:15 dni joined
16:16 flatmap13 joined
16:17 <hanna> https://github.com/pxqr/intset seems to have been forgotten, the GHC 7.10 compatibility PR has been sitting unmerged for over a year. This is annoying since I depend on it, and GHC 7.10 users cannot simply `cabal install` my executable without applying the PR first. Is there anything I could do to move forward the process of getting this library patched, under the assumption that the maintainer has given up
16:17 <hanna> on it?
16:18 <hanna> In shorter words: Is there a way to “reclaim” ownership over a seemingly abandoned package with an unresponsive maintainer?
16:18 <ongy> hanna: there's a default process for that on hackage
16:18 medicijnman joined
16:19 <ongy> you have to contact the current maintainer in a public way (email to haskel-caffee with CC or something) and when they don't reply for some time/give permission you can take over ownership
16:19 <ongy> hanna: https://wiki.haskell.org/Taking_over_a_package this here explains it better
16:19 bablisok joined
16:20 urodna joined
16:20 <hanna> Okay
16:20 <hanna> Honestly it seems easier to just fork it and upload my own version under a different name
16:20 <hanna> thanks BSD3
16:20 primal joined
16:21 <ongy> that's easier, but going through the takeover process is technically (and morally) better IMO
16:21 <EvanR> its better to try to contact them first
16:21 <EvanR> saying there is a pull request just sitting there isnt that
16:22 meta33 joined
16:22 <hanna> I tried reaching them on github about a week ago. I wouldn't mind trying to reach them via email either, but I hate mailing lists so there's that
16:22 jbiesnecker joined
16:23 wroathe joined
16:23 <ongy> hanna: in a private message? If it's public on github you may (not sure) be able to speed things up refering to that
16:23 adraenwan joined
16:23 JagaJaga joined
16:23 <hanna> ongy: https://github.com/pxqr/intset/pull/3#issuecomment-302980545
16:25 <* hackage> top 0.2 - Top (typed oriented protocol) API https://hackage.haskell.org/package/top-0.2 (PasqualinoAssini)
16:26 <ongy> I'm no hackage trusty. Try to go the official way, refer to that and see what they say. I did it before and it really isn't that much of a hassle (just takes a bit longer than I hoped)
16:26 <* hackage> vectortiles 1.2.0.5 - GIS Vector Tiles, as defined by Mapbox. https://hackage.haskell.org/package/vectortiles-1.2.0.5 (fosskers)
16:27 refold joined
16:27 earldouglas joined
16:30 bablisok joined
16:30 Sonolin joined
16:31 adraenwan joined
16:31 primal_ joined
16:33 trism joined
16:33 wroathe joined
16:33 HoierM joined
16:35 cyborg-one joined
16:36 Bardusbasium_ joined
16:39 ubsan_ joined
16:41 fragamus joined
16:41 <ertes-w> hanna: you could just fork it
16:41 Johan_L joined
16:41 <ertes-w> intset-hanna or something
16:42 <hanna> I guess that's better than nothing for now
16:42 oisdk joined
16:43 <ertes-w> i guess it would be nice, if hackage packages were user-tagged
16:43 primal joined
16:43 zcourts joined
16:44 <ertes-w> and perhaps there would be some process to select a "default user" for every package
16:45 <EvanR> forking intset ?
16:45 bennofs joined
16:46 gestone joined
16:46 maarhart joined
16:48 netheranthem joined
16:48 perrier-jouet joined
16:50 zuck05 joined
16:51 <hanna> Hmm; I'm trying this approach: 1. reference the fixed version of the package as a `git submodule` in something like extern/intset; 2. make my .cabal build and include that package before using it as a dependency to my own
16:51 <hanna> Is this still possible with build-type: simple or would I need to write my own wrapper to automate the two-stage build?
16:54 dustmote joined
16:54 MetaMutt joined
16:55 fractalsea joined
16:55 jathan_ joined
16:56 Arcanine1 joined
16:56 buttbutter joined
16:56 <hanna> Hmm seems like the best way to accomplish this would be via cabal sandbox
16:56 <hanna> I wonder if I can create a sandbox and issue `cabal sandbox add-source` programmatically
16:57 <hanna> e.g. from a cabal user hook
16:57 <* hackage> soap 0.2.3.4 - SOAP client tools https://hackage.haskell.org/package/soap-0.2.3.4 (AlexanderBondarenko)
16:58 drewbert joined
16:58 mada joined
16:58 wroathe joined
16:59 Discovery joined
17:02 <hvr> hanna: not sure what you're trying to do, but cabal sandboxes are about to go away; see http://cabal.readthedocs.io/en/latest/nix-local-build-overview.html for the new approach
17:02 <orion> hvr: What about stack?
17:03 <hanna> Actually, a sandbox wouldn't solve my use case anyway
17:03 <hvr> orion: different camp/tribe :-)
17:03 <hanna> because then `cabal install` would go into the sandbox :D
17:03 <orion> Do yout think it will become obsolete?
17:03 jbiesnecker joined
17:04 <hanna> That new nix build system seems like it would be perfect though
17:04 <hvr> orion: fwiw, I think you can write a shim/wrapper around new-build which can emulate most of Stack
17:05 sssilver joined
17:05 <hanna> Heh, turns out writing a two-line `cabal.package` solves my problem
17:06 <hvr> hanna: you mean, cabal.project :)
17:06 <hanna> Oops, yes :)
17:07 netheranthem joined
17:08 thc202 joined
17:08 raynold joined
17:08 WhiskyRyan joined
17:09 zzz joined
17:09 wroathe joined
17:09 jbiesnecker joined
17:11 Destol joined
17:14 rblaze left
17:14 MetaMutt joined
17:14 jgertm joined
17:14 <Lokathor> @pl \s -> (rowCount s, colCount s)
17:14 <lambdabot> liftM2 (,) rowCount colCount
17:14 tromp joined
17:15 MetaMutt joined
17:16 <Lokathor> :t liftM2
17:16 <lambdabot> Monad m => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r
17:16 <Lokathor> :t liftA2
17:16 <lambdabot> Applicative f => (a -> b -> c) -> f a -> f b -> f c
17:16 <Lokathor> hmm
17:17 <Taneb> Lokathor, if you like infix stuff, (,) <$> rowCount <*> colCount is an option
17:17 MetaMutt joined
17:17 <Lokathor> well i'm already applying that to a StateT get with <$>
17:17 <Lokathor> so i think using liftA2 prefix-style ends up better
17:18 <Taneb> That's fair enough :)
17:18 <Lokathor> getRowColCount = Hexes $ liftA2 (,) rowCount colCount <$> get
17:18 <Taneb> (this is using the ((->) r) applicative functor if you're not familiar)
17:19 <Lokathor> i'm ever so slightly familiar with -> r being a Functor, but do not recall the applicative portion
17:19 <Taneb> pure :: a -> ((->) r) a ~ a -> r -> a
17:19 <Taneb> @djinn a -> r -> a
17:19 <lambdabot> f a _ = a
17:19 <Lokathor> i can almost read that
17:20 <Taneb> "pure" is of type a -> f a, right, and here f ~ ((->) r)
17:20 <Taneb> So we end up with pure :: a -> r -> a, and there's only one sensible option for that
17:20 <Lokathor> ah, but here's the other one I'm wondering if it's safe to compact down, https://pastebin.com/AYC4VuNa
17:20 <Lokathor> pure = const
17:21 <Taneb> Yes
17:21 <Taneb> Or equivalent
17:21 <shapr> Is there a recommend zero mq library for Haskell?
17:21 <Taneb> (<*>) :: f (a -> b) -> f a -> f b, so here it'd be (r -> a -> b) -> (r -> a) -> r -> b
17:22 <Lokathor> well, now I can say that i've used liftA2 /ever/
17:22 <Taneb> That's a tad less obvious, but even so there's only one sensible option
17:22 <Taneb> @djinn (r -> a -> b) -> (r -> a) -> r -> b
17:22 <lambdabot> f a b c = a c (b c)
17:22 <shapr> kanske den lib zeromq4-haskell är bättre än zeromq-haskell, men jag har ingen aning.
17:22 <shapr> ski: har du användat 0mq på Haskell?
17:23 <Taneb> Lokathor, it's an exercise for the reader to show this is a law-abiding applicative :)
17:23 <Lokathor> Taneb, >_< I just wanted a single lifting! that's all i came here for!
17:23 <* Lokathor> runs away back to his Storable instances
17:23 <Taneb> Lokathor, but learning is fun! :D
17:24 MetaMutt joined
17:24 ertes-w joined
17:24 <Lokathor> I'm doing quite enough other learning at the moment :P
17:25 <Lokathor> Taneb, https://github.com/Lokathor/hexes/blob/master/src/Hexes/Internal.hs :3
17:25 juanpaucar joined
17:25 <hanna> Aah, there's no `cabal new-install` yet :(
17:25 Goplat joined
17:25 <Lokathor> whoops, left off the line number. line 186
17:26 path[l] joined
17:26 afarmer joined
17:26 MetaMutt joined
17:27 <Taneb> Lokathor, I'm impressed with your code-commenting dedication
17:27 WhiskyRyan joined
17:27 <Lokathor> oh I would not be able to work on this for more than one session without those comments :P
17:28 gawen joined
17:29 <Lokathor> EvanR, i used liftA2 for once!
17:29 jadrian joined
17:30 nut joined
17:31 sssilver joined
17:32 iAmerikan joined
17:33 <EvanR> liftA2 rocks
17:33 carlomagno joined
17:33 <shapr> @pl liftA2
17:33 <lambdabot> liftA2
17:33 wroathe joined
17:33 <EvanR> liftA0 :: a -> f a
17:34 <EvanR> liftA1 :: (a -> b) -> f a -> f b
17:34 <EvanR> liftA2 :: (a -> b -> c) -> f a -> f b -> f c
17:34 <EvanR> "it just makes sense."
17:34 <ongy> Lokathor: shouldn't the constants be Num instead of Integral? :)
17:35 <Lokathor> ongy, /possibly/, though I've yet to need to legitimately use any of those Integral i values with a Float value
17:35 <Lokathor> so I'd consider it an error at the moment to try without serious thought
17:37 vgrocha joined
17:41 <Lokathor> EvanR, functor makes sense, applicative less so
17:42 jleon joined
17:44 wroathe joined
17:46 <EvanR> Lokathor: you can see in the above its just a generalization
17:46 <EvanR> mapping a 2 arg function over 2 args
17:47 <EvanR> instead of 1 arg function over 1 arg
17:47 Elish joined
17:47 <Lokathor> i mean i see that
17:47 <Lokathor> hmm i forget which one
17:47 <Lokathor> :t (<*>)
17:47 <lambdabot> Applicative f => f (a -> b) -> f a -> f b
17:48 <Lokathor> that's the spooky one
17:48 <Lokathor> I don't normally keep my functions inside of structures
17:48 <EvanR> ah
17:48 <EvanR> thats just a rearrangement of liftA2
17:48 <EvanR> to allow for A3 A4 A5 etc without special functions
17:48 Bassetts joined
17:49 <EvanR> another rearrangement is :: f a -> f b -> f (a,b)
17:49 epsilonhalbe joined
17:50 sleffy joined
17:50 louispan joined
17:51 <Tuplanolla> @let unit = pure ()
17:51 <Tuplanolla> @let zipA = uncurry (liftA2 (,))
17:51 <lambdabot> Defined.
17:51 <lambdabot> Defined.
17:51 <Tuplanolla> I find this formulation to be useful quite often.
17:52 <Lokathor> :t zipA
17:52 <lambdabot> Applicative f => (f a, f b) -> f (a, b)
17:52 <Tuplanolla> You now have `pure x = fmap (const x) unit` and `f <*> x = fmap (uncurry ($)) (zipA (f, x))`.
17:53 bigos joined
17:53 <EvanR> this is all pretty (nicely) abstract without some examples
17:54 wroathe joined
17:54 oisdk joined
17:54 <Lokathor> I think the trouble is that I want to use Haskell to push bits around most of the time :P
17:54 Adluc joined
17:54 <EvanR> or glyphs around a grid?
17:54 halogenandtoast joined
17:54 <Lokathor> yes :3
17:54 <EvanR> a grid of a is an applicative and a monad
17:55 <Lokathor> how do you figure?
17:55 <EvanR> applicative, (a -> b -> c) -> Grid a -> Grid b -> Grid c would apply the args are each position to the function to get the result in that position
17:55 louispan joined
17:55 Moyst_ joined
17:56 <EvanR> monad Grid (Grid a) would look at the a in the grid at that position... at that position... and flatten
17:56 <EvanR> to get a Grid a
17:56 <EvanR> "diagonalization"
17:56 <Lokathor> but... but... the grid is a Vector.Storable.Mutable.IOVector of Word8 value
17:56 <EvanR> (assuming all grids are the same size)
17:57 <EvanR> mutable? why?
17:57 <EvanR> you can do better than that ;)
17:57 <Lokathor> because you're updating it like all the time?
17:57 rblaze joined
17:58 <EvanR> you can update a Grid all the time ;)
17:58 <Lokathor> doing that immutably is crazytalk piggy
17:58 <ongy> we have a good "Grid" type for haskell?
17:58 <EvanR> no way
17:59 <EvanR> Lokathor: so 60fps ?
17:59 mclaren joined
17:59 <ongy> Lokathor: have you benchmarked it? :)
17:59 <EvanR> > 80 * 25
17:59 <lambdabot> 2000
17:59 <Lokathor> ongy nope, not yet, the full thing doesn't turn on yet
18:00 <EvanR> heres a fast updating grid
18:00 dddddd_ joined
18:00 <EvanR> data Grid a = AllAre a | Update Int Int (a -> a) (Grid a)
18:00 <EvanR> hehe
18:01 <Lokathor> woah woah pal
18:01 <Lokathor> you can't unsafe that into a (Ptr a), no good
18:01 <EvanR> maybe im not understanding the purpose of this grid
18:01 <Lokathor> we wanna push our data to the GPU after all :3
18:01 rmarko joined
18:02 <Lokathor> EvanR, the grid is the library-side data store that holds the data in place to push it to a vertex buffer object
18:02 <EvanR> i thought we were talking about grid of glyphs not a framebuffer
18:02 <EvanR> seems like a drastic difference in data size
18:02 <Lokathor> if the user wishes to maintain their own grid of things, that's fine, but this is much closer to just a fancy framebuffer than an abstract dealio
18:02 MP2E joined
18:02 <ongy> EvanR: something that's at least half way efficient :) But I remember that representation from my isabelle course
18:03 <EvanR> all youre writing is a 2d framebuffer?
18:03 <Lokathor> EvanR, a fancy one, yes
18:03 <EvanR> ongy: fast update, not memory efficient or lookup efficient
18:03 <EvanR> heh
18:03 yellowj joined
18:03 <Lokathor> I'm honestly not sure what I'd want with a generic (Grid a) type that's a Monad
18:03 bollu joined
18:03 <Lokathor> or anything like that
18:03 <EvanR> i was imagining a grid of glyphs
18:04 <EvanR> which is much more abstract than a off screen framebuffer in the gpu
18:04 wroathe joined
18:04 <Lokathor> well, more technically, it's a grid of Word8 values that index into an image which is assumed to contain glyphs :P
18:04 <EvanR> you could associate other data with grid positions than just glyphs so its a functor, monoid monad appl whatever
18:04 <Lokathor> the tile image could really contain whatever you want i guess
18:04 <EvanR> Lokathor: o_O
18:05 <ongy> EvanR: :) But I'm somewhat serious, I still don't know what's the best way to do matrices in Haskell... someone said (Map (Int, Int) a) for sparse, but dense?
18:05 <EvanR> ongy: im not sure. hmatrix?
18:05 <Lokathor> EvanR, this is "curses in open gl", not anything more abstract than that
18:05 <Lokathor> ongy, i'm using linear, but it's really oriented to sizes 1 to 4
18:06 <Tuplanolla> All array libraries for Haskell are unsatisfying.
18:06 <Tuplanolla> Vector and Repa are my favorites, but still...
18:06 <EvanR> the naperian functor paper meetup is coming up
18:06 <EvanR> APLicative programming
18:07 jbiesnecker joined
18:08 <ongy> but to be honest, last I tried to optimize something with vectors I ended up being slower than GHC doing magic with lists
18:09 <EvanR> mutable vectors?
18:09 <Lokathor> EvanR, :O but i thought we hated those?
18:09 <EvanR> im asking because mutable vectors have added gc overhead
18:09 <Lokathor> oh do they?
18:10 <EvanR> yes
18:10 <Lokathor> I thought they performed destructive updates and had less overhead :(
18:10 <EvanR> they mess up generational gc
18:10 dni joined
18:10 <ongy> I think I tried unboxed and boxed non mutables. But maybe I just messed things up
18:10 connrs joined
18:10 <EvanR> or could
18:10 <EvanR> ah
18:10 darjeeli1 joined
18:11 jbiesnecker joined
18:11 primal__ joined
18:11 <EvanR> Lokathor: one thing to internalize about ghc is its very fast at allocating memory
18:11 aarvar joined
18:11 <EvanR> unlike malloc
18:11 <Lokathor> well i need my memory in big blocks that are accessable as (Ptr a)
18:11 BlueRavenGT joined
18:11 <Lokathor> though perhaps it's good at that too
18:11 <ongy> ghc mostly does a "increase this counter" allocation kind, right? Into the nurseries or what they are called
18:12 <EvanR> yes
18:13 jathan_ joined
18:13 <ongy> into Ptr a needs some marshalling
18:13 <EvanR> so the performance burden is really on quickly collecting temporary values
18:14 <ongy> Lokathor: do you give the ptr somewhere and then live update it, or just give it once for copy out and give a new pointer each time?
18:14 <Lokathor> well a mutable vector is a ForeignPtr normally, and then there's an unsafe operation that lets you use the mutable vector as a Ptr
18:14 plugin joined
18:14 <ongy> unsafeCoerce *cough*
18:14 <Lokathor> yeah however
18:14 <EvanR> its not unsafeCoerce
18:15 <ongy> I would be surprised if it is
18:15 <Lokathor> anyway you use that and then call the GL func with the pointer, and GL copies all the data into the GPU's RAM at that point
18:15 <EvanR> *or something
18:15 <EvanR> gl driver magic
18:15 tromp joined
18:16 toby1851 joined
18:17 JuanMiguel joined
18:17 <Lokathor> the important part is that once your gl call returns, it's safe to update the data you gave the pointer for without the GPU's copy of the data being messed up
18:17 <Lokathor> which is all a person could ask for really
18:18 <Lokathor> ah, here's an example from a demo, https://github.com/Lokathor/learnopengl/blob/master/app/Lesson06.hs#L277
18:19 <ongy> ahh gl. i remember why I never did anything serious with it
18:19 MrWoohoo joined
18:20 <Lokathor> ?
18:21 primal___ joined
18:21 <EvanR> gl was another one of those APIs which was like "huzzah, network transparent"
18:22 <Lokathor> didn't know you could run it usefully over a network
18:23 <EvanR> you probably cant
18:23 <ongy> really? doesn't gl rely on DMA most of the time?
18:23 <EvanR> like X11
18:23 mohsen_ joined
18:24 <Lokathor> can't you forward X data from one machine to another?
18:24 <EvanR> sure
18:24 <EvanR> its terrible
18:24 alveric1 joined
18:24 <EvanR> and makes the API terrible
18:24 <ongy> you *can* run X11 over the network, the thing that make problems are extensions (which anything halfway recent uses)
18:24 wroathe joined
18:24 <Lokathor> i did it once in 2006
18:25 inkbottle joined
18:25 <ongy> X-forward?
18:25 Qfwfq joined
18:25 <EvanR> so its not a glyph grid, its a pixmap tile grid
18:25 <EvanR> not even a shader grid? ;)
18:26 bennofs1 joined
18:26 mjs2600 joined
18:26 augur joined
18:26 <EvanR> send grid of shader configs to the gpu
18:26 path[l] joined
18:26 ianclark joined
18:26 <EvanR> the fastest grid in the west
18:27 <Lokathor> the assumption is that the 32 to 127 part of the pixmap will be glyphs
18:27 <Lokathor> and perhaps i'll expand it out a bit once it works at all
18:27 <Lokathor> but rendering text in opengl is terrible enough as it is :P
18:28 <Lokathor> pixelmapped glyphs mean that you can make it perform fallback work as a tile engine, which is cool
18:29 zzz joined
18:29 <EvanR> if you accept shaderism, you have the remote possibility of being abstract with opengl
18:29 <Lokathor> I'm not currently sure how to have the text have an optional foreground color that overrides the pixmap's color
18:29 <Lokathor> shaderism?
18:29 <EvanR> then its not only a pixmap grid, but a vector graphics grid, or grid of whatever data that can be represented within the gpu
18:29 <EvanR> and used gpu side
18:30 <int-e> ongy: OpenGL isn't what it used to be... have a look at OpenGL version 1 and it will not seem so unreasonable to send that over the network anymore.
18:30 <EvanR> yeah commands to manipulate matrices on the gpu side
18:30 <Lokathor> EvanR, I've only been working with ogl for 3 weeks!
18:30 jelleke joined
18:31 <Lokathor> I want to do this thing, then i will proceed with more general ogl learning again and load models and such
18:32 plugin joined
18:33 raichoo joined
18:34 <Lokathor> I haven't eaten in 20 hours
18:34 primal joined
18:34 mac10688 joined
18:34 wroathe joined
18:36 grizwako joined
18:37 connrs joined
18:39 manek joined
18:40 doyougnu joined
18:41 primal_ joined
18:41 <manek> Hi! Is it possible to define somehow a closed type family which will match on given predicate depending on the kind? like type family Foo (l :: k) m :: * where Foo l m = l; Foo l (Bar l t) = t
18:41 <manek> not that the firt predicate should be matched when the kind of `l` is `*`
18:41 <manek> unfortunetally GHC rejects it currently
18:41 path[l] joined
18:41 <manek> *not -> note
18:42 mjora7 joined
18:44 chico27 joined
18:44 plutoniix joined
18:45 wroathe joined
18:45 chico27 left
18:45 <lyxia> manek: type family Foo' k (l :: k) m where {Foo' Type l m = l ; Foo' k l (Bar l t) = t} ; type Foo (l :: k) m = Foo' k l m
18:46 plutoniix joined
18:47 juanpaucar joined
18:48 <* hackage> json-feed 0.0.1 - JSON Feed https://hackage.haskell.org/package/json-feed-0.0.1 (fozworth)
18:48 justanotheruser joined
18:48 <manek> lyxia: thanks a lot! Yeah, it works this way. It's a lottle bit work-around, but yeah, thank tyou!
18:48 <manek> :)
18:49 <Lokathor> EvanR, I think that "hexes is curses for haskell, but in ogl" is the best way to sum up the library's primary goals
18:50 <Tuplanolla> How much do you hate life now that you have spent time with modern OpenGL, Lokathor?
18:51 <Lokathor> no more than i did otherwise
18:51 primal joined
18:51 vektorweg1 joined
18:51 <Lokathor> I know just enough to load a texture, define some verts, and maybe move a camera (i didn't understand a lot of the math therE)
18:52 <EvanR> old opengl vs modern opengl has the symptom of being called the same thing
18:52 <EvanR> its like if you think youre about to drink a soda, and find out its water
18:53 <Lokathor> oh no!
18:53 <EvanR> assuming neither are bad by themselves, your expectations may frustrate you
18:54 <EvanR> if i just want to load a texture, define some verts, move a camera, modern opengl is terrible
18:54 <Lokathor> awh
18:54 latro`a joined
18:54 <EvanR> if i want fancy "functional" shader graphics old opengl would seem pretty terrible
18:55 <EvanR> if you didnt know better, youd think opengl just in general terrible
18:55 <Tuplanolla> Well, everything is a disappointment after seeing `lens` and a few other well-designed Haskell libraries...
18:55 thc202 joined
18:55 <EvanR> and vulcan doesnt seem to be helping
18:55 kpiz joined
18:55 <Lokathor> EvanR, are you happy with any other graphical system?
18:56 <cocreature> vulcan -- draw a triangle using only 500 loc
18:56 yogsototh left
18:56 ludat joined
18:56 <EvanR> Lokathor: cairo-backed purely functional image DSL? ;)
18:56 <Lokathor> cocreature, ogl lets you draw a triangle in 243 lines! https://github.com/Lokathor/learnopengl/blob/master/app/Lesson02.hs
18:56 <EvanR> or do you mean, for actual real life graphics
18:56 <Lokathor> more like the latter :P
18:57 plugin_ joined
18:57 <EvanR> im using data Picture =, and SDL right now
18:57 <EvanR> its working for sprites
18:57 mrArkwright joined
18:58 <Lokathor> yeah i mostly liked SDL when i tried it, but i didn't want it for this project because it means you depend on an extra DLL
18:58 <EvanR> you tend to static link stuff in haskell anyway
18:58 <Lokathor> haskell's SDL stuff seemed to still depend on SDL.dll
18:58 mjs2600 joined
18:59 <EvanR> ye olde give windows users a zip file containing a .exe and several .dlls ;)
18:59 wroathe joined
18:59 <EvanR> i think on modern windows you can still access a folder that has been unzipped somewhere
18:59 <EvanR> as opposed to a google search style files ystem of OSX
19:00 iAmerikan joined
19:00 <sm> Lokathor: hexes sounds interesting, when is the release ?
19:00 <Lokathor> sm, whenever i manage to finish it off. I hope to have a "demo" available by the end of the weekend
19:01 <Lokathor> since we have a long weekend (here in the US at least)
19:01 <sm> cool. Using it for some project yet ?
19:01 <Lokathor> sm, not yet
19:01 <Lokathor> EvanR, you could do all that, and if i was serious about a lot of kinds of rich 2d graphical things i probably would.
19:02 <Lokathor> but i really prize the ability to have a single-file program, even if it's like 10 or 15 mb all packed into a huge binary
19:02 <Lokathor> sm, probably a roguelike :P
19:02 sssilver joined
19:03 Johan_L joined
19:03 mjora7 joined
19:03 sz0 joined
19:04 kmels joined
19:05 <EvanR> Lokathor: i just tested my program for exe size... 70M
19:05 connrs joined
19:05 <EvanR> dynamic SDL
19:05 <Lokathor> typical haskell :P
19:06 <Lokathor> gotta go to work though, chat later i'm sure we will
19:06 <EvanR> but then i got it down to 15M with no profiling and strip
19:07 Destol joined
19:09 drewbert joined
19:09 wroathe joined
19:09 albertus1 joined
19:10 eHammarstrom joined
19:10 primal__ joined
19:12 <turnage> I have 1GB of memory on my machine and often have trouble compiling haskell libraries I'd like to use because of that. Are there any configuration options for ghc or alternatives that work better with little memory?
19:13 afarmer joined
19:13 wonko7 joined
19:13 <Tuplanolla> I've had that problem, turnage. Passing `-M512M` helps avoid the swapping a bit.
19:13 kefin joined
19:14 <c_wraith> switching the linker to gold helps, too
19:14 jbiesnecker joined
19:14 <c_wraith> it uses a lot less memory than ld
19:15 p0a joined
19:15 <ongy> so what's the best way to compile a standalone .hs file with new-build setup? put it in a package and new-build it?
19:15 <p0a> Hey how can I try haskell online?
19:15 meba joined
19:15 <sm> https://tryhaskell.org
19:15 primal joined
19:16 <p0a> I also recall fphaskell or somethign. I thought I had an account and that they provided an IDE but now it appears unavailable?
19:16 <p0a> (i.e. commercial not free)
19:16 Itkovian joined
19:16 mrArkwright joined
19:17 <p0a> that's cool though and probably sufficient for me, thanks
19:17 <sm> turnage: as well as ghc +RTS -M512m -RTS ..., you can try building fewer packages at one time
19:17 castlelore joined
19:17 castlelore joined
19:18 <sm> p0a: yeah, FP Complete's web IDE ended
19:18 <turnage> thanks for the tips!
19:18 <sm> it's on github I think
19:18 <p0a> yeah but I'm not trying to host
19:18 <p0a> I'm trying to use from a computer that doesn't let me install things
19:18 <p0a> it's nice of them to put it on github though
19:18 <sm> there's also haskell-likes, like http://code.world
19:18 DisruptiveNL joined
19:19 mr_sm1th joined
19:19 <p0a> too bad noone has an online ide then
19:19 <sm> https://code.world/#Peb8NfjUBQ9udVsYvRnRW6Q
19:20 <p0a> lol
19:20 <p0a> that's cool
19:21 <Tuplanolla> You know you can install GHC and stuff without root permissions, p0a.
19:21 mrArkwright joined
19:21 <p0a> yeah but then that'd mean I'd have to configure things to point at the right paths
19:21 <xa0> i have an issue with ghc -c -XForeignFunctionInterface, it generates errors like the following http://i.imgur.com/M6ZpAhT.png
19:21 <p0a> Tuplanolla: I'll try... maybe I'm just being an idiot
19:21 <xa0> clearly it's not linking dependencies
19:21 <xa0> but i have no idea why
19:22 <Tuplanolla> I've done that on university's RHELs and it wasn't excruciatingly difficult, p0a.
19:22 <p0a> this is window s
19:22 brailsmt joined
19:23 mjora7 joined
19:23 <wz1000> Type families are really cool: http://lpaste.net/355861
19:23 <sm> https://code.world/#Pl--ZeWkC75JysFu4vNaifg
19:23 shangxiao joined
19:24 <Tuplanolla> I've tried that too, but not hard enough to succeed, p0a.
19:24 juanpaucar joined
19:25 flatmap13 joined
19:25 primal_ joined
19:25 <p0a> sm: oh that's cool beans
19:25 <p0a> sm: My idea was to write a library/game editor for card games
19:26 <p0a> so that people can make up their own card games. I was hoping that art people would get into it (i.e. you draw/paint your own cards, simple enough rules but customizable etc)
19:26 <p0a> but for now I'd rather just mess around with haskell a bit
19:26 <p0a> surprisingly I'm getting a free day because a computer broke down and I can't work
19:26 <EvanR> wow a logical language to define card game rules?
19:27 <pikajude> English??
19:27 saussure joined
19:27 <jackhill> p0a: heh. Haskell stack might be a good option for doing an isolated Haskell install.
19:27 <shapr> hm, I can't stack install zeromq-haskell, it fails to build with the same error on both debian and ubuntu
19:28 <p0a> EvanR: that sounds good.
19:28 louispan joined
19:29 <cocreature> shapr: what’s the error?
19:29 <orion> "GHC 8.2 will address this by introducing indexed type representations, leveraging the type-checker to verify programs using type reflection." -- is this the same 'reflection' (conceptually) used by the 'reflection' package?
19:30 wroathe joined
19:30 slomo joined
19:30 slomo joined
19:30 <shapr> cocreature: http://lpaste.net/355862
19:31 jfredett1 joined
19:31 <shapr> cocreature: I tried to install libzmq5-dev but it selects libzmq3-dev, perhaps my zmq.h doesn't have zmq4 specs?
19:31 fragamus joined
19:32 <sm> ha ha.. 2000 on that codeworld asteroids game, beat th-AAARGH
19:32 flatmap13 joined
19:32 brailsmt joined
19:32 <cocreature> shapr: it looks like zeromq-haskell is ancient. you might want to use zeromq4-haskell or zeromq3-haskell instead
19:33 <p0a> 2000?
19:33 <* shapr> checks
19:33 <* sm> was reliving the quantum asteroids in guardians of the galaxy 2
19:34 <shapr> cocreature: doh, somehow I thought zeromq-haskell and zeromq4-haskell were the same package, thanks for fixing my thinko!
19:34 <tsahyt> is there a typeclass providing a kind of monomorphic functor? e.g. class Monofunctor a where { type Element a; monomap :: (Element a -> Element a) -> a -> a }?
19:34 dejanr joined
19:35 primal joined
19:36 jdnavarro joined
19:37 ericdwhite joined
19:37 <ericdwhite> Hi I have been looking at: http://devanla.com/drafts/read-you-a-scotty.html and found an expression I had never seen before
19:37 <ericdwhite> addRoute' r s@AppState {routes = cr} = s {routes = r : cr}
19:38 <ericdwhite> data AppState = AppState { routes :: [Route] }
19:38 <ericdwhite> My Question is the 's' in ... = s {routes = r:cr}. Why is it not just ... = AppState {routes = r:cr}
19:39 <Athas> ericdwhite: it is a record update.
19:39 jathan_ joined
19:39 <Athas> It means 'return the record s, but changing the value of the field "routes"'.
19:39 jbiesnecker joined
19:40 wroathe joined
19:40 <p0a> http://imgur.com/a/21A1z
19:40 cdg joined
19:40 <wz1000> ericdwhite: I think it could be witten that way, but this version won't have to change if more fields are added to AppState
19:41 <* hackage> wallpaper 0.1.0.0 - A library and executable for creatingwallpaper, frieze, and rosette patterns. https://hackage.haskell.org/package/wallpaper-0.1.0.0 (jeffreyrosenbluth)
19:41 mfukar joined
19:42 <p0a> whoever recommended stacks, I can't get it to work
19:42 <ericdwhite> Thanks. I understand now, if you just want to change one field then you can use that record update syntax, but it still returns a instance.
19:42 <p0a> I think I'll just use ghci and notepad++ or something...
19:43 mjora7 joined
19:44 saussure joined
19:44 brailsmt joined
19:45 Qfwfq joined
19:45 Arcanine1 left
19:45 primal_ joined
19:48 jbiesnecker joined
19:49 bendo joined
19:50 wroathe joined
19:53 takle joined
19:54 suzumiya_ joined
19:55 primal joined
19:55 Itkovian joined
19:56 barcabuona joined
19:58 saussure joined
19:58 <suzumiya_> Sorry to bother. May I ask how to deal with missing cabal extra-libraries which have already been installed in /lib? I can find the lib files in the /lib dir.
19:58 ErinvanderVeen joined
19:59 takle joined
20:00 primal_ joined
20:00 gillesmajor joined
20:00 drewbert joined
20:00 wroathe joined
20:01 Batzy joined
20:02 <Batzy> Ello
20:02 flatmap13 joined
20:03 jadrian joined
20:03 mjora7 joined
20:04 <koala_man> I have a [[Char]]. How can I efficiently generate all combinations of picking one character from each list? I tried just mapM_ putStrLn $ sequence list but it explodes in space
20:04 <EvanR> are the lists finite
20:04 <koala_man> yes
20:04 <EvanR> ok good
20:05 primal joined
20:05 DTZUZU joined
20:05 <EvanR> so the answer isnt uncountable
20:05 <jle`> koala_man: are you running wiht optimizations?
20:05 <koala_man> jle`: -O yes
20:05 <jle`> how about -O2 ?
20:06 fnurglewitz joined
20:06 mjs2600 joined
20:06 <spoonm> I'm trying to rewrite my xmonad config and, apart from handling all the literals(the expressions will be taken care of, don't vomit just yet), can I in any way use guards for this? http://ix.io/vaL
20:07 <p0a> sm: did you see my high score?
20:07 saussure joined
20:07 <koala_man> jle`: it keeps growing. I killed it at 1.5GB RES
20:08 <koala_man> EvanR: it's very countable, just 10B+
20:08 saussure joined
20:09 <mniip> EvanR, the answer would never be uncountable
20:09 <mniip> koala_man, try +RTS -M1G
20:09 <mniip> maybe it's just the heap size
20:10 <p0a> I think I'm giving up on windows haskell
20:10 <koala_man> mniip: that does seem better
20:10 <p0a> I just downloaded the ghci. It's in a tar. There's only 7zip available. I tried to untar and it created a folder with a new tar file in it
20:11 <EvanR> mniip: "every combination of characters from each list" ?
20:11 <p0a> i.e. from each list one character
20:11 <mniip> EvanR, sure
20:11 <p0a> i.e. [alpha, number] gives a0 to z9
20:11 saussure joined
20:12 <mniip> or hmm
20:12 <mniip> maybe if they're all infinite
20:12 <p0a> mniip: it's a map of maps
20:12 <mniip> then alright
20:12 <p0a> oh for infinite lists?
20:12 <Cale> p0a: Are you sure you downloaded *Windows* GHC?
20:12 <p0a> Cale: it says mingw... oh
20:13 <p0a> Cale: should I even try learning haskell or did I prove my incompetence already
20:13 <Cale> Oh, I see, interesting.
20:13 <Cale> It used to come in another package format. 8.0.2 apparently does come in a .tar.xz anyway
20:13 <p0a> Cale: ghc-8.0.2-x86_64-unknown-mingw32.tar.xz (142.2 MB, sig)
20:13 <p0a> yeah that's what it is
20:13 <p0a> but the thing is, I can't untar it for the love of god
20:14 <Cale> Did you open the tar?
20:14 darlan joined
20:14 joco42 joined
20:14 brailsmt joined
20:14 <Cale> .xz is a compression format, and .tar is an archive format (basically concatenates files and adds an index)
20:14 <p0a> well the 7zip file manager is clunky
20:14 <p0a> I guess I had to 'extract' (?) twice
20:14 <Cale> yeah
20:14 juanpaucar joined
20:14 <p0a> probably because of what you described
20:15 <p0a> ah great thanks
20:17 toby_ joined
20:17 wroathe joined
20:18 joco42_ joined
20:21 rcschm joined
20:23 govg joined
20:23 cdg joined
20:24 mjora7 joined
20:25 TyOverby joined
20:27 jbiesnecker joined
20:28 wroathe joined
20:30 ryantrinkle joined
20:30 ziocroc joined
20:31 primal_ joined
20:31 <TyOverby> Does anyone know if the haskell compiler does typechecking before or after lowering?
20:31 jbiesnecker joined
20:32 JoshS joined
20:33 castlelore joined
20:33 castlelore joined
20:33 TheInfosphere joined
20:34 sssilver_ joined
20:37 <Tuplanolla> Lowering?
20:38 <int-e> desugaring? ghc typechecks before desugaring, mainly to get better type error messages, I believe.
20:38 perrier-jouet joined
20:40 <c_wraith> ghc doesn't really do lowering.
20:40 <c_wraith> the simpler constructs it compiles to as an intermediate step are not the same language
20:40 primal joined
20:41 <dmwit> p0a: modern tar should understand .xz/.gz/.bz, e.g. `tar xf whatever.tar.xz` works fine here
20:41 <dmwit> (x for extract, f for from a file, because we all know that "from the tape drive" is still the correct default)
20:42 <c_wraith> dmwit, windows. it doesn't have a command line tar tool unless you go out of your way to install one.
20:42 dni joined
20:43 doyougnu joined
20:43 <dmwit> You can do Windows without cygwin?
20:43 castlelore joined
20:43 <dmwit> That doesn't sound right.
20:43 <dmwit> ;-)
20:44 mjora7 joined
20:44 <p0a> windows doesn't sound right in general
20:45 primal_ joined
20:46 LHoT10820 joined
20:48 jae2 joined
20:48 <pikajude> there's a good reason for that
20:48 <pikajude> dmwit: actually, there's WSL now
20:48 <pikajude> which, to be fair, doesn't have the ability to run 32-bit binaries
20:50 <c_wraith> too bad starting ghc takes like 20 seconds on WSL
20:50 <pikajude> yeah
20:50 <pikajude> having started to use windows as a desktop OS, i can confirm that "you'll have to go out of your way to install one" is the windows motto
20:50 opaalaha joined
20:51 jgertm joined
20:52 mjs2600 joined
20:53 primal joined
20:53 <cocreature> maybe we should lern from the ransomware people. they seem to be pretty good at making their code easy to install
20:53 takle joined
20:54 <spoonm> is this readable in any way? lol http://ix.io/vb1
20:54 ryantrinkle left
20:55 <p0a> the ransomware lol
20:56 Itkovian joined
20:56 <bbaren> spoonm: You should hindent.
20:57 <spoonm> bbaren: hindent?
20:57 zariuq joined
20:57 WhiskyRyan joined
20:57 <bbaren> https://github.com/commercialhaskell/hindent
20:57 <spoonm> ooo
20:57 <spoonm> thanks, I'll try that
20:58 <* hackage> wallpaper 0.1.0.1 - A library and executable for creatingwallpaper, frieze, and rosette patterns. https://hackage.haskell.org/package/wallpaper-0.1.0.1 (jeffreyrosenbluth)
21:00 latro`a joined
21:00 mjora7 joined
21:01 flatmap13 joined
21:02 louispan joined
21:02 WhiskyRyan joined
21:04 flatmap13 joined
21:07 redmq joined
21:10 flatmap13 joined
21:10 jbiesnecker joined
21:11 amuck joined
21:12 <* hackage> superconstraints 0.0.1 - Access an instance's constraints https://hackage.haskell.org/package/superconstraints-0.0.1 (RyanTrinkle)
21:12 primal_ joined
21:13 Guest61657 joined
21:13 toby1851 joined
21:13 Durbley_ joined
21:15 mjs2600 joined
21:15 plakband joined
21:17 tromp joined
21:19 WhiskyRyan joined
21:21 IanKelling joined
21:22 biglama joined
21:22 primal joined
21:23 nico__ joined
21:23 juanpaucar joined
21:24 earldouglas joined
21:24 <nico__> Hey I have a simple problem that i haven't been able to figure out on my own (I'm really new to haskell).
21:24 WhiskyRyan joined
21:25 <nico__> Let's say I have a function func1 :: String -> Either b c, and a function func2 :: c -> String
21:25 <nico__> I need to use the result of func 1 (if its of type c) in func2
21:25 <nico__> how should I go about this?
21:26 Itkovian joined
21:27 <Tuplanolla> :t fmap func2 . func1 -- Like this, nico__?
21:27 <lambdabot> String -> Either b String
21:27 primal joined
21:30 <nico__> I'm not sure, what I would like to get is the Right element from the either result
21:30 <Tuplanolla> You can use `fmap` to operate on the `c` in `Either b c` or pattern match on it.
21:31 dc0de joined
21:31 <nico__> I'll try that
21:31 <nico__> Thanks!
21:31 okeuday_bak joined
21:33 wroathe joined
21:34 <suzu> in lucid, is there any method to be able to modify a built Html element?
21:34 primal_ joined
21:38 <suzu> seems like not.
21:38 <suzu> can constraints be read as implications?
21:39 <suzu> for instance, there is an instance: MonadState s m => MonadState s (HtmlT m)
21:39 <suzu> can i read that as, "If i have a MonadState s m instance for some s and m, then i also have a MonadState s (HtmlT m) for those s and m for free"/
21:39 <suzu> ?
21:39 <suzu> *
21:40 <* hackage> servant-auth-cookie 0.5.0.4 - Authentication via encrypted cookies https://hackage.haskell.org/package/servant-auth-cookie-0.5.0.4 (zohl)
21:41 darjeeli1 joined
21:41 anuxivm joined
21:42 ErinvanderVeen joined
21:42 <lyxia> suzu: yes
21:43 <suzu> and i can also read it in the reverse with: "you get an instance of MonadState s (HtmlT m) if there's an instance MonadState s m for those s and m"?
21:44 other_spacecadet joined
21:44 <suzu> but you CANNOT read it as: having a MonadState s (HtmlT m) means there exists a MonadState s m for those s and m
21:44 primal joined
21:44 <suzu> because that's not necessarily true
21:44 <lyxia> I don't think it works the other way around
21:45 <suzu> hmm. really?
21:45 <suzu> i always read it with that reverse reading
21:45 <lyxia> wait, I just misread
21:45 Destol joined
21:45 <lyxia> you are correct
21:45 <suzu> are both those statements i made there correct?
21:45 <suzu> the reverse reading works and that invalid reading is actually invalid?
21:46 <lyxia> "X if Y" is equivalent to "if Y then X"
21:46 <suzu> ah kk
21:47 test42893121525 left
21:47 castlelore joined
21:50 MetaQED joined
21:50 Sonderblade joined
21:51 unK_ joined
21:51 <spoonm> lyxia: is `X if Y' valid in Haskell?
21:52 perrier-jouet joined
21:52 hiratara joined
21:54 <* hackage> wryte 0.1.1.0 - Pretty output for source generators https://hackage.haskell.org/package/wryte-0.1.1.0 (TobiasDammers)
21:54 ojw joined
21:55 mjs2600 joined
21:56 bennofs joined
21:56 locallycompact joined
21:57 MetaQED left
21:57 ErinvanderVeen joined
22:00 suzumiya_ joined
22:01 WhiskyRyan joined
22:02 disappointing_do joined
22:04 locallycompact joined
22:04 dmiles joined
22:05 <suzu> no but it is valid in ruby ;)
22:05 <suzu> but so are a lot of blasphemous things
22:08 path[l] joined
22:11 sigmundv joined
22:14 moth joined
22:15 primal_ joined
22:15 jleon joined
22:16 peterbecich joined
22:16 jrm joined
22:22 Hanslo joined
22:23 CacoS joined
22:24 <c_wraith> I like to override #nil? in NilClass to return false.
22:24 <Hanslo> I'm unsure if this is the right place to ask a cabal question, apologies in advanced, what is the best way to get cabal to automatically resolve dependencies?
22:24 primal joined
22:25 krok__ joined
22:26 sanitypassing joined
22:27 juanpaucar joined
22:27 <AerialBoundaries> "Haskell from First Principles" costs $70 (with tax) in my country. That's... a lot of money.
22:28 mkoenig joined
22:29 <Hanslo> I was trying to cabal install opench-meteo, I received a list of rejected packages, and a "Dependency tree exhaustively seached." message.
22:30 _ashbreeze_ joined
22:30 jleon joined
22:31 hiratara joined
22:31 Sampuka joined
22:31 <suzu> the best way to fix a cabal problem is to stop using cabal, really
22:32 <suzu> use stack if you can
22:32 <suzu> AerialBoundaries: you can send an email to the authors and ask for a discount
22:32 <suzu> i've heard they're pretty cool with that if you're a student / financial issues / etc
22:32 pavonia joined
22:32 <AerialBoundaries> suzu: oh, neat
22:33 <AerialBoundaries> thanks
22:33 <suzu> np
22:33 augur joined
22:33 cschneid_ joined
22:34 sanitypassing joined
22:34 primal_ joined
22:35 tromp joined
22:35 bjz joined
22:36 Swizec joined
22:39 fotonzade joined
22:39 <dmwit> Hanslo: Automatically resolving dependencies is the default. "Dependency tree exhaustively searched" means there were conflicting constraints. It should have some details about why.
22:40 justanotheruser joined
22:40 <dmwit> Hanslo: The package you mentioned has pretty light dependencies, so I'm a bit surprised by this. Can you hpaste/lpaste the exact error message?
22:40 <dmwit> ?paste
22:40 <lambdabot> Haskell pastebin: http://lpaste.net/
22:41 <dmwit> Hanslo: At a guess: perhaps your GHC is too old, and so the hard-wired `base` version you have (which can't be changed) doesn't meet the `base >= 4.8 && < 4.10` constraint.
22:42 dcoutts joined
22:42 dcoutts joined
22:42 jadrian joined
22:43 dfeuer joined
22:43 primal joined
22:43 cretiq joined
22:43 anodium joined
22:44 davr0s joined
22:47 <Hanslo> Thanks I will update my ghc, and give it another go
22:47 gillesmajor left
22:48 doyougnu joined
22:51 ixian joined
22:52 locallycompact joined
22:55 FooBar` joined
22:56 <FooBar`> Is there a way to get type class methods using TemplateHaskell
22:56 HoierM joined
22:57 Hanslo left
22:59 howdoi joined
23:02 wildlander joined
23:04 ojw left
23:06 <pikajude> what do you mean by get?
23:06 <pikajude> like, if they're returned in the AST?
23:10 wroathe joined
23:10 <c_wraith> FooBar`, are you looking for https://hackage.haskell.org/package/template-haskell-2.11.1.0/docs/Language-Haskell-TH.html#v:reify
23:12 Hithroc joined
23:12 <FooBar`> Ah yeah it's contained in the ClassI constructor
23:12 <FooBar`> I think that's it, thanks
23:14 jbiesnecker joined
23:14 <ph88^> how can i type a 0x0d as char literal in code ?
23:14 <pikajude> try 0x0d
23:14 <pikajude> oh, as a char literal, lol
23:15 <pikajude> I didn't read the char part
23:15 <pikajude> should be '\x0d'
23:15 <c_wraith> > '\x0d'
23:15 <lambdabot> '\r'
23:15 <ph88^> thx
23:16 ^bschafer1 joined
23:16 meba joined
23:17 ryantrinkle joined
23:18 jbiesnecker joined
23:20 systemfault joined
23:20 Itkovian joined
23:22 anodium joined
23:24 dni_ joined
23:24 <dmwit> > "\xd00d\xd\&00d"
23:24 <lambdabot> "\53261\r00d"
23:24 <dmwit> rude
23:24 primal___ joined
23:24 GamboPango joined
23:24 <dmwit> rudedudes, the sister subreddit to madlads
23:24 theDon_ joined
23:24 <pikajude> http://www.fileformat.info/info/unicode/char/d00d/index.htm
23:24 <pikajude> that's not very exciting
23:25 <dmwit> Man, that railroad is messed up. 6/10 would not ride again
23:25 yellowj joined
23:26 <dmwit> I wonder how they square "U+D00D is not a valid Unicode character" with the wealth of information otherwise available on that page.
23:27 markus1209 joined
23:27 darjeeli1 joined
23:28 flatmap13 joined
23:28 markus1219 joined
23:28 <pikajude> maybe if it was a valid unicode character, the railroad would be intact?
23:28 latro`a joined
23:29 peterbecich joined
23:30 <* hackage> morte 1.6.7 - A bare-bones calculus of constructions https://hackage.haskell.org/package/morte-1.6.7 (GabrielGonzalez)
23:30 felixphew joined
23:31 <ph88^> > '\x00'
23:31 <lambdabot> '\NUL'
23:31 juanpaucar joined
23:32 <felixphew> I've just found a (seemingly undocumented) function in alex's "monad" wrapper, and I'm wondering what it does
23:32 <felixphew> token :: (AlexInput -> Int -> token) -> AlexAction token
23:32 <felixphew> token t input len = return (t input len)
23:32 Myrl-saki joined
23:32 niao joined
23:33 earldouglas joined
23:33 <felixphew> it's just sitting next to skip, begin, `andBegin` etc.
23:33 <pikajude> @pl \ a b c -> return (a b c)
23:33 <lambdabot> ((return .) .)
23:33 <pikajude> interesting
23:33 <dmwit> At a guess, without being an alex expert: `AlexAction a` is a type synonym for a two-argument function, and `token` is there so that if it ever becomes a proper type rather than just a synonym not all your code breaks.
23:33 ThreeFx joined
23:33 <felixphew> that makes sense
23:33 <dmwit> That is, I expect you are supposed to code under the assumption that `AlexAction` is an opaque type.
23:34 <felixphew> I'm having a hard time getting my head around Alex
23:34 <dmwit> And `token` is there to make it just slightly more transparent. =)
23:34 primal joined
23:34 nakal_ joined
23:35 <felixphew> I really wish there was some way to use startcodes without the "monad" wrapper
23:35 <felixphew> because my haskell isn't good enough yet to understand how it works
23:36 <felixphew> but unfortunately I can't think of a way to lex this syntax-from-hell without startcodes
23:37 <ph88^> what's the most efficient way to read 8 bytes with attoparsec and convert it to a real ?
23:38 kKzs joined
23:38 <ph88^> i guess that would be a Double
23:38 <ph88^> can i directly memory map that without parsing ?
23:38 coltfred_ joined
23:38 <dmwit> http://hackage.haskell.org/package/attoparsec-0.10.4.0/docs/Data-Attoparsec-Text.html#v%3adouble ?
23:39 <dmwit> Oh, nope, that seems to look for actual digits like "3.14".
23:40 <ph88^> ye i don't actually need to "parse" something here i think .. it should be the same representation in the file as in memory .. well hope endianness is the same at least ^^
23:40 Welkin joined
23:40 <dmwit> So, a minor hobby-horse: there is no platform-agnostic way to get the bytes of a double. If your architecture allows it, you aren't really guaranteed anything (by the IEEE standard, anyway) about what order you get bits in.
23:41 m0rphism joined
23:41 <dmwit> So "same in the file as in memory" isn't quite so clear-cut as you might think.
23:41 kKzs joined
23:41 <ph88^> ye let's just try to load it .. i can verify it after i have it working
23:41 acidjnk22 joined
23:42 jleon joined
23:42 jmiven joined
23:43 <ph88^> maybe i need this? https://hackage.haskell.org/package/binary-0.8.5.1/docs/Data-Binary-Get.html#g:15
23:44 primal___ joined
23:44 coltfred_ joined
23:46 <felixphew> dmwit: woud you mind giving me an example of how I might use "token"?
23:47 <ph88^> by the way .. how can i know how to optimize my data structures ?
23:48 <dmwit> felixphew: Dunno. What does the `AlexInput` data structure have in it?
23:48 <felixphew> type AlexInput = (AlexPosn, -- current position,
23:48 <felixphew> Char, -- previous char
23:48 <felixphew> [Byte], -- pending bytes on current char
23:48 <felixphew> String) -- current input string
23:48 <dmwit> felixphew: Forget I asked. Even after I know the answer to that, I think I am inexpert enough that I would confuse you by answering.
23:48 <felixphew> never mind then, and thanks anywy
23:49 <dmwit> ph88^: http://johantibell.com/files/haskell-performance-patterns.html#%281%29 perhaps
23:49 <ThreeFx> ph88^ It certainly looks fast enough
23:49 <dmwit> ph88^: Also the "faster, smaller" section of the GHC manual for the really basic advice.
23:51 Gurkenglas joined
23:51 <dmwit> https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/sooner.html
23:51 tromp joined
23:51 kKzs joined
23:53 alveric1 joined
23:53 exferenceBot joined
23:54 primal joined
23:55 jedws joined
23:55 halogenandtoast joined
23:55 tefter joined
23:58 simukis joined
23:59 infinity0_ joined