<    June 2018     >
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 _2_3  
24 25 26 27 28 29 30
00:00 jonathanlking_ joined
00:00 <fishythefish> similarly, you could do `llp_eval env <pattern> = ...` rather than having the explicit `case ast of`
00:01 <mniip> %% :!../usr/bin/ghc-pkg list
00:01 <yahb> mniip: http://qp.mniip.com/y/62
00:01 <mniip> any suggestions to the above list^ :p
00:01 aarvar joined
00:05 <Tuplanolla> Add `inline-c` and `inline-java`, mniip.
00:05 <fishythefish> butterthebuddha: also, I'm not sure how your Result type is defined, but I think you have a case of inexhaustive patterns
00:05 gentauro joined
00:05 diwo joined
00:06 drbrule joined
00:06 <Tuplanolla> Perhaps even replace or supplement `parsec` with `megaparsec`.
00:06 <butterthebuddha> fishythefish: llp_eval_ast is guaranteed to return a value of constructor List if passed in a value of constructor "
00:06 <butterthebuddha> constructor L*
00:07 <butterthebuddha> https://lpaste.net/2303384170501505024
00:07 thelounge18 joined
00:08 <mniip> Tuplanolla, inline-c requires a working gcc
00:08 <mniip> which I do not posess
00:09 ammazza joined
00:11 <mniip> I assume inline-java is similar
00:11 ian_andrich joined
00:13 dented42 joined
00:15 <lyxia> mniip: quickcheck?
00:15 malorie joined
00:17 <lyxia> constraints
00:18 XorSwap joined
00:18 nowhere_man joined
00:22 patlv joined
00:23 andyhoang joined
00:25 <zachk> what happened to lpaste.net , it looks half finished/broken
00:29 ddellacosta joined
00:32 <mniip> zachk, it's a redesign
00:32 <mniip> it's "fashion", you wouldn't know about that
00:32 <zachk> oh ok
00:33 patlv joined
00:33 tjbp joined
00:35 andyhuzhill joined
00:36 FatalNIX joined
00:38 <nowhere_man> why can't I have `data Foo = Foo {baz::Int}` and `data Bar = Bar {baz::Int}`?
00:38 jmcarthur joined
00:39 tzemanovic joined
00:39 <nowhere_man> could baz have type a -> Int ?
00:39 <mniip> no
00:39 <mniip> 'a -> Int' means 'forall a. a -> Int'
00:39 enterprisey joined
00:39 <mniip> in you case baz would only work for two types in place of 'a' hence a bare forall is inapppropriate
00:40 <nowhere_man> couldn't there be an implicit typeclass?
00:40 <nowhere_man> ha, but I couldn't type it, then
00:41 <mniip> an implicit typeclass is a solid idea actually. One that's actually already discussed
00:41 <nowhere_man> ho
00:41 <DigitalKiwi> what would you like on lpaste.net 20 ads a la pastebin?
00:41 <mniip> you could have baz :: Has "baz" a t => a -> t
00:41 <nowhere_man> nice
00:42 <mniip> with class Has (s :: Symbol) (a :: *) (t :: *) | a -> t
00:42 <mniip> err
00:42 <mniip> s a -> t
00:42 tabemann joined
00:42 pfurla joined
00:43 <mniip> nowhere_man, https://github.com/adamgundry/ghc-proposals/blob/75d629038104c73ac9ba19cb8b864388a58a5da8/proposals/0000-overloaded-record-fields.rst
00:43 <mniip> (still only a proposal though)
00:44 chao-tic joined
00:46 fragamus joined
00:46 <mniip> lyxia, added constraints and quickcheck
00:47 dan_f joined
00:48 <lyxia> nice!
00:50 AfC joined
00:50 kvda joined
00:50 louispan joined
00:50 asheshambasta joined
00:52 andreabedini joined
00:54 ericsagn1 joined
00:56 <mniip> anyway ghc now has cool stuff
00:56 <geekosaur> it's more than a proposal, but not fully implemented
00:56 <geekosaur> parts are there
00:56 <mniip> the cool stuff I am talking about right now is QuantifiedConstraints
00:57 <mniip> if that's what you're replying to
00:57 juhp joined
00:57 connrs joined
00:58 lain0n joined
00:58 <mniip> % foo :: (forall a. Eq a => Eq f a, Functor f) => f a -> f b -> Bool; foo x y = fmap (const ()) x == fmap (const ()) y
00:58 <yahb> mniip: ; <interactive>:2:27: error:; * Expected kind `* -> Constraint', but `Eq f' has kind `Constraint'; * In the type signature: foo :: (forall a. Eq a => Eq f a, Functor f) => f a -> f b -> Bool; <interactive>:2:30: error:; * Expecting one more argument to `f'; Expected a type, but `f' has kind `* -> *'; * In the first argument of `Eq', namely `f'; In the type signature: foo :: (f
00:59 <mniip> oop
00:59 <mniip> % foo :: (forall a. Eq a => Eq (f a), Functor f) => f a -> f b -> Bool; foo x y = fmap (const ()) x == fmap (const ()) y
00:59 <yahb> mniip:
00:59 johnvonneumann joined
00:59 <mniip> % foo "hello" [1,2,3,4,5]
00:59 <yahb> mniip: True
00:59 <mniip> % foo "hello" [1,2,3,4]
00:59 <yahb> mniip: False
01:01 gentauro joined
01:05 <pdxleif> Is there an attoparsec thing to match "empty string"? Should I just use `string ""`?
01:05 <lyxia> return ()
01:05 <mniip> pure ()
01:06 reggie_ joined
01:06 jackdk joined
01:08 <pdxleif> Err, I want it to succeed only if there's no more input - like if the entire input is just the empty string.
01:08 <lyxia> endOfInput
01:09 nighty-- joined
01:09 <pdxleif> Ah, thanks!
01:09 tzemanovic joined
01:10 malorie joined
01:11 darjeeling_ joined
01:14 taumuon joined
01:14 dfeuer joined
01:17 MoarSpaceFi joined
01:19 lain0n joined
01:19 dogweather joined
01:20 ph88 joined
01:20 WhatisRT joined
01:23 kvda joined
01:26 lambda-11235 joined
01:26 andreabedini joined
01:26 tzemanovic joined
01:29 gabiruh joined
01:30 youtmon joined
01:30 NiceTry5 left
01:31 jpgarcia joined
01:31 andyhoang joined
01:32 kvda joined
01:34 <* hackage> turtle 1.5.9 - Shell programming, Haskell-style http://hackage.haskell.org/package/turtle-1.5.9 (GabrielGonzalez)
01:35 patlv joined
01:40 mizu_no_oto_work joined
01:42 Rayben joined
01:42 Raybin joined
01:42 enterprisey joined
01:45 asheshambasta joined
01:45 <* hackage> eap - Extensible Authentication Protocol (EAP) http://hackage.haskell.org/package/eap- (erick)
01:46 DSM joined
01:48 kvda joined
01:51 nitaigao joined
01:52 conal joined
01:54 marvin2 joined
01:56 tabemann joined
01:58 ggreg joined
01:58 staafl_ joined
02:00 hucksy_ joined
02:01 kvda joined
02:02 Destol joined
02:04 malorie joined
02:07 mud joined
02:07 amirpro joined
02:08 blonkhart joined
02:09 markus1189 joined
02:11 mounty joined
02:12 cschneid joined
02:13 cschneid joined
02:17 <* hackage> menoh 0.1.0 - Haskell binding for Menoh DNN inference library http://hackage.haskell.org/package/menoh-0.1.0 (MasahiroSakai)
02:18 banc joined
02:18 chao-tic joined
02:20 andreabedini joined
02:23 ian_andrich joined
02:24 sighingnow joined
02:25 lortabac_ joined
02:26 <superguest> /j #math
02:28 andyhoang joined
02:29 juhp joined
02:30 oldandwise joined
02:31 lagothrix joined
02:34 <enterprisey> In f <$> a <*> b <*> c, do we know that a, b, and c happen left-to-right?
02:34 <enterprisey> for example, if f is a constructor and a, b, and c are parser combinators
02:34 markus1189 joined
02:37 <geekosaur> Applicative would be pretty useless for IO if it didn't
02:37 <enterprisey> ty
02:37 <enterprisey> also that makes sense, lol
02:38 <geekosaur> (also for parsers, for that matter — but Applicative grew out of parsers. So you'd kinda expect it to do the right thing)
02:39 oisdk joined
02:39 asheshambasta joined
02:40 xinming joined
02:41 xinming joined
02:41 diwo joined
02:41 dented42 joined
02:42 <monochrom> Applicative alone doesn't come with an expectation on effect order. However, if a type is both an Applicative and a Monad, then we do expect <*> to be a special case of >>=, and then you have an effect order.
02:43 <monochrom> But even then the Tardis monad can mess with your mind.
02:43 dodong joined
02:44 <enterprisey> after looking into that monad a bit, I agree
02:51 raingloom joined
02:52 rcdilorenzo left
02:53 MRd1 joined
02:54 <MRd1> Hi...
02:55 <MRd1>
02:58 simukis joined
02:58 conal joined
02:58 malorie joined
02:58 connrs joined
02:58 <monochrom> OK, mrd1 is just trying to annoy me.
02:58 <monochrom> Maybe annoy all of us too, but I just want to speak for myself. Regardless, I'll do a thing on behalf of all of us.
02:59 granttrec joined
03:00 theDon joined
03:02 markus1189 joined
03:02 shutdown_-h_now joined
03:03 <* exio4> annoys monochrom carefully
03:04 <monochrom> Ah you're fine. Mrd1 have been haunting us for days. Because someone else was some kind to them. This is what you get when you're kind to people who don't even know what this channel is for.
03:05 <monochrom> s/some kind/kind/
03:05 <exio4> oh, well
03:06 <geekosaur> we had a brief inclux of trolls. this one's the most persistent of the lot
03:06 <geekosaur> influx
03:06 otto_s_ joined
03:06 acertain joined
03:07 gentauro joined
03:07 fryguybob joined
03:09 jb55 joined
03:10 AetherWind joined
03:12 ndeine joined
03:13 plutoniix joined
03:15 drbrule joined
03:16 dented42_ joined
03:16 initiumdoeslinux joined
03:18 hackebeilchen joined
03:20 progfun joined
03:23 lassulus_ joined
03:24 danso joined
03:25 bpvsgr joined
03:26 woodson joined
03:26 <DigitalKiwi> is this the channel for pascal?
03:26 markus1189 joined
03:27 vmandela joined
03:30 bpvsgr left
03:32 dexhunter joined
03:33 asheshambasta joined
03:33 meinside joined
03:34 cschneid joined
03:35 tabemann joined
03:37 andyhoang1 joined
03:39 <enterprisey> While I'm asking dumb questions about parser semantics, the Alternative instance for parsers also tries them left-to-right, right?
03:39 <enterprisey> nm it's infixl
03:41 seveg joined
03:43 conal joined
03:44 dogweather joined
03:46 andyhoang1 joined
03:46 <monochrom> infixl doesn't actually tell you what's done first, despite K-12 white lies.
03:46 Axman6 joined
03:47 <enterprisey> yup that occurred to me
03:47 <enterprisey> yeah I should probably dig into the megaparsec source more
03:47 <monochrom> But most library authors are not out to troll you. Most people expect left-to-right, therefore most authors oblige.
03:47 <Solonarv> every instance I've run into has been left-to-right
03:47 <Solonarv> yeah what monochrom said
03:47 <enterprisey> solid
03:48 zfnmxt joined
03:48 <zfnmxt> Is it possible to define an "empty" type in Haskell that consists exclusively of bottom?
03:48 blankhart joined
03:49 <zfnmxt> (I'm guessing you can't actually have an empty, empty type without bottom)
03:49 <geekosaur> data Void -- ?
03:49 Onsitovius joined
03:49 <zfnmxt> Oh cool :)
03:50 markus1189 joined
03:50 <monochrom> Haskell 2010 permits it.
03:50 Onsitovius left
03:50 <ClaudiusMaximus> there's -XEmptyDataDecls, and i think you can get the same effect with a recursive newtype if you don't want to use the extension for some reason
03:51 <geekosaur> only H'98 needs EmptyDataDecls, as monochrom said
03:51 <monochrom> EmptyDataDecls got absorbed into 2010.
03:51 <ClaudiusMaximus> nice :)
03:52 <monochrom> This is why the giants answer slowly. Because they check the docs first.
03:52 malorie joined
03:53 <ClaudiusMaximus> is newtype Void = V Void equivalent? not 100% sure
03:53 <zfnmxt> data Void = Void !Void. Is the strictness just to enforce that Void (bottom) = bottom?
03:53 <zfnmxt> What if you just wrote Void = Void Void?
03:54 <ClaudiusMaximus> without the strictness you could have _|_, Void _|_, Void (Void _|_), ...
03:54 <ClaudiusMaximus> the strictness collapses it all down to just _|_
03:56 <zfnmxt> I'm not sure I see how that works.
03:56 <geekosaur> if you try to construct a Void with a bottom, you get a bottom immediately instead of a constructor containing a bottom
03:56 <zfnmxt> My understanding is that strictness doesn't say anything about how a function behaves except when evaluated on bottom.
03:57 <geekosaur> the ! there applies specifically when constructing a value
03:57 <geekosaur> not evaluation of it
03:57 <zfnmxt> Ah, right. Okay. I see.
03:57 <zfnmxt> That's funny, that you can't actually have values of type Void that include the constructor Void.
03:58 <Solonarv> well that's the entire point of the type!
03:58 <zfnmxt> I know! But still, pecuiliar :)
03:58 kvda joined
03:58 <geekosaur> enh, it's just a list without a head :p
03:59 <Solonarv> @let newtype VoidNewtype = VoidNewtype VoidNewtype
03:59 <lambdabot> Defined.
03:59 <Cale> zfnmxt: Note that there is no data constructor Void
03:59 <Solonarv> @let foo = VoidNewtype foo
03:59 <lambdabot> Defined.
03:59 <Cale> oh, sorry, I didn't see that you redefined it :)
03:59 <Solonarv> > foo
03:59 <lambdabot> error:
03:59 <lambdabot> • No instance for (Show VoidNewtype)
03:59 <lambdabot> arising from a use of ‘show_M38720037077763516603688’
04:00 <Solonarv> blargh, shouldn't that not be inhabited by bottom?
04:00 <zfnmxt> Cale: Not sure I understand that either since if I write data Void = VoidConst !Void isn't VoidConst, semantically, a data constructor?
04:00 AetherWind joined
04:00 streblo joined
04:00 fragamus joined
04:00 Linter joined
04:00 <Cale> Sorry, yes.
04:01 streblo left
04:01 <Cale> Usually, the data declaration for Void doesn't define any data constructors
04:01 <Cale> I just hadn't seen that you'd defined Void differently than usual.
04:02 sakalli_ joined
04:02 <zfnmxt> Ah, I see. I just took that definition from the source: https://hackage.haskell.org/package/void-0.7.1/docs/Data-Void.html
04:02 <Cale> The strictness annotation there just means that whenever your Void data constructor occurs in an expression, it will be replaced by (\x -> Void $! x)
04:03 Scip joined
04:04 <Cale> Oh, interesting that it doesn't use EmptyDataDecls, given that's the entire point of that extension :P
04:04 <monochrom> Because Haskell 2010 happened.
04:04 <Cale> https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#extension-EmptyDataDecls
04:04 <enterprisey> Parser performance question: if I'm trying to parse ab*, where a and b are big classes, is it better to use satisfy >> takeWhileP, or takeWhile1P >> takeWhileP?
04:05 <enterprisey> Semantically, of course, the former wins
04:05 <Cale> oh, right, this is just in base now
04:05 <Cale> Nobody actually uses this package anymore
04:05 <Cale> https://hackage.haskell.org/package/base-
04:05 darjeeling_ joined
04:05 tombusby joined
04:07 <Cale> enterprisey: those don't seem equivalent
04:08 <enterprisey> oh right, I forgot to mention that a is a subset of b
04:08 <enterprisey> lol
04:08 <Cale> the latter would get you something more like a+b*, right?
04:08 <enterprisey> otherwise they would indeed not be equivalent
04:08 <Cale> hmm
04:09 <enterprisey> the use case here is identifiers in a lexer, specifically a Python lexer
04:09 urodna_ joined
04:10 andyhuzhill joined
04:10 youtmon joined
04:10 andyhuzhill joined
04:10 <superguest> :t fromJust
04:10 <lambdabot> Maybe a -> a
04:10 urodna_ joined
04:11 shwouchk joined
04:11 <Cale> superguest: Just as a warning, usually you'd prefer to use a case expression, simply because if you ever happen to apply fromJust to Nothing, and your code uses fromJust more than once, you'll be pulling your hair out trying to find it
04:12 granttrec left
04:12 <Cale> Actually it's probably better to write (\(Just x) -> x) instead, since that'll at least give you a line number when it crashes
04:12 <Solonarv> I've taken to using `fromMaybe (error "some helpful error message")` instead of fromJust
04:12 <Cale> > (\(Just x) -> x) Nothing
04:12 <lambdabot> *Exception: <interactive>:3:2-15: Non-exhaustive patterns in lambda
04:12 <Solonarv> assuming I actually want to throw on Nothing, of course
04:12 <enterprisey> Solonarv's tip helps a lot in larger functions, even if I just use line numbers
04:12 <Cale> ^^ convenient inclusion of module name and line number / column span
04:13 <enterprisey> if I'm going very fast, sometimes I just smash my hand on the keyboard and grep later
04:13 <Solonarv> hah
04:13 <Cale> That way, you don't even have to write a custom message with it
04:13 <enterprisey> this was deployed successfully in my last group project
04:13 <Cale> similarly with stuff like (\(x:xs) -> x)
04:13 <Cale> it's always better to write that than to write 'head' except in particular idioms
04:13 <nitrix> Part of me wants fromJust to not exist and let people pattern match when that's their intention :(
04:14 <enterprisey> nitrix: begone, boilerplate :p
04:14 <Solonarv> or just rename it to reallyUnsafeFromJust
04:14 <enterprisey> it's like when I see Rust codebases full of if let's
04:14 <Solonarv> or remove fromJust and introduce fromJustOrError = fromMaybe . error ;)
04:14 <nitrix> I guess, but we have nicer things like MaybeT and stuff.
04:15 <enterprisey> true, true
04:15 <enterprisey> although my recent trend is to ditch taller stacks as much as possible
04:15 <enterprisey> in the parser I'm writing right now, I figured out how to eliminate the last bit of state, so I can ditch transformers entirely
04:16 <Solonarv> my current project (a game) just uses ReaderT / MonadReader and isomorphic monads
04:16 markus1189 joined
04:16 <enterprisey> sounds like fun
04:17 <enterprisey> at one point, we were doing complicated distributive laws in category theory class while writing our group project using them
04:17 <enterprisey> we never thought we'd be applying anything from that class haha
04:17 <Solonarv> I got pretty frustrated trying to get some C dependencies (namely, sdl2-gfx) working; I ended up just dropping it
04:17 <Solonarv> apecs is cool though
04:18 andyhoang1 joined
04:18 progfun joined
04:19 jchia joined
04:20 <superguest> I think fromMaybe is a good solution, but how might I use `case` to check for `Nothing` ?
04:20 keepLearning512 joined
04:21 lainon[m] joined
04:21 <nitrix> > case Nothing of Nothing = "superguest"
04:21 <lambdabot> <hint>:1:25: error:
04:21 <lambdabot> parse error on input ‘=’
04:21 <lambdabot> Perhaps you need a 'let' in a 'do' block?
04:22 <Solonarv> > let foo = Nothing in case foo of Nothing -> "superguest"; Just s -> s
04:22 <lambdabot> "superguest"
04:23 <nitrix> I'm rusty.
04:23 jchia joined
04:23 <Solonarv> /j #rust
04:24 taumuon joined
04:25 patlv joined
04:27 <superguest> why can't `case` accept `Nothing` directly?
04:27 <superguest> (just curious)
04:27 jchia joined
04:27 lainon[m] left
04:27 <enterprisey> > case Nothing of Nothing -> 1
04:27 <lambdabot> 1
04:28 <enterprisey> Also, any ideas on the fastest possible way to check if a character is in a bunch of non-overlapping ranges?
04:28 <superguest> > case Nothing of Nothing -> "superguest"; Just s -> s
04:28 <lambdabot> "superguest"
04:30 khilan joined
04:30 sakalli_ joined
04:31 fmixing joined
04:31 davr0s joined
04:32 <cocreature> enterprisey: stuff them in a Set?
04:32 <Axman6> or just use a bunch of predicates
04:33 <cocreature> yeah depends on how many ranges you have
04:33 pfurla_ joined
04:33 <Axman6> yeah if it's a small number of ranges, then predicates will be pretty fast
04:35 fmixing joined
04:35 <Axman6> also for certain ranges, there may be some fun bit tricks you can use if you need ludacris speed
04:37 progfun joined
04:37 markus1189 joined
04:37 <cocreature> I would expect that at least the llvm backend can find a lot of those tricks for you
04:38 takuan joined
04:41 <superguest> "fromMaybe :: a -> Maybe a -> a"
04:41 <superguest> Does "Maybe" in the above denote typeclass?
04:41 cschneid joined
04:41 <superguest> since 'a' is the type variable
04:41 <cocreature> no
04:42 <cocreature> Maybe is a type constructor that takes another type variable
04:42 <cocreature> "data Maybe a = Nothing | Just ä"
04:42 <cocreature> eh "Just a" :)
04:42 <superguest> cocreature, do you mean data constructor?
04:42 <rotaerk> type classes have type arguments too, but they're not the only thing
04:42 <Cale> superguest: Type classes show up to the left of the => in types, and they serve to constrain the types that type variables range over
04:43 <rotaerk> superguest, https://stackoverflow.com/questions/18204308/haskell-type-vs-data-constructor#18205862
04:43 <Cale> e.g. sort :: (Ord a) => [a] -> [a]
04:43 <cocreature> superguest: actually, I don’t! the data constructors are "Nothing" and "Just". "Maybe" is the type constructor
04:43 <Cale> Ord there is a type class, and means that a must be a type that has the ordering operations (such as (<=)) defined on it
04:44 <superguest> thank you
04:48 davr0s joined
04:48 nshepperd joined
04:50 cschneid joined
04:50 hphuoc25 joined
04:52 lastmanstanding joined
04:52 m4lvin joined
04:52 markus1189 joined
04:53 jackdk joined
04:54 Rayben joined
04:55 Rayben joined
04:56 <dminuoso> @let newtype Foo = Foo [(forall a. Num a => a)]
04:56 <lambdabot> .L.hs:171:15: error:
04:56 <lambdabot> • Illegal polymorphic type: forall a. Num a => a
04:56 <lambdabot> GHC doesn't yet support impredicative polymorphism
04:56 robstr joined
04:57 <superguest> Cale, I remember someone saying that typeclasses in Haskell should not be viewed as OOP interfaces, but that description has the appearance of an interface. hehe
04:58 <dminuoso> superguest: Well they can be used as OOP interfaces.
04:58 <cocreature> dminuoso just can’t stop hoping for impredicative polymorphism :)
04:58 connrs joined
04:59 <dminuoso> cocreature: Heh. Trying to fully grasp the concept of it. :)
04:59 <dminuoso> cocreature: it just occured to me that this should be a natural thing.
05:00 znack joined
05:02 <dminuoso> @let data Numish = forall a. Num a => Numish a
05:02 <lambdabot> Defined.
05:02 <rotaerk> superguest, they have some things in common with OOP interfaces, but they're not equivalent to them
05:02 <dminuoso> @let newtype Foo = Foo [Numish]
05:02 <lambdabot> Defined.
05:02 <dminuoso> I suppose that's the equivalent thing, right?
05:02 <cocreature> dminuoso: no
05:02 <cocreature> that’s an existential
05:03 <cocreature> the one above is universally quantified
05:03 nowhere_man joined
05:03 <cocreature> data Numish = Numish (forall a. Num a => a) would be the equivalent
05:03 <dminuoso> cocreature: Okay I gotta ask... what is the meaning of that then?
05:03 <cocreature> of the existential?
05:03 fishythefish joined
05:04 <dminuoso> No of an impredicative type
05:04 <nowhere_man> wow, I'm really playing with Haskell on CodinGame, and it's the first non-toy program I'm really writing with it, and I must say, static typing feels like a free test suite
05:04 <dminuoso> nowhere_man: Indeed.
05:05 <cocreature> dminuoso: well as I said it’s equivalent to "data Numish = Numish (forall a. Num a => a)" (minus the wrapping). not sure what other meaning you are searching for
05:05 <dminuoso> cocreature: Im not sure what the difference is here
05:06 cschneid joined
05:06 <cocreature> dminuoso: for the universal case once you unwrap it you get to choose the "a" that you want to instantiate it at
05:06 <cocreature> for the existential case you only get to know that there is _some_ a that is an instance of Num
05:06 <cocreature> all you can do with it is what this typeclass allows you to do
05:07 Dockyard joined
05:07 <Dockyard> ....
05:08 keepLearning512 joined
05:10 mariatsji joined
05:13 mpahrens joined
05:13 altjsus joined
05:13 <orzo> Is "flip fmap" already bound in base somewhere?
05:13 <cocreature> :t (<&>)
05:13 <lambdabot> Functor f => f a -> (a -> b) -> f b
05:13 <orzo> cool beans
05:13 Durbley joined
05:13 mariatsji joined
05:14 <orzo> uh, that's not base, is it?
05:14 <cocreature> https://hoogle.haskell.org/?hoogle=(%3C%26%3E)%20package%3Abase
05:14 pavonia joined
05:15 <orzo> oh, i have base
05:15 <rotaerk> it shows up on hoogle for me, but it doesn't work for me
05:15 <orzo> it's Since: base-
05:15 <cocreature> orzo: time to upgrade :)
05:15 <rotaerk> k
05:16 JanBessai joined
05:17 cschneid joined
05:19 lazyinitialized joined
05:19 slomo joined
05:19 slomo joined
05:20 Gurkenglas joined
05:21 <rotaerk> though, (<&>) is really more like flip (<$>), there should be an ffor for fmap
05:22 <rotaerk> just cause fmap is *sometimes* nicer than <$>, and probably ffor would find its uses
05:22 markus1189 joined
05:23 dexhunter joined
05:24 <rotaerk> hmm I'm tempted to make something to use instead of resourcet, something that's a little closer to regions without the invasiveness
05:24 xtreak joined
05:24 sebastian joined
05:26 isenmann joined
05:27 nowhere_man joined
05:30 malorie joined
05:30 connrs joined
05:30 cschneid joined
05:30 language_agnosti joined
05:31 nowhere_man joined
05:31 oisdk joined
05:31 arkeet joined
05:31 arkeet joined
05:32 huxing joined
05:33 <rotaerk> basically, avoid having to ever call "release" explicitly, avoid ever having a reference to a resource that is not valid assuming you don't return it to a context after release
05:34 <rotaerk> but the property that regions guarantees: the inability for a resource reference to escape the scope in which it is acquired
05:34 <rotaerk> but sacrifice the property that *
05:34 <rotaerk> too costly of a guarantee, and doesn't really buy you much
05:34 <* cocreature> whispers “Linear Haskell is waiting for you”
05:34 vlatkoB joined
05:35 <rotaerk> is linear haskell a real thing, or just a research topic
05:35 <cocreature> there is a branch for it and a GHC proposal but it hasn’t been merged yet
05:36 <rotaerk> I see
05:36 dilinger joined
05:36 danvet joined
05:36 <rotaerk> well the approach I was thinking of was something like:
05:36 <dminuoso> nowhere_man: It's even better than a test suite because it proves the absence of certain behaviors, rather than test only cases the programmer specified.
05:36 <dminuoso> nowhere_man: So within the scope of what a type system proves, a type system is just more complete. :)
05:37 andyhoang1 joined
05:37 trcc joined
05:37 trcc joined
05:37 markus1189 joined
05:38 dogweather joined
05:38 <dminuoso> For example when I see a signature `f :: Integer -> String` I know with certainty that this thing will not launch missiles when applied to 1. A test cannot give me that guarantee.
05:38 <dminuoso> Under the assumption nobody unsafePerformIO'd of course..
05:38 Durbley_ joined
05:39 <rotaerk> cocreature, https://pastebin.com/rk7MGsLu
05:39 <rotaerk> something like that is what I had in mind
05:39 pykello joined
05:39 <rotaerk> with pattern, but instead of the resource being allocated and being passed in, a scope is created, to which resources are added ... when the scope ends, all resources in that scope are cleaned up
05:40 <rotaerk> so you can do nested scopes for interleaved resources
05:40 lpeterse joined
05:41 <cocreature> rotaerk: not sure how interleaved resources would look like here. if you have with-style functions you still get stack based resource allocation, no?
05:41 <rotaerk> well I did interleaved in that example, see line 7
05:41 mikeplus64 joined
05:42 <cocreature> ah right, I see
05:42 <cocreature> so your scopes are stack-based but since you don’t need to allocate at the beginning of a scope you get interleaving
05:42 <rotaerk> right
05:43 <rotaerk> this is basically how regions works, but it has type shenanigans to guarantee other things that are probably not worth it
05:44 <cocreature> tbh I don’t think I ever actually needed interleaved resource allocation :)
05:44 <rotaerk> I have a couple examples of it
05:44 <cocreature> it always kind of bugs me that "bracket" forces me into that pattern but then it never seems to cause problems for me :)
05:44 taumuon joined
05:45 <ammar2> <dminuoso> For example when I see a signature `f :: Integer -> String` I know with certainty that this thing will not launch missiles when applied to 1. A test cannot give me that guarantee.
05:45 <ammar2> that's not true though
05:45 <rotaerk> cocreature, https://github.com/Rotaerk/vulkanTest/blob/master/main/src/Main.hs#L927-L935
05:45 <ammar2> it could be launching missiles and returning the status of the launch as the string :P
05:46 andreabedini joined
05:46 <cocreature> ammar2: not without unsafePerformIO
05:46 <geekosaur> only with unsafePerformIO, but you can enable Safe Haskell to catch that
05:46 <rotaerk> cocreature, so that first line is acquiring a buffer, and filling it with the contents of a file, then it's acquiring a shader based on its contents, but at that point I no longer need the buffer
05:46 <rotaerk> so that's a real example of interleaved
05:46 <ammar2> hey man you can launch missiles purely
05:46 <cocreature> rotaerk: thanks, that’s a nice example!
05:47 <cocreature> ammar2: well then launching missiles is not observable to the outside world and at that point why are you even launching missiles :)
05:47 <rotaerk> another example is a couple functions up, in fillBufferWithShaderFileContents
05:47 pfurla joined
05:47 <ammar2> fair enough
05:48 lgas joined
05:50 Linter joined
05:50 <rotaerk> in that function I acquire a file handle, check the file's size, create a buffer of that size, fill the buffer from the file, close the file, and return the buffer
05:51 hastalavista joined
05:52 <dminuoso> So [(forall a. Num a => a)] is a list of polymorphic values?
05:53 hphuoc25 joined
05:53 malorie joined
05:53 bs joined
05:53 <dminuoso> % set -XImpredicativeTypes
05:53 <yahb> dminuoso: ; <interactive>:6:6: error: Data constructor not in scope: XImpredicativeTypes :: ASetter s t a b -> b -> s -> t
05:54 <* hackage> postgresql-common - Library for sharing common PostgreSQL types across Haskell PostgreSQL libraries. http://hackage.haskell.org/package/postgresql-common- (IanDuncan)
05:54 <dminuoso> % :set -XImpredicativeTypes
05:54 <yahb> dminuoso:
05:54 <dminuoso> % let type NumList = [(forall a. Num a => a)]
05:54 <yahb> dminuoso: ; <interactive>:8:5: error: parse error on input `type'
05:55 <dminuoso> % let newtype List = List { unList :: [(forall a. Num a => a)] }
05:55 <yahb> dminuoso: ; <interactive>:9:5: error: parse error on input `newtype'
05:55 <dminuoso> % @let newtype List = List { unList :: [(forall a. Num a => a)] }
05:55 <yahb> dminuoso: ; <interactive>:10:1: error: parse error on input `@'
05:55 <geekosaur> prettu sure it doesn't need the "let"
05:55 <geekosaur> or want
05:55 <dminuoso> Oh
05:55 <dminuoso> % newtype List = List { unList :: [(forall a. Num a => a)] }
05:55 <yahb> dminuoso:
05:55 <dminuoso> geekosaur: Thank you =)
05:56 <geekosaur> not sure how persistent it is though
05:59 locallycompact joined
05:59 elephanter joined
05:59 nshepper1 joined
05:59 cur8or joined
06:00 alowaniak joined
06:01 errst joined
06:01 markus1189 joined
06:01 elephanter joined
06:03 mariatsji joined
06:03 _vaibhavingale_ joined
06:03 hphuoc25 joined
06:03 _vaibhavingale_ joined
06:04 <dminuoso> % type Foo = [(forall a. Num a => a)]
06:04 <yahb> dminuoso:
06:04 <dminuoso> % g :: (forall a. Num a => [a]) -> Int; g = length
06:04 <yahb> dminuoso:
06:04 <dminuoso> % g ([1,2,3] :: Foo)
06:04 <yahb> dminuoso: ; <interactive>:17:4: error:; * Couldn't match type `a' with `forall a1. Num a1 => a1'; `a' is a rigid type variable bound by; a type expected by the context:; forall a. Num a => [a]; at <interactive>:17:1-18; Expected type: [a]; Actual type: Foo; * In the first argument of `g', namely `([1, 2, 3] :: Foo)'; In the expression: g ([1, 2, 3] :: Foo);
06:05 elephanter joined
06:07 hastalavista left
06:08 falafel joined
06:09 <dminuoso> Is there a relationship of RankNTypes and impredicative types? They do look kind of similar, almost as if the former was a special case of the latter
06:10 <geekosaur> impredicative types are types that cross ranks, sort of
06:10 markus1189 joined
06:11 acertain joined
06:11 philippD joined
06:12 <geekosaur> so, for example, runST. if you try to partially apply it with (.), you get
06:12 <geekosaur> :t (runST .)
06:12 <lambdabot> error:
06:12 <lambdabot> • Couldn't match type ‘b’ with ‘forall s. ST s c’
06:12 <lambdabot> ‘b’ is a rigid type variable bound by
06:12 <geekosaur> because b is expected to be rank-1, but needs to be instantiated to a rank-2 type
06:13 slack1256 joined
06:13 <geekosaur> Expected type: b -> c
06:13 <geekosaur> Actual type: (forall s. ST s c) -> c
06:14 <dminuoso> % :t (runST .)
06:14 <yahb> dminuoso: (a -> forall s. ST s c) -> a -> c
06:14 <dminuoso> Mmm okay I think this makes sense
06:15 <geekosaur> more precisely, we "want" b there to have *any* rank
06:15 ThomasLocke joined
06:15 <slack1256> how to import all the symbols from a module from ghci (and not just exported functions)?
06:16 connrs joined
06:16 <geekosaur> you can't, unless you have the source with you. packages are compiled, the only symbols that exist are the exported ones
06:16 <geekosaur> if you have source available you can force it to be loaded interpreted and get all the symbols
06:17 <slack1256> I have the source available!
06:17 <geekosaur> then load it directly
06:17 <geekosaur> if this is part of your own program/library and it's loading a compiled one instead of source, precede the name of the module with *
06:17 <cocreature> :l will bring all symbols in scope, as will :module + *ModuleName
06:17 <cocreature> in general, https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html#what-s-really-in-scope-at-the-prompt is quite helpful to read
06:18 osa1 joined
06:18 <slack1256> Let me try that!
06:18 jeltsch joined
06:18 <geekosaur> also don't use -fobject-code because that probably also discards local symbols / unexported names
06:18 <cocreature> yeah it only works in interpreted mode
06:19 language_agnosti joined
06:20 phenoble joined
06:20 chele joined
06:21 <cocreature> I’m trying to go from [a] to Map a Int where each a gets assigned a unique identifier (I don’t care which one). is there some convenient solution for that? I can ofc turn it into a Set, zip that with [1..] and then use Map.fromList but that seems wasteful from a performance standpoint. there is ofc also the foldl' solution where I check if the element already exists in the Map and if not I insert it with
06:21 <cocreature> a new key but I’m hoping for something that already does that for me
06:21 paolino joined
06:21 ratschance joined
06:21 markus1189 joined
06:21 connrs joined
06:21 pranz3 joined
06:22 elephant_ joined
06:22 <cocreature> hm I guess I could just zip the original list with [0..] and use Map.fromList on that. I don’t care if identifiers are consecutive
06:23 pranz4 joined
06:24 <cocreature> yeah that works nicely
06:25 pranz joined
06:25 phreedom joined
06:26 keepLearning512 joined
06:26 Ariakenom joined
06:27 echoreply joined
06:27 <hololeap> anyone work closely with FRP? what's your favorite library?
06:27 DTZUZO joined
06:27 <slack1256> It works when using the :l or :module + *Mod syntax. Probably doesn't work inside cabal repl by the use of object code and not interpreted code. I will see if a flag can modify this behaviour.
06:27 <slack1256> thanks cocreature, geekosaur.
06:28 <cocreature> slack1256: cabal repl shouldn’t default to -fobject-code iirc. have you enabled that yourself?
06:28 <slack1256> *cabal new-repl
06:28 <cocreature> same there
06:28 pranz1 joined
06:29 shachaf joined
06:29 shachaf joined
06:29 dysfigured joined
06:29 davr0s joined
06:29 wonko77 joined
06:29 henriksod joined
06:29 <slack1256> No, I haven't enabled that flag. But using `cabal new-repl yi-keymap-emacs` and loading a module as `:module + *Yi.Keymap.Emacs` doesn't work as intended
06:30 <slack1256> Yet `:l source-file-of-that-module.hs` imports all the symbols as I want
06:31 sakalli_ joined
06:32 elephanter joined
06:33 <cocreature> is the module in a different component of your package, e.g., are you loading an executable in the repl and the module is from the lib?
06:33 pranz2 joined
06:35 amar joined
06:37 pranz3 joined
06:37 elephant_ joined
06:37 AfC joined
06:39 AfC joined
06:39 dogweather joined
06:41 pranz4 joined
06:42 hamishmack joined
06:43 pipahask joined
06:44 yrid joined
06:45 pranz joined
06:45 \u joined
06:45 \u joined
06:46 mitchellsalad__ joined
06:47 pikajude joined
06:48 exit70 joined
06:49 ian_andrich joined
06:50 llinguini joined
06:50 mitchellsalad__ joined
06:52 exit70 joined
06:53 davr0s joined
06:55 eruditass joined
06:55 simony joined
06:56 <AfC> cocreature: I'd been using Haskell for five years before I understood the difference between Maybe the type constructor and Nothing|Just the data constructors. I mean, using it constantly but not realizing that Maybe a is the Maybe type constructor being applied.
06:56 <cocreature> AfC: heh, luckily things clicked a bit faster for me :)
06:57 <dminuoso> AfC: Sometimes I recommend GADTSyntax to beginners - it helps visualize the difference a bit,
06:57 pranz1 joined
06:58 <dminuoso> data Maybe a where Just :: a -> Maybe a; Nothing :: Maybe a
06:58 progfun joined
06:58 language_agnosti joined
06:58 <dminuoso> Especially if you know to read `::` as "has type"
06:58 Peter_Storm joined
06:58 joehillen joined
06:59 osa1 joined
06:59 vodkaInf1rno joined
06:59 <AfC> That's sensible advice, I think. I really get screwed up in the newtype wrappers used to declare monad transformers and such. The implicit `runBlahT` takes a BlahT and gives you the thing inside and/or you give me the thing and we'll wrap it into a BlahT just doesn't come out from looking at the way it is in Haddocks. I squint all the time.
06:59 fmixing joined
07:00 pranz2 joined
07:00 baweaver joined
07:00 baweaver joined
07:00 <glguy> When you're using gadt syntax it's nice to use kind signatures, easy to see the kind of the type you're making and less misleading since the type variables don't actually scope over the data constructors being defined
07:00 Rayben joined
07:00 <cocreature> the fact that we often use the same name for types and constructors can also be quite confusing to beginners
07:01 grayhatter joined
07:01 grayhatter joined
07:01 llinguini joined
07:02 exit70 joined
07:02 <glguy> data Maybe :: * -> * where...
07:03 markus1189 joined
07:03 thc202 joined
07:03 aijony joined
07:04 hphuoc25 joined
07:04 pranz3 joined
07:04 <dminuoso> glguy: Wouldn't that bring the confusion back since you have :: meaning both `has kind` and `has type`?
07:05 language_agnosti joined
07:05 encod3 joined
07:06 pranz4 joined
07:06 Rayben joined
07:07 mitchellsalad__ joined
07:07 jdt joined
07:08 benl23 joined
07:08 cur8or joined
07:08 rann joined
07:09 bblfish joined
07:09 Peter_Storm joined
07:09 <quicksilver> well it avoids the confusion glguy was discussing.
07:09 fujiy joined
07:09 <quicksilver> consider data Either a b where Left :: b -> Either b a ...
07:10 bblfish_ joined
07:10 <dminuoso> Ah I suppose yeah
07:10 pranz joined
07:10 lortabac_ joined
07:11 elephanter joined
07:11 <quicksilver> however, my gut says that kind signatures are also confusing. But maybe they are less confusing if you actually teach them explicityly rather than sweeping them under the carpet
07:12 redcedar joined
07:12 <* quicksilver> sweeps the sorts under the carpet
07:12 simony joined
07:12 <dminuoso> Just teach TypeInType straight away!
07:12 rann joined
07:13 llinguini joined
07:13 exit70 joined
07:13 pranz1 joined
07:13 terrorjack joined
07:14 acidjnk joined
07:14 uditk joined
07:14 Argorok joined
07:14 msmorgan joined
07:15 elephant_ joined
07:15 <dminuoso> quicksilver: In my learning steps kind signatures were one of the most helpful concepts to learn - but it wasnt until Monad transformers that I could get a handle on them well. :)
07:15 eruditass joined
07:15 pranz2 joined
07:16 progfun joined
07:17 Linter joined
07:17 pranz3 joined
07:19 pranz4 joined
07:19 elephanter joined
07:19 zincy joined
07:19 <zincy> Whats the Haskell alternative to the observer pattern?
07:20 johnw joined
07:21 Ariakenom joined
07:21 <liste> zincy: depends. what's the use case? GUI? messaging between objects?
07:22 <quicksilver> I think the observer pattern is quite applicable in haskel
07:22 <liste> you can implement the observer pattern just fine
07:22 mreh joined
07:22 <liste> listeners :: [String -> IO ()]
07:22 <zincy> Thanks
07:22 <quicksilver> you can possibly use threads and Chans as well (or TChans)
07:22 <quicksilver> depends what you need
07:23 <liste> for GUI, FRP is a really nice solution
07:23 pranz1 joined
07:24 <liste> as implemented by eg. reactive-banana
07:24 <liste> @hackage reactive-banana
07:24 <lambdabot> http://hackage.haskell.org/package/reactive-banana
07:24 reactormonk joined
07:24 karlguy joined
07:24 elephant_ joined
07:24 <zincy> I have a game in a StateT Game IO and a separate Map of clients to websocket connections. I am not sure where I should push the game to the next state if no further player action is possible.
07:24 <zincy> Oh cool
07:25 malorie joined
07:25 <zincy> So there is a map of clients to connections , another map of games to clients subscribed
07:26 <zincy> The Game is basically an automaton which is progressed to the next state on player actions or should progress along states when no player action is possible (end of hand in card game)
07:27 oish joined
07:27 pranz2 joined
07:27 <zincy> Im confused about whether it is clean to just call a "progressGame" function whilst no player action is possible or whether this logic should be contained inside the game stateT
07:27 amar joined
07:28 language_agnosti joined
07:29 philippD joined
07:30 Scip joined
07:31 phenoble joined
07:31 connrs joined
07:31 agander joined
07:31 raichoo joined
07:32 ozzymcduff joined
07:32 locallycompact joined
07:33 Folkol_ joined
07:33 refold joined
07:35 <* hackage> multipool-persistent-postgresql, multipool-persistent, multipool (IanDuncan): https://qbin.io/memo-ru-lgb5
07:36 <* hackage> fastly - A highly experimental Fastly API client. http://hackage.haskell.org/package/fastly- (IanDuncan)
07:37 cschneid joined
07:37 elephanter joined
07:39 dogweather joined
07:40 blankhart joined
07:42 kvda joined
07:43 XorSwap joined
07:44 SolarAquarion joined
07:45 dogweather joined
07:45 hololeap joined
07:46 pranz3 joined
07:48 sakalli_ joined
07:49 <dminuoso> Do PureScript folks have a category similar to Hask?
07:49 <dminuoso> Or do category orgigamists just not use PureScript?
07:50 <* hackage> dfinity-radix-tree 0.0.0 - A Merkleized key–value data store. http://hackage.haskell.org/package/dfinity-radix-tree-0.0.0 (EnzoHaussecker)
07:50 yeevy joined
07:51 <ventonegro> dminuoso: What about the caterogy of Purescript types with functions as morphisms?
07:51 <ventonegro> category*
07:51 <dminuoso> ventonegro: well I meant does it have a name?
07:51 <dminuoso> "Pure"?
07:51 <ventonegro> dminuoso: Ah, sorry
07:51 <ventonegro> Purr, maybe? :)
07:53 markus1189 joined
07:53 phenoble joined
07:54 vurtz joined
07:55 language_agnosti joined
07:57 mnoonan joined
07:57 trcc_ joined
07:57 xacktm joined
07:57 <khilan> Hello! I'm a beginner in haskell and trying to implement some functions. Plz forgive me for a silly question. What's the correct syntax for using 'let' in if ? <https://lpaste.net/3568612112051732480> (This part of code is in a 'do' block). Can someone plz hep me?
07:58 <thblt> khilan: you're trying to mutate a variable, right?
07:58 <khilan> Right sir, at a later stage
07:58 <cocreature> you can’t mutable variables in Haskell
07:58 <cocreature> (or at least not in the way you’re used to)
07:58 <thblt> khilan: well, you can't. Your code looks a lot like you're trying to port a C nested for in Haskell.
07:58 <cocreature> make a recursive function that takes the rank as an argument
07:59 <khilan> But I've declared at as a mutable reference. Something like `rankRef <- newSTRef (0 :: Int)`
07:59 <cocreature> then you can call it with (rank + 1) as the new argument
07:59 <cocreature> I wouldn’t recommend using an STRef for this
07:59 <dminuoso> khilan: `let` just introduces a binding inside an arbitrary expression
07:59 <liste> khilan: then you need to use the STRef functions for mutation
07:59 <liste> mutation is not assignment
07:59 <cocreature> you can modify the value of an STRef using writeSTRef
07:59 <cocreature> or modifySTRef
07:59 <khilan> Plz Wait, I'll paste the code
08:00 malorie joined
08:00 <ventonegro> khilan: I suggest that, given you said yourself are a beginner, you stay away from ST
08:00 slaznick joined
08:00 <dminuoso> khilan: Unrelatedly, the idiom `if ... then ... else return ()` is better written with `when`
08:00 <thblt> This really needs a step back. The code khilan linked to is really a line-for-line port of some imperative code. IMO it would be better to start over, thinking how to solve the problem in Haskell
08:01 <khilan> https://lpaste.net/5825943169304363008
08:01 <khilan> Plz have a look at it
08:01 RegEchse joined
08:01 <khilan> I know it is a bit confusing
08:01 <drdo> holy crap
08:02 <cocreature> let rank = length (filter (\(m,n) -> I.Index kernel (k,l) > I.index kernel (m,n)) (liftA2 (,) [0..29] [0..29]))
08:02 <cocreature> no need for any ST for calculating rank
08:02 <drdo> khilan: Are you trying to learn haskell?
08:03 <khilan> Yes actually but I also need to implement a code soon
08:03 <khilan> `let rank = length (filter (\(m,n) -> I.Index kernel (k,l) > I.index kernel (m,n)) (liftA2 (,) [0..29] [0..29]))` Ok, I'll try this out
08:04 <cocreature> don’t just try it out blindly. make sure you understand what it’s doing or ask questions if you don’t understand something
08:05 <khilan> yes sir
08:05 connrs joined
08:06 <khilan> Sorry but I didn't get the last part of the expression, liftA2...
08:06 <cocreature> your code also seems weird. you write to the same index 30*30 times
08:06 <cocreature> > liftA2 (,) [1,2,3] [4,5,6]
08:06 <lambdabot> [(1,4),(1,5),(1,6),(2,4),(2,5),(2,6),(3,4),(3,5),(3,6)]
08:06 <cocreature> it’s equivalent to a list comprehension
08:06 <cocreature> > [(x,y) | x <- [1,2,3], y <- [4,5,6]]
08:06 <lambdabot> [(1,4),(1,5),(1,6),(2,4),(2,5),(2,6),(3,4),(3,5),(3,6)]
08:06 <khilan> Oh ok, I see
08:07 kuttifunk joined
08:07 <stilgart_> > (,) <$> [1,2,3] <*> [4,5,6]
08:07 <lambdabot> [(1,4),(1,5),(1,6),(2,4),(2,5),(2,6),(3,4),(3,5),(3,6)]
08:07 <khilan> yes sir, actually I'm getting a runtime error. Trying to figure that out
08:07 <cocreature> khilan: why are you updating the same index (i,j) in line 69 30*30 times? it seems like you are just overwriting the pixel so only the last write matters
08:08 <cocreature> afaict you also don’t need to use any array manipulation here and you can instead create the array using makeImage
08:09 <khilan> Oh ok, now I understand. In the last part I.write arr...,right?
08:09 <cocreature> yes
08:09 <khilan> Oh yes, I seem to have missed one assignment in the loop
08:09 <cocreature> and this line is called with the same (i,j) for all (k,l) i.e. 30*30 times
08:10 philippD joined
08:10 <cocreature> I would recommend that you start by pulling parts of accBin out into separate definitions (either in a where clause) or as separate top-level definitions
08:10 tsaka__ joined
08:11 louispan joined
08:11 <khilan> Ok sir, u mean small functions?
08:11 <cocreature> yes
08:11 <cocreature> your code basically consists of 6 nested loops, that’s pretty hard to read :)
08:12 language_agnosti joined
08:12 Klumben joined
08:12 madsj joined
08:12 <khilan> yes sir, that's true 😅 But I need to break the image into some contextual regions and then perform some kind of manipulation
08:12 tomphp joined
08:13 <khilan> So, I was unable to think of some other way
08:14 <cocreature> it’s somewhat hard to say what a better way is since the current code seems to be contain a mix of logical errors (i.e. writing to the same index multiple times) and misconceptions about the way Haskell works (trying to reassign variables using let).
08:14 <cocreature> so I would recommend that you isolate smaller parts of that code for which it is clear what the result is supposed to be.
08:14 <cocreature> then people can help you express these in Haskell
08:15 _vaibhavingale_ joined
08:15 <ManDay[m]> looking at that code I'd rather recommend reading a good tutorial on how to think and program functionally
08:15 <khilan> yes sir, I understand ur point. The psudocode I'm trying looks something like this <https://lpaste.net/5990068983674437632>
08:16 <khilan> yes sir. Actually, I've been working with python and all since long so the transition is a bit difficult for me 😅
08:16 <drdo> khilan: You're trying to write C in haskell
08:16 <ManDay[m]> khilan: that's imperative pseudo code
08:16 <ManDay[m]> you'd better use a imperative language to implement that as-is
08:16 <drdo> It's possible, but that defeats the purpose of learning haskell in the first place
08:17 trcc joined
08:17 mnoonan joined
08:17 andreabe_ joined
08:17 <khilan> yes sir, I understand. But, I need to implement this algo in haskell 😅
08:17 <cocreature> khilan: alright, a good small part here seems to be a function that takes the contextual region as its input and outputs the rank
08:18 <cocreature> so start by writing that function as a new top-level definition
08:18 <khilan> I'll try to work in a dfferent manner
08:18 <khilan> yes sir
08:18 <cocreature> hint: I’ve already given you most of the code for this
08:18 <khilan> yes sir 😅 . Thank u soo much!
08:19 <khilan> I'll try writing this differently and ping you if I've any doubts. Thank u everyone for helping me out!
08:20 <thblt> Talking about learning Haskell, is there an ETA on the final version of the Haskell Book? (and hopefully dead tree version as well)
08:20 danvet joined
08:20 Boomerang joined
08:20 <ManDay[m]> khilan: For the record, you're not supposed to use "loops" or "do" in Haskell. It might sound weird, but that's the core of functional programming. The rest is just convenience and exceptions.
08:21 <khilan> yes sir, I'll try to avoid it. Thanks!
08:22 zero_byte joined
08:22 __monty__ joined
08:22 <ManDay[m]> If you want to learn functional programming, try Scheme - it will not give you the facilities to be mislead into doing such things in the first place. Once you understand the principle, Haskell may become your language of choice.
08:22 <ventonegro> It's fine to start with Haskell...
08:23 <thblt> Or read a book on Haskell, and don't try to import what you know into the language.
08:23 <ManDay[m]> ventonegro: khilan just gave the best example that it is more likely to mislead you (of course a good learning resource will prevent that, but still)
08:23 <quicksilver> I disagree quiet strongly wiht "you're not supposed to use `do` in Haskell". Do notation was added to the language for excellent reasons.
08:24 <quicksilver> but, I agree with the spirit of the advice you're being given. Learn to program functionally.
08:24 <ventonegro> ManDay[m]: Scheme has `do` and `set!`, so I fail to see your point
08:24 <khilan> yes sir, I'll :-)
08:25 <ManDay[m]> ventonegro: It has do? In which version?
08:26 <ManDay[m]> That wouldn't make any sense in Scheme's world.
08:26 <ventonegro> ManDay[m]: http://www.schemers.org/Documents/Standards/R5RS/HTML/
08:26 amar joined
08:26 <ventonegro> ManDay[m]: It's not Haskell's `do`, obviously
08:27 <ventonegro> A better link: http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-7.html#%_sec_4.2.4
08:28 <ManDay[m]> I can't find it in r6rs though
08:28 <cocreature> http://www.r6rs.org/final/html/r6rs-lib/r6rs-lib-Z-H-6.html lists it
08:28 <ManDay[m]> Ah there, in the std lib
08:28 <ManDay[m]> Yes, ok
08:28 amar joined
08:28 dddddd joined
08:29 xtreak joined
08:30 ar17 joined
08:30 c50a326 joined
08:31 edwin0 joined
08:33 <Ariakenom> Haskell is the best imperative language
08:33 <* Ariakenom> has hit and now runs
08:33 ar17 joined
08:36 Folkol_ joined
08:36 agander joined
08:36 <c50a326> hey I think I'm going to write a websockets/leveldb backend using haskell just for fun etc... what's the best way to find out which are the best libs to use for such things
08:36 <c50a326> e.g. npm for node.js has a site that shows how many weekly downloads and so on
08:36 <c50a326> and github has stars
08:37 <c50a326> I know that there is stack and cabal cli tools right? maybe I can use them or maybe there is some site I should use?
08:37 <c50a326> a search here https://www.stackage.org/lts-11.14/hoogle?q=websocket doesn't give you these kinds of insights, not sure how it's ordering results
08:39 elephanter joined
08:40 keepLearning512 joined
08:42 tomphp joined
08:43 philippD joined
08:43 tomphp joined
08:43 andyhuzhill joined
08:44 keepLearning512 joined
08:46 language_agnosti joined
08:46 elephant_ joined
08:47 Darwin226 joined
08:48 <Darwin226> Hey guys. Could I get some assistance with writing rewrite rules? I get a warning that my rule may not fire "because rule "Class op >>=" for ‘>>=’ might fire first". It suggests adding a phase annotation, but after adding one I still get the warning
08:48 <Darwin226> and my rule indeed does not fire (but that's perhaps because I wrote it wrong)
08:49 andyhuzhill joined
08:49 <ManDay[m]> I understand "do" being of non-functional origin. In the original purpose (I'm speculating here based upon what I've read about the use of monads), it serves as syntactic sugar to make a call of nested functions, where each is being passed a result from the parent, into a more readable syntax. The origin for which is that the parent function has a side-effect and the nesting imposes an order. Without side-effects,
08:49 <ManDay[m]> therefore, no "do" notation should exist.
08:49 <Darwin226> How can I make sure my rule goes before the "Class op >>=" one?
08:49 dhil joined
08:49 markus1189 joined
08:49 nschoe joined
08:50 <ManDay[m]> In Scheme, the lack of "do" is compensated for by the fact that stuff is ordered and I can use side-effects and adjoin multiple calls.
08:50 <ManDay[m]> In both cases, the origin/motivation for that particular feature is side-effects (non-functional behaviour)
08:51 <ManDay[m]> In that sense, I think using "do" should be an exception, and in that mostly tied to parts which have side-effects
08:51 valentinbuza joined
08:51 ziyourenxiang joined
08:52 <ManDay[m]> (cause otherwise, the chaining of functions in that manner should be rare)
08:52 encodes joined
08:52 <iron_houzi> Hi. I'm trying to learn monadic parser combinators while writing my own parser for Tibetan represented in latin alphabet. In Tibetan script you write in both horizontal (L2R) and vertical (T2B). Figuring out how to stack letters vertically is the main challenge. You have a root letter that can have a letter ontop of it: superscribe, and a letter below it: subscribe. I've written parsers for each of these.
08:52 <ventonegro> ManDay[m]: The chaining of functions is not rare in functional programming
08:52 <iron_houzi> I've combined them to work like an XOR, but I need true OR combination as well, where a root letter has both a superscribed and subscribed letter. The problem is that if my superscribe parser matches, it consumes the root letter, so the subscribe parser cannot be used. Is there a way to combine simple parsers to achieve my goal, or do I need a "big" parser that handles all the cases in one parsing step?
08:52 <iron_houzi> Here's my code so far: https://github.com/ironhouzi/hstib/blob/tib_monad/src/Main.hs
08:54 takuan joined
08:55 <ManDay[m]> ventonegro: We're talking about a particular kind of chaining f(...,g(...)) where f passes things to a higher order g(...), as opposed to passing things to just g. I think that's not so very usual.
08:55 <ManDay[m]> (maybe I'm wrong, I'm not experienced)
08:56 merijn joined
08:57 <encodes> is there some way to turn a function which returns a value with the type of a class defining function into a function which provides an instance of the class so that it can be used to satisfy a constraint?
08:57 <ManDay[m]> iron_houzi: How is root+above+below interpreted? Is it a single token so that it only makes sense together or does the "root+above"-part and the "root+below"-part of the complete thing make sense by themself?
08:57 <ventonegro> ManDay[m]: A non-trivial portion of my code is just a lot of calls to `traverse`
08:58 <ventonegro> ManDay[m]: So I think you'll soon realise that monadic bind is actually very common
08:58 <iron_houzi> ManDay[m]: Yes, they do make sense on their own
08:58 pranz4 joined
08:58 <ManDay[m]> ventonegro: Traverse as in adjoining multiple calls (such as Scheme would do with (lambda (x) (something) (something_else))) ?
08:58 slomo joined
08:59 trcc_ joined
08:59 <merijn> ManDay[m]: traverse as in
08:59 <merijn> :t traverse
08:59 <lambdabot> (Applicative f, Traversable t) => (a -> f b) -> t a -> f (t b)
08:59 <ventonegro> ManDay[m]: `traverse` applies an effectul function to a list of arguments, sequencing the effects
08:59 <ManDay[m]> iron_houzi: In that case, since it's a question about consumption of a common piece, you need to retain the piece, because neither of the two parser-parts "owns" it. Meaning, your parse will have to hand it back, after it's done parsing it.
08:59 <ManDay[m]> (i.e. return the root from the parsers)
08:59 <merijn> ventonegro: Which, btw doesn't use monadic bind at all :p
09:00 <iron_houzi> ManDay[m]: That is the question though .. it can be tokenized as a single token if all three matches .. but only two might match as well .. you get the permutation: (super+root+sub,super+root,root+sub)
09:00 hphuoc25 joined
09:00 trcc__ joined
09:00 <ManDay[m]> ventonegro: So we *are* talking about side-effects?
09:00 <ManDay[m]> In that case, of course, the "do" is reasonable.
09:00 <ManDay[m]> (in my opinion)
09:00 <ventonegro> merijn: true, it's for Applicative
09:01 <iron_houzi> ManDay[m]: Oh .. parser combinators doesn't need to consume all letters it has analyzed?
09:01 <ManDay[m]> iron_houzi: What is the question? My answer is: Since no one can claim ownership, they have to return (reproduce) it.
09:01 <ventonegro> I was trying to argue that non-trivial function composition, such as `<*>` or `>>=` are very common
09:01 <ManDay[m]> iron_houzi: It does consume them, but it also returns them!
09:01 <ManDay[m]> Of course, there is a certain arbitrariness in choosing the precedence of the parsers (top-root vs bottom-root)
09:02 <ventonegro> ManDay[m]: Moreover, have you seen arrows? https://www.haskell.org/arrows/
09:02 pranz joined
09:02 <iron_houzi> ManDay[m]: Thank you. I'll look into it.
09:02 <c50a326> guys how do you search for packages
09:02 <ManDay[m]> ventonegro: No, thanks for posting!
09:03 <c50a326> I'm finding hoogle bad, it doesn't give insights on packages like amount of downloads or stars or something?
09:03 <dminuoso> iron_houzi: note that a parser *combinator* is just something that takes one or more parsers and gives you a parser back =)
09:03 <c50a326> I need to find the best websockets lib
09:03 kvda joined
09:03 <encodes> such as a function of type 'Encodes i (Show a) => i -> (a -> String)'
09:03 juhp joined
09:04 <dminuoso> iron_houzi: `many` for example can be seen as a parser combinator. :)
09:04 <iron_houzi> dminuoso: Sure .. I just thought there was a basic pattern that would need to be followed in order to not break the combinatoric properties of the parsers ..
09:04 <dminuoso> iron_houzi: Oh that was just regarding your comment "parser combinators [dont] need to consume..."
09:05 <dminuoso> its parsers that can consume things, not parser combinators. :)
09:05 <encodes> where show is the function returned
09:05 <dminuoso> c50a326: You can use hackage to search for packages.
09:06 cschneid joined
09:06 <iron_houzi> dminuoso: OK .. do you see how I can have a parser consume a character from the input string but also put it back into the output string and be able to combine it with other parsers when using monadic parser combinators?
09:07 <ManDay[m]> iron_houzi: You're not putting things back in functional programming. You're returning things.
09:07 <c50a326> cool thanks
09:07 <ManDay[m]> putting things back = "set!"
09:08 <dminuoso> merijn: Hey btw, I took the first cabal things to fix.. what a weird codebase :o
09:08 pranz1 joined
09:09 zv joined
09:09 pranz2 joined
09:10 daniel-s joined
09:10 ogrady joined
09:11 <__monty__> c50a326: Only useful place with download statistics I know is hackage but the stats aren't all that useful unless there's orders of magnitude difference. Best way I've found is to find out all the packages that do something and then look for discussions on those packages.
09:11 <ManDay[m]> iron_houzi: I don't know your architecture, but if your parser returns another parser for continuing, then it's simply that your returned parser must be of higher order and is reduced by one order from the first parser by getting passed the "root"
09:11 pranz3 joined
09:12 ijks joined
09:13 <encodes> with class Encodes a b where decode :: a -> Dict b
09:14 language_agnosti joined
09:14 pranz4 joined
09:15 kvda joined
09:15 <__monty__> iron_houzi: Sounds like you might want the superscript parser to do a lookahead parse with the subscript parser?
09:16 <iron_houzi> __monty__: Yeah .. is that easily done when using monadic parser combinators?
09:17 <__monty__> iron_houzi: I know megaparsec has lookahead.
09:17 <__monty__> Not sure about other packages.
09:17 <encodes> perhaps its the wrong approach, its confusing
09:18 <iron_houzi> __monty__: OK, but I'm kindof writing it all myself .. as I'm also learning Haskell and advanced FP .. I have a feeling lookahead might be very involved at this stage ..
09:18 pranz joined
09:19 raichoo joined
09:19 <encodes> it could have something to do with reify... possibly :-/
09:19 <iron_houzi> .. getting used to Monads while also learning about monadic parser combinators ..
09:20 progfun joined
09:21 <ManDay[m]> it's not about lookahead, it's about currying correctly or returning correctly. it's purely conceptual and shouldn't be related at all to language specifics like monads.
09:21 pipahask joined
09:22 <ManDay[m]> parsers consume things in a specific order (necessarily so). You don't want it to consume, so you must retain it.
09:22 <__monty__> A non-consuming parser is the same as lookahead.
09:22 <ManDay[m]> i guess, if you want to call it that ;-)
09:23 elephanter joined
09:23 harfangk joined
09:23 <dminuoso> iron_houzi: Like I said, you might have an easier time learning State before Parser. :-)
09:24 Sampuka joined
09:24 pranz1 joined
09:24 <c50a326> is there a more appropriate embedded database for using with haskell? the leveldb libs don't seem very popular/active
09:25 <dminuoso> c50a326: what kind of requirements do you have?
09:25 beauby joined
09:25 <c50a326> dminuoso: very basic at the moment, some KV kinda stuff
09:25 blankhart joined
09:26 <dminuoso> c50a326: Persistable?
09:26 <c50a326> dminuoso: yes
09:26 <c50a326> dminuoso: ultimately to manage identity and a directory service for chat rooms
09:27 <c50a326> which in the first instance is just users/messages that can be requested/streamed (websockets) for a given room
09:27 <__monty__> Only haskell native db I know of is project-m36.
09:27 <dminuoso> c50a326: You could look at haskey
09:29 <liste> c50a326: check out acid-state
09:29 <liste> @hackage acid-state
09:29 <lambdabot> http://hackage.haskell.org/package/acid-state
09:29 markus1189 joined
09:29 catsup joined
09:30 <dminuoso> Oh thats neat :)
09:30 blankhart joined
09:30 catsup joined
09:31 kuttifunk joined
09:31 <liste> c50a326: https://ocharles.org.uk/blog/posts/2013-12-14-24-days-of-hackage-acid-state.html is a nice introduction
09:31 <dminuoso> liste: That thing might be just what I need :)
09:32 <liste> the biggest disadvantage is that the whole dataset must fit in memory
09:32 <liste> though ofc you can keep just file references in it
09:34 <dminuoso> liste: I suppose most good key-value stores have that property (since very often top performance is demanded by them)
09:34 <dminuoso> Redis has that requirement too, doesnt it?
09:34 <liste> I think so
09:35 <nshepper1> the combinator for a non-consuming parser in the `parsers` package is in fact just called lookAhead
09:35 agander joined
09:36 <ManDay[m]> iron_houzi: I think that was for you ^
09:37 markus1189 joined
09:38 ozzymcduff joined
09:39 elephant_ joined
09:39 language_agnosti joined
09:41 <iron_houzi> nshepper1: Interesting, thanks
09:42 malorie joined
09:43 vmandela joined
09:44 KeyJoo joined
09:45 mkoenig joined
09:45 skeuomorf joined
09:46 Linter joined
09:49 elephanter joined
09:51 xkapastel joined
09:52 tsaka__ joined
09:53 tomphp joined
09:54 AndreasPK_ joined
09:54 zariuq joined
09:58 trcc joined
09:58 reactormonk joined
09:59 elephanter joined
10:00 humanoyd joined
10:02 desperek joined
10:03 elephant_ joined
10:03 language_agnosti joined
10:04 amirpro joined
10:07 AndreasPK_ joined
10:10 language_agnosti joined
10:10 <c50a326> wow haskell has no love, even the haskell/network project on github has less than 200 stars
10:11 bno1 joined
10:11 <Rembane> It's a ninja project.
10:11 inad922 joined
10:11 <Rembane> We're trying to go under the radar.
10:11 pfurla joined
10:11 agander_ joined
10:11 <ManDay[m]> The channel seems to have 1.5k+ users, I'd call that love...
10:11 <dminuoso> We're just busy writing code instead of putting stars on github.
10:12 <dysfun> we tend not to put much stake in github stars
10:12 <dminuoso> How do you quantify the quality of a project?
10:12 <dysfun> read the code?
10:12 <ManDay[m]> the cool kids have all gone over to gitlab anyway
10:13 <dminuoso> No I mean.. is there actually a way to meaningfully deterine the quality of some code?
10:13 <dysfun> yes, reading it
10:13 <dminuoso> ManDay[m]: I've prefered gitlab for a while.
10:13 matsurago joined
10:13 <dysfun> i moved by last client but one from gitlab to github because gitlab couldn't keep a tent up
10:13 fendor joined
10:14 <ManDay[m]> you've been cool before everyone else ways! I just found gitlab by accident, but I like it. esp. that you can keep a repo priv if you see fit
10:14 tomphp joined
10:14 jcarpenter2 joined
10:14 <ManDay[m]> back when i started on gitorious, THAT was the place to be...
10:14 <dysfun> there are still people using cgit
10:14 <ManDay[m]> i give gitlab 4 years until... git... gitsource comes along as the new cool
10:14 <ManDay[m]> cgit, ugh
10:15 blankhart joined
10:15 <dysfun> i think the ultimate answer is proper bidirectional mirroring, and i don't just mean of repositories - issues, PRs etc.
10:15 <dysfun> then people can use what they like and we dont' have to fear any of the third party providers going away
10:15 <ManDay[m]> well... that's the point of git, kinda... but you have to choose your upstream eventually
10:16 language_agnosti joined
10:16 <dysfun> well yes, you can make your own endpoint the upstream and for convenience, mirror with github, gitlab etc.
10:16 <ManDay[m]> not sure whether a git(lab|hub|*) repo can have an upstream set? but i suppose so?
10:16 <dysfun> does a fork not have an upstream set?
10:16 <dminuoso> ManDay[m]: For us gitlab has better integrated services, especially CI. :)
10:16 <locallycompact> gitlab gets CI right, I have no idea how to find how to do anything on github
10:16 <dysfun> dminuoso: their CI is the worst tho :?
10:17 <dminuoso> dysfun: It's fine for ours purposes.
10:17 dhil joined
10:17 <dminuoso> dysfun: What dont you like about it?
10:17 <dysfun> we had major difficulties with it just stopping working randomly
10:17 <dysfun> we moved to circle
10:17 markus1189 joined
10:17 <dysfun> and i got annoyed with that so i'm building my own at present as a commercial project
10:17 <dminuoso> Fair enough
10:17 <dminuoso> dysfun: What kind things are you building in there?
10:18 <dysfun> dminuoso: i'm focusing on making the basics work more than anything, seems like most CIs don't
10:18 <dysfun> in particular, debugging. when you fuck up a circleci configuration it spits back s-expressions
10:19 cronokirby joined
10:19 <dysfun> also you can bring your own docker/aws/whatever cloud for running on as standard
10:20 haiming joined
10:20 elephanter joined
10:20 <* dysfun> isn't mad keen on docker generally, but i have to admit, it's very good for running tests on
10:20 <encodes> right now its throwing a type error; https://lpaste.net/8349289481370599424
10:21 <dminuoso> dysfun: Yeah fair enough. So far we haven't had too many issues with gitlab-ci but most of our things are not complex and rather trivial.
10:21 oo_miguel joined
10:21 <dminuoso> Or maybe we were just lucky.
10:22 <* hackage> clifm - Command Line Interface File Manager http://hackage.haskell.org/package/clifm- (pasqu4le)
10:23 <dysfun> dminuoso: yeah, our needs grew and tbh none of the CIs out there today are really very good at the advanced stuff
10:23 keepLearning512 joined
10:23 simukis joined
10:23 <dysfun> i've been planning this for years, putting it off and off because "surely someone will fix this properly any day now!"
10:23 <* dysfun> gave up waiting
10:24 <dminuoso> dysfun: I guess gitlab in the end is tailored for the masses who usually have simple things.
10:25 <dminuoso> And for them gitlab I'd say is a great match.
10:25 <dysfun> right, i suppose it's fine for the basics
10:25 <encodes> this error seems to suggest proxy, and then reify. can anyone help?
10:25 <dysfun> the thing is though, i think a lot of what i do is basic, just not well supported
10:26 <dysfun> and i cannot for the life of me imagine that literally everything i do is so strange nothing can handle it well
10:26 <c50a326> what is commercialhaskell and why is it called that
10:27 <c50a326> I don't like this word "commercial", I spend a lot of time moaning about how things are "commercial"
10:27 <dysfun> c50a326: it's a group of people using haskell commercially, to promote keeping haskell useful in production
10:27 <dminuoso> c50a326: https://github.com/commercialhaskell/commercialhaskell#readme
10:28 <dysfun> the people behind it are good people with reasonable intentions
10:28 <dminuoso> dysfun: In a way it reminds me of this "docker" vs "nixos" battle I had. Somewhat frequently people in here tell me "this would be easy with nixos" or "just use nixos"
10:28 <* hackage> potoki-zlib 0.3 - Streaming ZLib decompression http://hackage.haskell.org/package/potoki-zlib-0.3 (IrinaArtemeva)
10:28 <tdammers> everything is easy with nixos, once you have mastered the hard parts
10:28 <dminuoso> But nixos feels like this huge mountain of knowledge I need to absorb before I can use it. It doesnt appear to be simple.
10:28 <cronokirby> so nix is the haskell of build tools?
10:29 <cronokirby> 8^)
10:29 timp joined
10:29 <dminuoso> tdammers: Right, and that's a bit frustrating. :(
10:29 tomphp joined
10:29 <dysfun> dminuoso: nixos is horrible though
10:29 <c50a326> nix is a container engine?
10:29 tzemanovic joined
10:29 <dysfun> nix is a package manager
10:29 <c50a326> I thought it was a package manager
10:29 cschnei__ joined
10:30 <dysfun> it can do containers and stuff
10:30 <dminuoso> dysfun: why is nixos horrible?
10:30 danso joined
10:30 language_agnosti joined
10:30 <dysfun> dminuoso: well nix for starters, plus systemd
10:30 <c50a326> so how can "nixos vs docker" err... what does it mean
10:30 <dysfun> c50a326: if you are using nix already, it can handle making docker containers
10:30 <c50a326> I've been after something to use instead of docker since I don't like having to make sense of what docker has become these days
10:31 <dysfun> well i can't make sense of nix, so good luck with that
10:31 <c50a326> yeah but at least it's less of a load of business nonsense I think
10:31 <cronokirby> the only contact I've had with nix so far is people telling me how much better it is than stack
10:31 <dysfun> i'm not gonna argue docker isn't horrible tbh, it is. especially now i've spent ages with the docker engine api
10:32 <dysfun> however, nixos' docker support still uses docker
10:32 <c50a326> docker is all concerned with marketing, I don't like all that, not a nice direction
10:32 <dysfun> docker is concerned with making themselves profitable
10:32 <dysfun> the docker engine api gets literally everything about good api design wrong
10:32 haiming joined
10:32 <dysfun> it is a masterpiece of wrong
10:32 <dminuoso> dysfun: Heh I recently had this situation where I ended up with a complex docker setup, intermediate images, pushing and pulling images for caching purposes.
10:33 <dysfun> it's only "good" in the sense that even people doing this shit for years want to have the money to buy support
10:33 <dminuoso> And at the end I ended up with a container containing.. exactly one file...
10:33 <dysfun> dminuoso: hey, wait for my CI, building docker images will be *awesome*
10:33 markus1189 joined
10:34 <dminuoso> dysfun: Great. Let me tell my boss that we have to stop shipping releases for.. a while...
10:34 <dysfun> dminuoso: it's more like "hey, i can make this pain go away in a while, have fun for now" :D
10:34 Mortomes|Work joined
10:35 <encodes> HA! good boss
10:35 <dminuoso> dysfun: Realistically most of our concerns are not as much the building process
10:35 haiming joined
10:35 blankhart joined
10:35 <dminuoso> It's that we want an elegant way to deploy with networking done *just right*
10:35 language_agnosti joined
10:36 <dysfun> i don't know quite what that means in practice, but sure
10:36 tomphp joined
10:37 haiming joined
10:37 tomphp joined
10:37 <encodes> did anyone check; https://lpaste.net/8349289481370599424
10:37 <dysfun> dminuoso: also, i'll be happy to make you a beta tester if you like
10:38 tomphp joined
10:39 tomphp joined
10:39 Lorenzo_QZ joined
10:40 language_agnosti joined
10:41 <tdammers> "nix vs docker" is valid once you take a step back and think about the problem you were trying to solve in the first place
10:42 <dysfun> ooh, is it "how can we be more hip?"
10:42 <dysfun> or "why isnt this webscale enough?"
10:42 <tdammers> the problem isn't "set up containerized infrastructure", the problem is "I have an application that needs to run on a server, and I need to make sure the server matches the application's expectations as far as the runtime environment is concerned"
10:43 haiming joined
10:43 tsaka__ joined
10:43 <tdammers> the traditional way of doing that is to run the same OS on all your servers, and then script all your provisioning and deployments
10:43 <tdammers> following down that route, you get stuff like puppet, chef, ansible, etc.
10:43 <* dysfun> took out a kubernetes early this year to replace it with the old way
10:44 <dysfun> their HA wasn't actually increasing availability
10:44 <tdammers> then you have the brute force method of just running everything in a VM, and instead of scripting your provisioning and deployment, you just package up your tested VM images wholesale, and push those to the VM host
10:44 <tdammers> just tear everything down and restart the entire VM
10:45 python476 joined
10:45 <quicksilver> docker got a whole lot of people doing immutable infrastructure, and immutable infrastructure is way better.
10:46 <quicksilver> but I think we might be off topic?
10:46 language_agnosti joined
10:46 <c50a326> what's the best site/resource to see the haskell built-in types and functions?
10:46 markus1189 joined
10:46 <c50a326> I should probably download the haskell docs on zeal actually
10:46 <dysfun> the documentation
10:47 <encodes> c50a326: http://www.cse.chalmers.se/edu/year/2017/course/TDA555/tourofprelude.html
10:47 <quicksilver> your haskell installation probably comes with local HTML docs (?)
10:48 <quicksilver> point your browser at the index.html
10:48 merijn joined
10:49 <merijn> dminuoso: I think I saw you mention my cabal changes, but then I went for lunch and my machine rebooted, so I missed what you actually said?
10:50 uditk left
10:51 language_agnosti joined
10:51 HarveyPwca joined
10:54 JuanDaugherty joined
10:54 whaletechno joined
10:55 language_agnosti joined
10:56 freyr joined
10:56 <tdammers> quicksilver: if you squint a lot, it's somewhat related to cabal vs. stack, but I really don't feel like opening that particular can of worms right now
10:57 <freyr> How could I define a custom list-like constructor in Haskell?
10:57 <cocreature> freyr: data List a = Cons a (List a) | Nil
10:57 <rzmt> can i search hackage docs for 3rd party package somehow?
10:57 <freyr> Something like datatype {a} = {a} | a:>{a}
10:57 language_agnosti joined
10:57 <merijn> rzmt: Define "3rd party package"?
10:58 <cocreature> freyr: data X a = Singleton a | Cons a :> (X a)
10:58 jsomedon joined
10:58 <merijn> rzmt: Hoogle indexes *part* of Hackage, there's also the index which groups them by category
10:58 <rzmt> merijn: currently id like to search for `takeC` function
10:58 <rzmt> from conduit package
10:58 <cocreature> eh remove the Cons part
10:59 <merijn> Ah, sadly conduit didn't start using new haddock yet. The latest Haddock lets package docs include a package specific search function
10:59 <cocreature> rzmt: https://hoogle.haskell.org/?hoogle=takeC
10:59 markus1189 joined
11:01 ericsagn1 joined
11:01 <rzmt> cocreature: perfect, thanks. Got the lazy IO mostly working now, still need few changes...
11:01 <cocreature> friends don’t make friends use lazy IO :)
11:04 <merijn> Friends don't *let* friends use lazy IO :p
11:04 <cocreature> heh :)
11:05 sdothum joined
11:05 louispan joined
11:06 Yuuri joined
11:06 themagician joined
11:06 slomo joined
11:07 <__monty__> With nix you can get a local hoogle that indexes all your installed packages.
11:07 <Yuuri> Are there any good tutorials for applicative parsers (especially with writing them from scratch)?
11:08 <* hackage> alarmclock - Wake up and perform an action at a certain time. http://hackage.haskell.org/package/alarmclock- (dcturner)
11:08 <cocreature> Yuuri: not sure but you should be able to search for a monadic parser tutorial and just remove the Monad instance if you only care about the Applicative part?
11:09 <merijn> Yuuri: Writing a parser from scratch using a parser combinator library or writing a parser combinator library?
11:09 <merijn> Yuuri: Also, is there any specific reason you're restricted to applicative parsers, rather than monadic parsers?
11:10 davr0s joined
11:11 <Yuuri> merijn: freferably both: using parsers and demonstrating how they can be made
11:11 logzet joined
11:11 Folkol_ joined
11:12 vukasink joined
11:12 encod3 joined
11:12 <Yuuri> merijn: I need that for a couple of students who haven't studied monads yet
11:12 <merijn> The only case I can think of right now where strictly applicative parsing makes sense is in cases like optparse-applicative
11:13 <merijn> Since the restriction makes sense there compared to how commandlines are historically interpreted
11:13 <tdammers> or you could just write all the parsers and combinators without implementing any of Monad or Applicative
11:14 <tdammers> you'll end up writing specialized versions of fmap, pure, >>=, etc., but IMO that's OK for the learning experience
11:14 markus1189 joined
11:14 <Yuuri> tdammers: like https://www.codewars.com/kata/54f1fdb7f29358dd1f00015d , I suppose?
11:15 phryk joined
11:16 <tdammers> Yuuri: I have no idea, that thing won't load without JS, and I'm too lazy to enable it, but from the title I would guess "yes"
11:17 mstruebing1 joined
11:18 osa1 joined
11:19 tsenart joined
11:20 fujiy joined
11:21 t7 joined
11:22 sakalli_ joined
11:23 rodgzilla joined
11:25 <Yuuri> Also found this: https://stackoverflow.com/a/20662831/3350784 , looks like what I need
11:25 <rzmt> cocreature: any tips how to detect if the stream has ended, and stop the recursion? https://lpaste.net/4919451117022085120
11:26 <c50a326> howcome Int has a minBound but Integer doesn't
11:26 <dminuoso> merijn: Ah no. I just started hacking on some cabal bits and parts.
11:26 <dminuoso> It's a weird codebase. :o
11:26 <merijn> dminuoso: Well, yes :p
11:26 <quicksilver> c50a326: Integer is supposed to be arbitrary sized integers (positive and negative)
11:26 <Yuuri> merijn: could you please elaborate on strictly applicative making less sense than monadic?
11:26 <c50a326> oh right
11:26 <Taneb> > minBound :: Int
11:26 <lambdabot> -9223372036854775808
11:26 emilypi joined
11:27 <Yuuri> I also wonder what kinds of grammars they can parse
11:27 <Taneb> > toInteger (minBound :: Int) - 1
11:27 <c50a326> so Integer isn't bounded, okay
11:27 <lambdabot> -9223372036854775809
11:27 <c50a326> ah nice
11:27 <merijn> c50a326: Integer basically is only bounded by the size of your RAM :p
11:27 <quicksilver> well it kind of is, because your computer can only store so much
11:27 <c50a326> sounds dangerous
11:27 <merijn> How so?
11:27 <c50a326> then you can crash can't you :o
11:27 <quicksilver> merijn: or maybe the bounds of your virtual memory system and libgmp's allocation algorithm
11:27 <Taneb> If you've got an integer bigger than your computer can store, you've got bigger problems
11:27 <JuanDaugherty> it's a frontend for GMP?
11:28 <merijn> JuanDaugherty: Basically, yes.
11:28 <Yuuri> Probably applicative ones are context-free and monadic ones are context-sensitive, but I'm not sure if full or not
11:28 <encodes> ok, so having worked around the type error, am now stuck with the following; https://lpaste.net/5889345669801443328
11:28 <cocreature> Yuuri: it’s more a case of unless you actually extract any benefit from limiting yourself to Applicative you are just arbitrarily putting restrictions on yourself
11:28 <encodes> in does not "encode" properly.
11:29 <merijn> JuanDaugherty: One of the fastest GMP bindings around, even: http://www.wilfred.me.uk/blog/2014/10/20/the-fastest-bigint-in-the-west/
11:29 <* hackage> twitter-conduit 0.3.0 - Twitter API package with conduit interface and Streaming API support. http://hackage.haskell.org/package/twitter-conduit-0.3.0 (TakahiroHimura)
11:29 <JuanDaugherty> merijn, ack
11:30 keepLearning512 joined
11:30 jao joined
11:30 plugin joined
11:31 <JuanDaugherty> i guess on that chart c/c++ would be zero
11:31 tsoernes joined
11:31 <JuanDaugherty> as a direct binding
11:31 <merijn> JuanDaugherty: Not necessarily, because it depends how good you'd personally be at managing the GMP API
11:31 <cocreature> rzmt: I don’t think you need to do anything special here. .| should terminate downstream if it requests a value and upstream does not produce one iirc
11:32 <JuanDaugherty> merijn, true
11:32 <JuanDaugherty> especially for c++
11:32 mstruebing1 joined
11:32 <encodes> eg has the same error, its supposed to encode (+), but how can a Dict be returned which captures an instance which is defined within the body of the function?
11:32 dhil joined
11:32 <Yuuri> cocreature: I've seen another opinion that more specific code means less reasoning about it
11:32 <quicksilver> interesting merijn
11:32 pie_ joined
11:32 <quicksilver> "! For example, check out the docs for addition. This adds huge overhead"
11:32 <quicksilver> sorry wrong paste
11:33 <quicksilver> "PHP ... arbitrary size numerical functions take and return strings ... as the numbers get larger, because an increasing amount of time is spent serialising and deserialising strings representing numbers"
11:33 <merijn> JuanDaugherty: Also GHC can do some tricks you might not do as easily (i.e. it falls back to regular int64 when values are small enough)
11:33 <quicksilver> ^^ that's bonkers. if PHP is storing large numbers as strings - which is fine - why would it serialise and deserialise?
11:33 <merijn> quicksilver: There's some pretty dumbass choices in PHP wrt that
11:33 <quicksilver> you'd just write a direct ASCII addition library in C
11:33 <quicksilver> which would be reasonably performant.
11:33 <quicksilver> I meant it wouldn't be GMP quality but it would be ok.
11:33 <cocreature> Yuuri: I’d agree for that if you are working with a polymorphic type but if you have a concrete type (e.g. the Parser type) then I don’t think there is much to be gained by limiting the interface exposed to users to an Applicative one
11:34 <quicksilver> no deserialisation required.
11:34 <cocreature> Yuuri: the _users_ of your parser library can ofc still limit themselves to Applicative operations if they find that easier to work with
11:34 <merijn> quicksilver: Admire this beauty of an issue and it's comments: https://bugs.php.net/bug.php?id=54547
11:34 <merijn> quicksilver: Note how the "fix" to the problem introduces a MASSIVE regression :)
11:34 <encodes> is it even possible to do?
11:34 <quicksilver> :)
11:35 <Yuuri> cocreature: as for applicative vs monadic parsers, I've also read this: https://stackoverflow.com/questions/7861903/what-are-the-benefits-of-applicative-parsing-over-monadic-parsing
11:35 cloudhead joined
11:35 <cocreature> Yuuri: right, the “static analysis” part is what I meant by “extracting a benefit from limiting yourself to Applicative”
11:36 <cocreature> Yuuri: e.g. for optparse-applicative it is crucial that it can inspect your parser to produce things like the --help output
11:36 blankhart joined
11:36 keepLearning512 joined
11:36 <c50a326> do you guys use vim or what
11:36 <cocreature> Yuuri: but for a general-purpose parser library, I think providing a monadic interface is usually the better choice
11:36 <dminuoso> @Jeff: You have to understand in PHP 1, 1.0 and "1.0" all are equivalent (in most situations). That's by design.
11:36 <lambdabot> Unknown command, try @list
11:36 <dminuoso> "in most situations"
11:36 <dminuoso> Not bad.
11:36 <Yuuri> cocreature: that's right what I wanted to know, thank you :)
11:36 <dminuoso> merijn: The comments are a hilarious read =)
11:37 <cocreature> encodes: what do you mean by “instance which is defined within the body of the function”. you can’t define instances in the body of a function
11:37 <Yuuri> (s/right/just, probably)
11:37 <dminuoso> Especially the md5 bit is quite hilarious
11:38 <merijn> c50a326: I'd say approximately 1/3rd of this channel uses vim, 1/3rd uses emacs, the remaining 1/3rd uses a mix of whatever the flavour du joure is for editors (sublime, textmate, VS Code, Atom, etc.)
11:38 <Ariakenom> quicksilver: Why are you sure that would be faster?
11:39 rzp joined
11:39 son0p joined
11:39 <merijn> cocreature: Not just for generating help, I'm pretty sure that might be doable anyway with a slightly different API
11:39 <c50a326> all the results on google's first page for "haskell vim" are mostly stuff to do with neovim rather than vim, that's strange
11:39 <quicksilver> Ariakenom: well mostly I'm saying that I don't understand the comment. If they are indeed storing bignums in ASCII then the obvious things to do is do your math in ASCII. If they are serialising/deserialising then what are they deserialising *to*?
11:39 <dminuoso> merijn: what if you use emacs with evil mode, does that make you an emacs or a vim user?
11:39 <merijn> cocreature: optparse-applicative is mostly applicative because, historically, commandline flags/options are order independent
11:39 encod3 joined
11:40 <merijn> quicksilver: Some other comments suggest PHP uses bc for big math
11:40 <merijn> quicksilver: So they'd have to send it to a subprocess
11:40 louispan joined
11:40 <cocreature> merijn: I’d be interested to see a Monadic parser that can provide the level of inspection needed for --help. ime that level of introspection is often the main reason why I opt for an applicative interface
11:40 <quicksilver> ah fun
11:40 tsaka__ joined
11:41 <encodes> cocreature: in https://lpaste.net/5889345669801443328 an attempt it shown... the instance is defined as usual, and referenced using Dict as the return type of "encodes", the idea would be to use the argument to this function as a parameter to define another instance.
11:41 Guest61008 joined
11:41 ammazza joined
11:41 <merijn> cocreature: Just have the API build a data structure for the parser, then generate the actual monadic parser from that?
11:41 mstruebing1 joined
11:41 <cocreature> merijn: sure but then you are not providing a monadic API to your user are you?
11:42 <merijn> I think it can be done
11:42 <cocreature> ofc you can use a monadic parser library for the actual parsing. my point is that the API that users have access to needs to be limited in some way
11:42 <merijn> But I'm not 100% certain
11:42 <merijn> I'm sure you can solve it if you throw enough type-level voodoo at it
11:43 ChrisVim joined
11:43 ChrisVim left
11:44 <cocreature> you can probably pull some tricks ala “simple and compositional reification of monadic embedded languages” but it does at least get trickier to do this if you provide a Monadic interface
11:44 mariatsj_ joined
11:45 dpyro joined
11:46 kvda joined
11:46 davr0s joined
11:46 Targon joined
11:48 Targon left
11:49 vwhite joined
11:50 <encodes> cocreature: the instance on line 30 should be replaced by some definition on line 34; https://lpaste.net/5889345669801443328
11:51 <cocreature> encodes: I’m not sure I’m following, the instance in line 30 and 33 have different instance heads? how do you expect to replace one by the other?
11:51 <cocreature> encodes: also what’s the actual problem? do you get a compile error, a runtime error, …?
11:51 andreabedini joined
11:51 <encodes> where the value '1' would then be able to take the value 'i' which is not used in the returned Dict
11:52 <encodes> the problem is that both eg and eg2 return Just 3 instead of 4 when computing 2+2
11:52 kreetx joined
11:53 <kreetx> hi! are there any cotchas with declareFields? I have one field that is not generated and am not sure why.. Both Has* classes are declared elsewhere
11:53 <cocreature> encodes: what do you mean by “computing 2+2"? which argument do you pass to "eg" to produce Just 3?
11:53 <encodes> 2 and 2...
11:53 <cocreature> alright
11:54 markus1189 joined
11:56 <encodes> ah, so its not clear that the instance on line 30 gives rise to a 'Next Int' instance via the synonym which defines it on line 25
11:57 <lyxia> you have two "2", instance line 30 adds 1 to one of them, instance line 33 throws away the other, so you somehow get 3.
11:58 <encodes> the idea is to delete lines 30-31, and somehow return Dict without this instance being defined at top-level.
11:59 <encodes> on line 34, which uses 'i' instead of the offending 1
12:01 tomphp joined
12:01 <rzmt> cocreature: `takeC 5 .| sumC` seems to produce 0 even when takeC gets zero elements from upstream
12:02 Ukari joined
12:02 <cocreature> encodes: I can’t help but feel like you are trying to solve a problem with typeclasses that is much better solved without them
12:03 andyhoang1 joined
12:04 vonfry joined
12:07 pranz2 joined
12:07 muddywatt joined
12:08 <encodes> some classes have a single defining function, in which case they can be defined using 'Is', which is the requirement that they have a function of this type. The machinery being developed it to provide a way to extend these classes in a systematic way to support an additional parameter. This is useful for defining Shaped Containers where the additional parameter `encodes` a constructor. it is a very general abstraction to extend clas
12:08 <Ariakenom> default (Rational, Integer) good?
12:08 tomphp joined
12:09 nick_h joined
12:09 inad922 joined
12:09 <encodes> all other classes can be defined using compositions of such one-function classes, such as this approach to defining Lens, which should be extended in this way; https://lpaste.net/153315244247089152
12:10 dhil joined
12:10 tomphp joined
12:11 tomphp joined
12:11 Tuktuk joined
12:12 Tuktuk left
12:13 <encodes> essentially its a common and powerful pattern and this just an example.
12:13 daniel-s_ joined
12:15 silver joined
12:15 <Ariakenom> :t (1,,)
12:15 <lambdabot> Num t1 => t2 -> t3 -> (t1, t2, t3)
12:16 <cocreature> rzmt: how about split the problem into two parts: 1. chunk the stream into lists of 5 elements (take a look at https://stackoverflow.com/a/25429797 for how you can do this) and 2. sum the elements in these lists
12:16 tomphp joined
12:17 Linter joined
12:17 nek0 joined
12:18 tomphp joined
12:19 <kreetx> alright, figured out the cotcha with declareFields: when the type of the field is a type alias, then the rhs of the type alias needs to be in scope
12:21 louispan joined
12:23 Rayben joined
12:23 tomboy64 joined
12:24 caryoscelus joined
12:24 Rayben joined
12:26 Rayben joined
12:27 <encodes> so anyway, the idea is to return a Dict without having the ability to satisfy the constraint it captures. Wasn't there something about a $ sign to define local instances?
12:28 valentinbuza joined
12:28 <cocreature> no, you can’t define local instances
12:29 <cocreature> you can play some dirty tricks like the "reflection" package does which may or may not help
12:29 progfun joined
12:30 tsaka__ joined
12:30 <encodes> oh, it was a '?' and its called "implicit paramenters", perhaps that can help?
12:31 <encodes> reflection seems to rely on Proxy types, which seems to indicate they are not exactly whats happening here.
12:31 <* hackage> conduit - Streaming data processing library. http://hackage.haskell.org/package/conduit- (MichaelSnoyman)
12:32 <lyxia> Proxy is only a sign that it doesn't use TypeApplications.
12:32 alexteves joined
12:32 <lyxia> that says very little about the library itself
12:33 cschnei__ joined
12:34 roconnor joined
12:34 inad922 joined
12:36 Encodes_ joined
12:38 <Encodes_> searching "Dict using implicit parameters" doesnt give anything helpful.
12:38 psychicist__ joined
12:40 <lyxia> % let ?x = 3 in Dict :: Dict (?x :: Int)
12:40 <yahb> lyxia: Dict
12:41 lumm joined
12:42 tomphp joined
12:45 pykello joined
12:45 pulec joined
12:46 oish_ joined
12:47 vurtz joined
12:48 blankhart joined
12:49 <Encodes_> what would this look like with entails to infer the Is instance?
12:50 <caryoscelus> hmm, can someone explain why `fmap _` and `let fungus = _ in fmap fungus` (or analogue with `where`) give different hole messages (the second one is useless)?
12:50 <caryoscelus> i.e. why doesn't ghc consider the whole context around hole when it is placed in subexpression?
12:51 nowhereman_ joined
12:53 p0lyph3m joined
12:55 kuribas joined
12:55 markus1189 joined
12:57 sakalli_ joined
12:57 <Encodes_> it should be possible?
12:58 guessWHo joined
12:58 <guessWHo> can we do this m a -> IO a ??
12:58 <merijn> ugh...why do I always get many non-issue traces for exceptions when running with -xc?
12:58 <merijn> guessWHo: Only for some monads
12:59 pykello joined
12:59 <guessWHo> merijn : how ?
12:59 logzet joined
12:59 <Taneb> guessWHo: depends on what m is
12:59 <merijn> guessWHo: Depends on the specific type, there's no general way
13:00 <guessWHo> merijn : m is another monad which has instance of MonadIO and MonadBaseControl IO
13:00 <* hackage> greskell-core, greskell, greskell-websocket (debugito): https://qbin.io/label-sum-tp0s
13:00 keepLearning512 joined
13:00 <quicksilver> you can't
13:00 <merijn> guessWHo: I never could get the hang of MonadBaseControl
13:00 <quicksilver> you can't even do it in most concrete cases
13:00 <byorgey> guessWHo: MonadIO doesn't help, that only lets you go in the opporite direction, IO a -> m a
13:00 <quicksilver> let alone the general case
13:00 <merijn> And MonadIO is for the opposite of "IO a -> m a"
13:01 <quicksilver> consider (State s a) -> IO a
13:01 <quicksilver> (or indeed StateT s IO a -> IO a, it's no easier)
13:01 osa1 joined
13:02 <merijn> Is there some way to only report stack traces for exceptions that reach all the way back to main/the root of the forkIO thread?
13:02 <liste> MonadBaseControl feels harder for the brain than Cont :)
13:03 <merijn> liste: Yeah, MonadUnliftIO looks much more promising, tbh
13:03 <caryoscelus> for completeness sake, there is a general way: `const (pure undefined) :: m a -> IO a`
13:04 <liste> how about just "undefined :: m a -> IO a"
13:04 hph^ joined
13:04 ph88 joined
13:05 hph^ joined
13:05 hph^ joined
13:05 hph^ joined
13:05 <quicksilver> there is a vague general sense in which many common monads can be embedded in IO
13:06 <quicksilver> ilke you can implement State with IORefs etc.
13:06 danvet joined
13:06 <quicksilver> but it doesn't lead to a function of that type.
13:06 progfun joined
13:06 hph^ joined
13:06 hph^ joined
13:08 markus1189 joined
13:08 <merijn> So, does anyone know how to make "+RTS -xc" suck less?
13:08 <Encodes_> cant seem to place an implicit parameter in the constraint of an instance of Is...
13:08 emilypi joined
13:09 mreh joined
13:09 jb55 joined
13:09 language_agnosti joined
13:10 <ph88> anyone know how i can handle left recursion in megaparsec ? my parser is stuck in an infinitive loop
13:10 louispan joined
13:10 <cocreature> ph88: refactor your grammar
13:11 logzet joined
13:11 <lyxia> Encodes_: you can't
13:11 <lyxia> that breaks coherence
13:12 reactormonk joined
13:13 <Encodes_> seems reasonable that given ?x :: a to be able to return Dict (Is a)
13:13 <Encodes_> (recall class Is a where is :: a)
13:14 ammazza joined
13:14 language_agnosti joined
13:14 <ph88> cocreature, i don't prefer refactoring my grammar (i will do it if it's the best solution though) because it's more difficult to read and i'm also worried about changing semantics and/or parse tree. By the way i saw parsec has this function but i couldn't find it for megaparsec https://hackage.haskell.org/package/parsec-
13:14 davr0s joined
13:14 fmixing joined
13:15 scottschmidt1 joined
13:16 <cocreature> ph88: maybe you’re looking for makeExprParser?
13:16 markus1189 joined
13:16 <lyxia> Encodes_: we generally assume instances are unique, and an instance that depends on an implicit param breaks that assumption.
13:17 chaosmasttter joined
13:17 <ph88> cocreature, maybe .. i will read the docs now
13:17 <cocreature> ph88: but in general you can’t use left-recursion with ll parsers like megaparsec
13:18 Charn joined
13:19 <Encodes_> feeling like it could be possible to use (:-) to do something similar...
13:21 valentinbuza joined
13:22 <ph88> cocreature, is there no function or TH that rewrite left recursion for me ?
13:22 Khisanth joined
13:22 carlomagno joined
13:22 <cocreature> ph88: at least I don’t know of one
13:22 sakalli_ joined
13:23 <quicksilver> left recursion is easy to mechanically rewrite
13:23 <quicksilver> but, it does require you to choose names for the new non-terminals
13:23 <quicksilver> which is one reason not to do it automatically
13:23 kevinsjoberg joined
13:24 Mortomes|Train joined
13:24 <quicksilver> I have once written a grammar pre-processor which refactored the left-recursion out of a recursive descent parser
13:27 <Encodes_> instance (?x :: a) => Is a where is = x would allow capture :: a -> Dict (Is a); capture a = let ?x = a in Dict :: Is a
13:27 GodotMisogi joined
13:27 <Encodes_> its missing a Sub somewhere maybe...
13:28 twandy joined
13:29 beefjoe joined
13:29 Labbekak joined
13:29 pykello joined
13:29 cschnei__ joined
13:30 <Labbekak> Hi, does anyone here know how to define nil and cons if you have Mu and ListF
13:30 <Labbekak> with Mu I mean (forall f t. (f t -> t) -> t)
13:30 lastmanstanding joined
13:30 darkJedi joined
13:30 markus1189 joined
13:31 <Labbekak> nil = Mu (\a -> a NilF)
13:31 <Labbekak> but cons?
13:32 <Saizan> cons x (Mu xs) = Mu (\a -> a (ConsF x (xs a)))
13:32 language_agnosti joined
13:33 ystael joined
13:33 patlv joined
13:37 MaTaXeToS joined
13:37 andreabedini joined
13:38 thebnq joined
13:38 <Labbekak> Thanks @Saizan!
13:38 <Labbekak> I was so close
13:38 <Labbekak> :)
13:39 mortum5 joined
13:39 zer0s joined
13:41 fizbin joined
13:41 glguy joined
13:41 danthemyth joined
13:42 <Encodes_> cant seem to find a way round this...
13:44 iAmerikan joined
13:46 <dmwit> I'm a bit late, but... `[1..] :: [Int]` is not an infinite list.
13:47 <dmwit> Even in the abstracted-away-from-machine-limits semantics.
13:47 kapil___ joined
13:47 WhatisRT joined
13:48 <cocreature> dmwit: can I abstract away from the machine-limit “finite integer bitwidths” :)
13:49 <dmwit> cocreature: You can, but the Report still demands `instance Bounded Int`. =)
13:49 <thebnq> > [(maxBound::Int)-1 .. ] --nice
13:49 <lambdabot> [9223372036854775806,9223372036854775807]
13:49 <cocreature> dmwit: hah, you got me there!
13:49 <kuribas> > [1..]
13:49 <lambdabot> [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,...
13:49 <kuribas> > last ([1..] :: [Int])
13:49 <lambdabot> mueval-core: Time limit exceeded
13:50 scottschmidt1 joined
13:50 Rayben joined
13:50 Rayben joined
13:51 andreabedini joined
13:51 <kuribas> > length ([1..] :: [Int])
13:51 <lambdabot> mueval-core: Time limit exceeded
13:51 phenoble joined
13:51 Rayben joined
13:52 <kuribas> how does haskell know there is a maximum value?
13:52 <thebnq> > maxBound :: Int
13:52 <lambdabot> 9223372036854775807
13:52 <kuribas> > maxBound :: Integer
13:52 <lambdabot> error:
13:52 <lambdabot> • No instance for (Bounded Integer)
13:52 <lambdabot> arising from a use of ‘maxBound’
13:52 <thebnq> Theres a Bounded class
13:53 <kuribas> :t enumFrom
13:53 <lambdabot> Enum a => a -> [a]
13:53 markus1189 joined
13:53 <kuribas> There's no Bounded in Enum.
13:54 <merijn> kuribas: The semantics of enum just say to stop after each element has been done
13:54 <kuribas> merijn: are they defined separately for each datatype?
13:54 <dmwit> yes
13:54 <merijn> kuribas: "enumFrom and enumFromThen should be defined with an implicit bound, thus:"
13:55 <merijn> kuribas: [1..] notation is just sugar for various calls to Enum, so yes
13:55 <dmwit> Compare:
13:55 <dmwit> > succ maxBound :: Int
13:55 <lambdabot> *Exception: Prelude.Enum.succ{Int}: tried to take `succ' of maxBound
13:55 <dmwit> > enumFrom maxBound :: [Int]
13:55 <lambdabot> [9223372036854775807]
13:56 <quicksilver> it's just a shame about the name (Enum)
13:56 <merijn> Specifically "[x..]" -> "enumFrom x", "[x..y]" -> "enumFromTo x y", "[x,y..]" -> "enumFromThen x y", and "[x,y..z]" -> "enumFromThenTo x y z"
13:56 <dmwit> So yes, the Enum instance itself knows about the bounds on Int.
13:56 <kuribas> ah, they use a helper function boundedEnumFrom
13:56 osa1 joined
13:56 <quicksilver> since it's about bounded arithmetic sequences
13:56 <quicksilver> and not about enumeration
13:57 cloudhead joined
13:57 <Ariakenom> Also the implementation of is bonkers for Real
13:57 <Encodes_> lyxia: Dict provides a way to restrict the scope of instances, or to pass them around in a restricted scope at least, so the idea of generating instances can be prevented from causing undecidability...
13:57 <thebnq> quicksilver: but you can have an unbounded Enum, like Integer
13:57 <kuribas> Ariakenom: yeah
13:58 <quicksilver> thebnq: sure, but the class is still partly about bounded sequences
13:58 <Ariakenom> Real shouldn't be a sequence
13:58 <Ariakenom> nor bounded
13:58 <merijn> Double is also awful
13:59 <Ariakenom> in general yes. Enum Double also yes
13:59 <Ariakenom> So I don't think the goal was an enumerable sequence
14:00 <Boomerang> > [0, 0.1 .. 0.3] -- Will it go above 0.3?
14:00 <lambdabot> [0.0,0.1,0.2,0.30000000000000004]
14:00 abhiroop joined
14:00 Call joined
14:01 <stilgart_> > 0.30000000000000004 == 0.3
14:01 <lambdabot> False
14:01 <Ariakenom> ha
14:01 <Ariakenom> You call that an error?
14:01 <Ariakenom> > [0.5,1.5..2]
14:01 <lambdabot> [0.5,1.5,2.5]
14:01 <stilgart_> above, indeed
14:01 <Ariakenom> > [0.5,1.5..2] :: Rational
14:01 <lambdabot> error:
14:01 <lambdabot> • Couldn't match type ‘[Double]’ with ‘Ratio Integer’
14:01 <lambdabot> Expected type: Rational
14:02 <Boomerang> Oh wow that one is even worst :p
14:02 <Ariakenom> > [0.5,1.5..2] :: [Rational]
14:02 <lambdabot> [1 % 2,3 % 2,5 % 2]
14:02 <Boomerang> *worse
14:02 <thebnq> > 0.300000000000000004 == 0.3
14:02 MarcelineVQ joined
14:02 <lambdabot> True
14:03 <Boomerang> Did you add a 0?
14:03 <thebnq> was 0 off from the truth :)
14:03 <lyxia> Encodes_: if you can generate different instances, then you can break containers. Dict does not restrict the scope of instances in a way that prevents that.
14:04 <dmwit> "bonkers" is too strong. The Enum Double instance makes a difficult tradeoff between many evils.
14:04 <Encodes_> it might not prevent it, but it at least means they can be kept from existing in the same scope by the user.
14:05 antsanto joined
14:05 cloudhead joined
14:05 <Ariakenom> > [0.5,1.5..2] :: [Rational] -- dmwit: The bonkers is because it's not Enum Double
14:05 <lambdabot> [1 % 2,3 % 2,5 % 2]
14:05 progfun joined
14:05 <Ariakenom> > 5 / 2
14:06 <lambdabot> 2.5
14:06 <mnoonan> lyxia: I think you can get around this by introducing names. I was just talking to iceland_jack about something similar the other day.
14:06 <mnoonan> https://lpaste.net/2658425112289607680
14:06 <dminuoso> dmwit: what does Enum Double do? increment in the least representable steps?
14:06 <Ariakenom> It's for Real. Which is bonkers.
14:06 <dminuoso> *smallest representable
14:06 <Ariakenom> dminuoso: No 1
14:06 <dminuoso> o_o
14:07 <mnoonan> lyxia: the idea is to make the constructed instance an instance for `Ala name a` instead of just `a`, and make `name` existentially-quantified to restrict the scope.
14:07 <humanoyd> Does anyone know about the status of a Fedora build of ghc 8.4.3? (https://www.haskell.org/ghc/download_ghc_8_4_3.html#linux_x86_64)
14:07 <Ariakenom> (Might not be Real, I don't know the number classes)
14:07 <mnoonan> but it also means that other instances you build will get different names, so they don't collide
14:07 pykello joined
14:08 <Encodes_> so that an error would not be thrown until two conflicting instances appeared together in a single constraint, to be handled by the inference of this constraint from those constraints which entail it.
14:08 eschnett joined
14:08 <electrocat> i wonder..
14:08 <electrocat> > f = let f0 x = (x, x) in let f1 x = f0 (f0 x) in let f2 x = f1 (f1 x) in let f3 x = f2 (f2 x) in let f4 x = f3 (f3 x) in let f5 x = f4 (f4 x) in let f6 x = f5 (f5 x) in f6 (\x -> x)
14:08 <lambdabot> <hint>:1:3: error:
14:08 <lambdabot> parse error on input ‘=’
14:08 <lambdabot> Perhaps you need a 'let' in a 'do' block?
14:09 <electrocat> @let f = let f0 x = (x, x) in let f1 x = f0 (f0 x) in let f2 x = f1 (f1 x) in let f3 x = f2 (f2 x) in let f4 x = f3 (f3 x) in let f5 x = f4 (f4 x) in let f6 x = f5 (f5 x) in f6 (\x -> x)
14:09 youtmon joined
14:09 <lambdabot> Plugin `eval' failed with: <<timeout>>
14:09 <electrocat> heh, ok
14:09 asheshambasta joined
14:09 lainon joined
14:10 <Encodes_> type Encodes a b = Is (a -> (Dict (Is b))) allows these instances to be distinguished via equality over 'a'.
14:10 keepLearning512 joined
14:10 <dmwit> dminuoso: It increments by one if you don't specify a step (just like Int and friends); otherwise it increments by the step you designate. The thing moste people consider "bonkers" is how it determines when to stop, not how it determines the step size.
14:11 <mniip> electrocat, you are like a little baby, watch this
14:11 <dmwit> dminuoso: Namely: it stops when the value is more than half a step away from the end value you give.
14:11 lanelet joined
14:11 <mniip> :t let f=(,);g=f.f;h=g.g;i=h.h;j=i.i;k=j.j in k
14:11 <lambdabot> a -> b1 -> (b2 -> (b3 -> (b4 -> (b5 -> (b6 -> (b7 -> (b8 -> (b9 -> (b10 -> (b11 -> (b12 -> (b13 -> (b14 -> (b15 -> (b16 -> (b17 -> (b18 -> (b19 -> (b20 -> (b21 -> (b22 -> (b23 -> (b24 -> (b25 -> (
14:11 <lambdabot> b26 -> (b27 -> (b28 -> (b29 -> (b30 -> (b31 -> (b32 -> (a, b32), b31), b30), b29), b28), b27), b26), b25), b24), b23), b22), b21), b20), b19), b18), b17), b16), b15), b14), b13), b12), b11), b10),
14:11 <lambdabot> b9), b8), b7), b6), b5), b4), b3), b2), b1)
14:11 <mniip> no wai
14:11 <mniip> :t let f=join(,);g=f.f;h=g.g;i=h.h;j=i.i;k=j.j in k
14:11 <dmwit> dminuoso: This is a nice way to accommodate rounding problems -- e.g. `[0, 0.1 .. 0.3]` gives pretty good results even though repeatedly adding `0.1` to itself leads to not hitting `0.3` exactly -- but it does look odd when the end value isn't chosen to be close to a multiple of the step size.
14:12 mizu_no_oto joined
14:12 roconnor joined
14:12 <Ariakenom> dmwit: But Rational doesn't have rounding errors.
14:12 <electrocat> mniip: lol
14:12 pranz3 joined
14:13 <mniip> I think it silently crashed
14:13 <nitrix> lambdabot: I'll bring you lemonade. Don't give up.
14:13 <Ariakenom> It's also not a nice way. It may be that there are no nice ways, but that isn't one
14:13 <mniip> % :t let f=join(,);g=f.f;h=g.g;i=h.h;j=i.i;k=j.j in k
14:13 <yahb> mniip: *** Exception: heap overflow
14:13 <mniip> fun
14:14 <mniip> ah yes, that's 64 nested (,) applications
14:14 cschnei__ joined
14:14 <mniip> would've worked if the type were a graph but it's tree-ified for many applications
14:15 <thebnq> wow type checking bombed
14:15 progfun joined
14:15 <Ariakenom> This is the Fractional (Double, Rational) logic for Enum https://hackage.haskell.org/package/base-
14:15 <lyxia> mnoonan: that's an interesting solution, it's some kind of scoped newtype.
14:16 <nitrix> Try with -XIQ250
14:16 <nitrix> (:
14:16 darkJedi joined
14:16 <electrocat> thebnq: well, the type checker has an exponential time complexity, that's what happens in worst cases
14:16 <mniip> superexponential
14:17 <electrocat> right
14:17 <mnoonan> lyxia: yeah, that seems like a nice way to think about it
14:18 kreetx joined
14:19 markus1189 joined
14:19 lumm joined
14:19 cloudhead joined
14:20 Azel joined
14:21 Solonarv joined
14:21 ddellacosta joined
14:21 <mniip> on a second thought running out of single letters will give you exp(exp(n/W(n)))
14:21 <mniip> not sure if that's still superexponential
14:21 ijks joined
14:22 mpahrens joined
14:22 <mniip> seems to be omega(c^x) but o(c^(d^x))
14:22 phenoble joined
14:23 pfurla joined
14:24 agander_ joined
14:24 Wuzzy joined
14:25 tabaqui1 joined
14:28 twopoint718 joined
14:29 codesoup joined
14:31 <fendor> what is the perferred way to define configurable values? e.g. a ip adress
14:32 <fendor> *address
14:32 <[exa]> depends on the context
14:32 <fendor> [exa], we start a server and a client shall connect to it.
14:33 <merijn> fendor: Parse them from the commandline or from a config file
14:33 oreigu left
14:33 <* hackage> gitlab-api - Gitlab Web API http://hackage.haskell.org/package/gitlab-api- (locallycompact)
14:33 <[exa]> if you're doing it for an app, you can parse a config file on the beginning and put the result in ReaderT so that everyone can ask for it
14:33 enterprisey joined
14:34 kunz joined
14:34 <fendor> thats sounds reasonable, however, some time ago I read that environment variables are sometimes recommended, when are the recommended? and if I want to use a config file, what kind of config file? INI?
14:34 <fendor> [exa], it is for a small app, yes
14:34 pranz4 joined
14:34 korans joined
14:34 <[exa]> there are packages that can do both transparently
14:34 jhrcek joined
14:35 lainon joined
14:35 <[exa]> http://hackage.haskell.org/package/etc- <- one example
14:35 <fendor> so, it does not matter, I just have to make some decision or are there any recommendations?
14:35 <fendor> that looks cool
14:36 HarveyPwca joined
14:36 WhatisRT joined
14:36 lain0n joined
14:36 <[exa]> environment variables are a form of interprocess communication, spawning process sets data, executed process receives them... if that fits your scheme better than "admin sets data, worker reads them", you might want environment vars
14:37 cschnei__ joined
14:37 <merijn> fendor: I'd personally go with config file over environment variables, because environment variables get messy and confusing fast.
14:37 pranz joined
14:37 <Cale> Environment variables are more useful if there's more than one program that can interpret the same variable
14:38 <Encodes_> hmm, this means that GADTs with implicit parameters as constraits cant be used either...
14:38 <[exa]> also, env can be changed rapidly, different for each new process
14:38 <fendor> thanks for the help, i will look into the etc package, it seems promisable. merijn, i agree with you, what file format would you recommend?
14:38 <merijn> [exa]: If you want that, just use commandline args
14:38 <fendor> Cale, not the use case, it is a server client architecture where server and client should probably not be on the same host machine
14:38 <merijn> [exa]: I don't have any strong opinion on that, tbh. The simplest thing that will work. INI should be fine if you only need simple "name -> value" mappings
14:39 <Encodes_> they cannot have instances defined over them. trying to avoid this undecidability problem using a newtype as normal cant work then?
14:40 jimmyrcom joined
14:40 <merijn> fendor: If you want to implement commandline config too I'd recommend optparse-applicative for that part
14:40 Rayben joined
14:41 <fendor> merijn, i dont think that i want to use command line configs, but the library is great, used it a couple of times now ;D. So INI file it is
14:42 <[exa]> ini parser library is called just ini, iirc
14:42 Rayben joined
14:43 slaznick left
14:43 xtreak joined
14:43 <fendor> yep, already found it, it looks simple enough for my use case
14:44 plugin joined
14:44 tzemanovic joined
14:46 sz0 joined
14:47 Linter joined
14:48 pranz1 joined
14:49 skeet70 joined
14:51 <WhatisRT> Hi! I'm trying to specify type classes during runtime - I've tried the reflection library, but it seems that it is not sufficiently general for my needs. For example, I'm trying to define a function f :: forall a x y. (a -> a -> Ordering) -> (forall b. Ord b => x b -> y b) -> x a -> y a
14:52 sakalli_ joined
14:52 <merijn> WhatisRT: Why are you trying to do that?
14:52 <merijn> WhatisRT: Usually you can just get by with a record of functions
14:53 <WhatisRT> If functor instances of x and y are required, that would also be fine, but ideally it would be possible without
14:53 connrs joined
14:53 Call left
14:54 <WhatisRT> The reason I'm doing that is that I want to call such functions over an ffi
14:55 <WhatisRT> I would plug in some serialized values for the a's, but at compile time I really have no information about them available
14:55 bbaren joined
14:55 <* hackage> nonemptymap - A NonEmptyMap Implementation http://hackage.haskell.org/package/nonemptymap- (ChristopherDavenport)
14:55 <WhatisRT> So I want the foreign code to specify the function at runtime
14:57 <* hackage> gitlab-api - Gitlab Web API http://hackage.haskell.org/package/gitlab-api- (locallycompact)
14:57 plugin joined
14:57 markus1189 joined
14:59 agander__ joined
15:00 <Cale> WhatisRT: It might be easier just to produce variations for each of the FFI types you want to be able to handle, since there are usually not so many of those.
15:03 <WhatisRT> Cale: I really do need this general construction - I need the user to allow to plug in arbitrary types for a
15:03 <Encodes_> is the point to make a bijection between instances and types supporting an Eq constraint?
15:04 <ongy> Is it possible to check for pointer-equivalence (even without Eq instance) as dirty optimisation in some cases?
15:04 <mnoonan> ongy: unfortunately, sort of yes
15:04 <merijn> ongy: As long as you don't care about sanity and correctness :p
15:05 <merijn> ongy: See reallyUnsafePtrEquality#
15:05 <ongy> not sanity, correctness would be nice :)
15:05 <Cale> WhatisRT: Why is this a requirement?
15:05 <merijn> ongy: afaik it can give you both false positives and false negatives unless you are VERY careful how you use it
15:05 <WhatisRT> Cale: I want to make arbitrary haskell functions available from foreign code
15:06 language_agnosti joined
15:06 <ongy> false negative wouldn't be too bad. false positive could be bad =.=
15:06 <mnoonan> ongy: there is a risk of a gc moving your value around in between checking the lhs address and the rhs address
15:06 <glguy> There's also the StableName stuff http://hackage.haskell.org/package/base-
15:06 <glguy> Stable names are a way of performing fast (O(1)), not-quite-exact comparison between objects.
15:06 <Encodes_> or to encode the notion of an inverse by adding the index of one constraint to the return type of another?
15:06 <mnoonan> or similarly, moving something else to where your lhs was :)
15:06 <WhatisRT> I can handle higher order functions and type variables, but type classes have been difficult so far
15:07 agander_ joined
15:07 <ongy> System.Mem.STable sounds good I guess
15:07 tabaqui1 joined
15:07 Peaker joined
15:07 <ongy> glguy: thx. Yea, just found it googling the reallyUnsafePtrEquality thingy
15:07 DSM joined
15:08 <Peaker> hey, nix "reproducible builds" means it should hard-code the ghc version used to build the package, inside the package spec itself, right?
15:08 <merijn> It's in ghc-prim, obviously :)
15:08 mjrosenb joined
15:08 <electrocat> Peaker: that specific GHC build even, yes
15:09 Azel joined
15:09 <Cale> WhatisRT: Well, Haskell's FFI doesn't really support that at all. There isn't a clear specification of the memory layout of instances, though I'm sure if you wanted to hack on GHC, something could be done about that in principle. You need something like Storable, but for type class dictionaries.
15:09 <electrocat> Peaker: oh nvm, i misunderstood
15:10 cschnei__ joined
15:10 <Peaker> how do I tell nix to use ghc 8.4.3 ?
15:10 <electrocat> repreducible build only holds the rest of the universe (nixpkgs) doesn't change
15:10 lastmanstanding joined
15:10 <Cale> I don't think anything like that is implementable with straightforward Haskell code, since the representation of type class dictionaries isn't explicit, even though under the covers, they're similar to other record types (... though I'm not sure about what happens to associated types)
15:10 <WhatisRT> Cale: I don't really need FFI support for that - I use custom serialization and deserialization schemes, so I don't need memory level hacking
15:11 <electrocat> Peaker: use 'haskell.packages.ghc843', you should really be asking these questions in #nixos though
15:12 <Peaker> if you don't use that you get a random version that builds in one computer and breaks in another?
15:12 FreeBirdLjj joined
15:12 <electrocat> if you don't, and use haskellPackages, you get the default
15:13 <electrocat> it won't break at another computer, but maybe at another version of <nixpkgs>
15:13 <cocreature> make sure to pin nixpkgs if you care about reproducible builds
15:13 <electrocat> which indeed can be resolved by specifying your nixpkgs version
15:13 <WhatisRT> Cale: Do you have any pointers for me where to look at? Some documentation about how type classes are implemented perhaps?
15:13 <Cale> WhatisRT: You need something lower level than what Haskell itself is going to provide, since even if you had a type class dictionary handy in the form of a record, there's no way to provide it as the instance to be used.
15:14 <Cale> (This is normally important, because it would spoil the coherence of instance selection)
15:14 <Encodes_> unless it was stored alongside an equatable value
15:15 Ariakenom joined
15:15 <Cale> Ordinarily, if you have any type class C and any type T, and you know that there's an instance C T, you also know that the instance C T is globally unique to the program. There's only one instance of a type class in use for any given type.
15:15 <Encodes_> or *as* one
15:15 urodna joined
15:15 codesoup joined
15:16 <Peaker> electrocat, stack forces you to fully freeze all versions, actually guaranteeing reproducible builds as much as possible. I thought nix was about reproducible builds too
15:16 korans joined
15:16 <cocreature> Peaker: if you pin nixpkgs your builds are perfectly reproducible
15:17 <Peaker> cocreature, So reproducible builds are opt-in? How do I pin nixpkgs to get reproducible builds?
15:17 <electrocat> Peaker: indeed, nix does this under the assumption that you pin the version, the same holds with staack, you pin an LTS version
15:17 language_agnosti joined
15:17 <Peaker> electrocat, stack requires you to pin a version, you can't avoid it
15:17 abra0 joined
15:17 <Encodes_> though, you can define a modification of the class where the defining function takes an additional argument, and then so long as there is a definition of how to recover a value of the type of the original function, then this value can be used. Its not so easy to make this extension process systematic...
15:18 <cocreature> https://nixos.wiki/wiki/How_to_fetch_Nixpkgs_with_an_empty_NIX_PATH (note that if you have nix 2.0 you don’t need the large "else" block)
15:18 <cocreature> but really this is not a Haskell question
15:19 <WhatisRT> Cale: Maybe that can be hacked with an additional type parameter? If I do something like `instance C (T a) ...`, where I use this `a` to look up the function that I want to use. The problem would then be that I'd need to write some sort of global variables...
15:19 <cocreature> WhatisRT: https://gist.github.com/cocreature/d366b1e20021d1da07842fced5a6af24
15:20 <cocreature> WhatisRT: you can replace the Functor constraint by a Coercible constraint or use unsafeCoerce (with the usual caveats)
15:20 <Cale> WhatisRT: This is true even in cases where there seems to be multiple ways that you could have obtained the instance. For example, you might have an instance Ord a, and obtain an instance Eq [a] from somewhere, and it might have come via using the instance Ord a => Ord [a], followed by using the fact that Eq is a superclass of Ord, or it might have come from using the fact that Eq is a superclass of Ord right away to go from Ord a to
15:20 <Cale> Eq a, and then using the instance Eq a => Eq [a]
15:21 <Cale> These necessarily are the same thing
15:22 korans_ joined
15:22 scottschmidt1 joined
15:22 lambda-11235 joined
15:23 reactormonk joined
15:23 connrs joined
15:23 <WhatisRT> cocreature: That's amazing! I've tried that for a few hours!
15:23 language_agnosti joined
15:23 <cocreature> WhatisRT: reflection can certainly take a while to get used to :)
15:24 <Cale> http://hackage.haskell.org/package/reflection-2.1.3/docs/Data-Reflection.html -- there is this, but your type classes have to be set up to use it.
15:24 <cocreature> huh I really shouldn’t have called both the parameter and the function f
15:24 <cocreature> Cale: no they don’t, see my example :)
15:24 <cocreature> you need a special instance but no modifications to the typeclass
15:25 <Cale> Oh, right
15:25 <Cale> You can do that :)
15:25 <Cale> Of course, that still required special knowledge of Ord itself
15:26 <WhatisRT> cocreature: How would you do that with a coercible constraint?
15:27 <glguy> (Coercible (x a) (x (Ordable a)), Corcible (y a) (y (Ordable a))) =>
15:28 <glguy> with the extra s, perhaps. That I'm less sure of :)
15:28 <cocreature> the problem is that you need Coercible (x a) (x (Ordable s a)) and "s" is not in scope at that point
15:28 <cocreature> so I think I might have been wrong about being able to do this with Coercible
15:28 <cocreature> "unsafeCoerce" your way to glory and have fun debugging segfaults :P
15:29 <glguy> A bad idea might be to insist on a Coercible (x Int) (x (Sum Int)) or something like that since x will only have that instance if it's ever coercible
15:29 <glguy> and then using that assurance use unsafeCoerce later
15:29 <WhatisRT> cocreature: Thanks, I'll try that
15:30 DSM joined
15:30 <WhatisRT> The specific nature of the knowledge of the Type class is no problem, this is something I have
15:30 djbeau joined
15:31 blankhart joined
15:31 raingloom joined
15:32 <cocreature> WhatisRT: unsafeCoerce should be safe here in the sense that it produces a valid Haskell value but you might break internal invariants in the datatype. e.g. if x = Set and you change the Ord instance, the internal invariants of Data.Set are violated
15:32 beauby joined
15:32 language_agnosti joined
15:33 amar_ joined
15:33 <glguy> another constraint is that x or y aren't GADTs with interesting equality constraints on their type parameters
15:34 <cocreature> good point, didn’t think of GADTs in this context
15:34 raichoo joined
15:34 _vaibhavingale_1 joined
15:35 <WhatisRT> cocreature: I see, but I luckily don't want to actually change the instance at runtime
15:35 <glguy> WhatisRT: changing the instance at runtime wasn't the concern
15:36 rzp joined
15:37 <WhatisRT> I assumed the problem would be that for example internally there would be a sorted list, but if you change the Ord instance, the list wouldn't be sorted anymore
15:38 <WhatisRT> This at least wouldn't be a problem in my case
15:39 keepLearning512 joined
15:40 <WhatisRT> glguy: Ah, you talked about the GADTs - currently I don't want to support GADTs, but that might be an issue at a later point
15:40 marko_ joined
15:40 <WhatisRT> I'll tackle eventual problems then
15:40 nitaigao joined
15:41 nitaigao joined
15:42 nitaigao joined
15:42 tabaqui1 joined
15:43 <* hackage> baserock-schema - Baserock Definitions Schema http://hackage.haskell.org/package/baserock-schema- (locallycompact)
15:44 <mniip> hmm should I add recursion-schemes to yahb
15:46 <lyxia> that sounds like a good idea
15:47 conal joined
15:47 <glguy> WhatisRT, cocreature: https://gist.github.com/cocreature/d366b1e20021d1da07842fced5a6af24#gistcomment-2626349
15:48 connrs joined
15:48 <cocreature> glguy: I’ll just wait for QuantifiedConstraints ;)
15:49 amar_ joined
15:49 <electrocat> who knows how long that will take :p
15:49 <cocreature> electrocat: not too long, it’s already merged :)
15:50 <electrocat> i'm quite sceptical :p
15:50 glguy_ joined
15:50 <mniip> glguy, is that a generalized sort->sortBy generalization?
15:50 <electrocat> i first want to see how well it works
15:50 <glguy_> cocreature: this has the advantage of working on types that aren't functors whether they're contravariant or invariant ones
15:51 <ongy> ok, it's waaaay to easy to get false negative with StableName, or I'm stupid. I guess without deepseq it's barely useable
15:51 <glguy_> mniip: yeah, I suppose so
15:52 WhatisRT joined
15:52 <glguy_> ongy: deepseq doesn't help in any of the cases
15:52 <cocreature> glguy_: you mean compared to my version or QuantifiedConstraints?
15:52 <glguy_> Not with stablenames nor with unsafe pointer equality
15:52 <glguy_> cocreature: the original functor one
15:52 <cocreature> ah yeah definitely
15:52 nitaigao joined
15:53 Boomerang joined
15:53 DTZUZO joined
15:53 <ongy> hm, I thought I get different stablenames becuase it's still in some \x -> x state. And the trace that should print in the function applied to the object is printed *after* the stable name gets created
15:54 khilan joined
15:55 <glguy_> ongy: these tools don't help you find if two values are similar, it helps you determine if two values are actually the exact same as in pointers to the same place in memory
15:55 pykello joined
15:55 <mniip> and done
15:55 <mniip> % :t zygoHistoPrepro
15:55 <yahb> mniip: (Corecursive t, Recursive t) => (Base t b -> b) -> (forall c. Base t c -> Base t c) -> (Base t (Control.Comonad.Trans.Env.EnvT b (Control.Comonad.Cofree.Cofree (Base t)) a) -> a) -> t -> a
15:55 pera joined
15:55 <glguy_> using deepseq isn't going to help two pointers that didn't already point to the same place in memory do so
15:56 saurabhnanda joined
15:56 <ongy> glguy_: It helps when it's ptr and ((\x -> x) $ ptr) (the function is a bit more complex, but that should be the result)
15:57 <glguy_> OK, I can see that one working
15:58 <WhatisRT> Thank you so much guys, you made my day!
15:59 ashesham` joined
16:00 <WhatisRT> I'm working on something really really cool, I hope I can show it off in a month or two
16:04 agander joined
16:05 lumm joined
16:05 bergle2 joined
16:05 encodes joined
16:06 bergle3 joined
16:06 Ukari joined
16:08 doyougnu joined
16:09 <encodes> its a shame that the desire to make instances globally decidable forces reifies to encode information typically held in values at type level. Perhaps there is a workaround available by promoting an argument to type level.
16:09 abhiroop joined
16:09 lumm joined
16:10 scottschmidt1 joined
16:11 WhatisRT joined
16:13 <encodes> e.g. paramatrising a list constructor by an Int using splitAt, using reifies would demand the Int be promoted.
16:14 osa1_ joined
16:17 gentauro joined
16:18 dfeuer joined
16:18 zv joined
16:20 tsaka__ joined
16:23 oisdk joined
16:23 lumm_ joined
16:24 glguy joined
16:24 Linter joined
16:25 FreeBirdLjj joined
16:27 jb55 joined
16:28 <ph88> hey guys, when i looked at some videos of eliminating left recursion they mention epsilon. How am i suppose to code that epsilon in haskell ?
16:30 <byorgey> ph88: I'm guessing that epsilon represents the empty string, i.e. it would correspond to a parser which consumes no input and successfully returns a unit value
16:31 <Solonarv> that parses is `pure ()`
16:31 blankhart joined
16:31 <byorgey> right
16:31 <byorgey> but without more context it's hard to know for sure what the videos you watched meant.
16:31 <ph88> so i get unit values in my AST ?
16:31 <ph88> what's that suppose to represent ?
16:32 <ph88> the top 5 results here https://www.youtube.com/results?search_query=left+recursion
16:32 <geekosaur> generally would represent no value, just as `putStrln` produces IO () because we don't care about a return value
16:33 <geekosaur> (it either succeeds or throws and exception)
16:33 drbrule joined
16:33 <geekosaur> so it's the do-nothing parser
16:34 abhiroop joined
16:35 <ph88> i still find it a bit strange
16:35 <geekosaur> why? it's more or less `id`
16:36 <geekosaur> if you're figuring out how parsers work, you start from the simplest parser, which is this
16:40 abhiroop joined
16:41 iAmerikan joined
16:41 Scip joined
16:42 p0lyph3m joined
16:42 mnoonan joined
16:43 beerdrop joined
16:45 <nitrix> I think I'm in the same shoes as ph88. For me, the parser would either fail, or succeed, in which case you have one of the known tokens for the language you're parsing.
16:45 <nitrix> I can't understand the purpose of ().
16:47 <glguy> If the parser is parameterized over the type of the result value given upon a successful parse you need some type use as the result even when the result is uninteresting
16:47 oisdk joined
16:47 <glguy> so an "epsilon" parser is likely to be a parser that consumes no tokens and has no intersting result. () is the standard uninteresting result
16:49 kreetx joined
16:49 <nitrix> Ah, right.
16:50 beerdrop joined
16:50 SpinTensor joined
16:51 pipahask joined
16:51 gabcoh joined
16:52 bbrodr joined
16:53 rihards joined
16:54 <ongy> ok, this is really hacky. I probably shouldn't do this^^
16:56 diwo joined
16:57 encodes_ joined
16:58 reactormonk joined
16:59 grumble joined
16:59 <mpickering> What does the error "Dependency on unbuildable library from graphmod" mean?
17:00 antsanto joined
17:00 <mpickering> Ah, it means that the dependency is not a library
17:01 fendor joined
17:01 mightybyte joined
17:01 elfets joined
17:01 sakalli_ joined
17:02 <mightybyte> Is there something in Haskell that abstracts over processes and threads?
17:03 <* hackage> midi-util - Utility functions for processing MIDI files http://hackage.haskell.org/package/midi-util- (mtolly)
17:03 <mightybyte> I have some things that are being created with createProcess and others that I want to create with forkIO/forkOS or similar.
17:04 <geekosaur> abstraction there seems painful at best
17:04 <mightybyte> Well, in my immediate case I want to abstract over killing them.
17:05 <dmwit> ph88, nitrix: If a caller doesn't want a (), they can always overwrite it with another value with `(<$)` or similar. Or discard it entirely when combining with another parser with `(<*)` or `(*>)` or similar.
17:06 danthemyth joined
17:08 <ongy> mightybyte: if you only ever need to destroy them, store an IO ()
17:08 <encodes_> is it more difficult to reify kind * -> * types!?
17:09 jb55 joined
17:09 <mightybyte> ongy: Oh, nice!
17:09 blackandblue joined
17:09 <mightybyte> That's perfect.
17:09 <dmwit> encodes_: `[| Maybe |]` works just fine for me.
17:09 Destol joined
17:09 <dmwit> Why do you ask?
17:09 <encodes_> good god
17:10 <encodes_> what is it!?
17:10 <dmwit> E_TOOVAGUE
17:11 <encodes_> dmwit: progress so far; https://lpaste.net/4486597844710457344
17:11 <dmwit> Oh, that kind of reification.
17:14 <encodes_> yes, not using Template Haskell
17:15 zv joined
17:15 Arcaelyx joined
17:15 Unhammerd joined
17:15 sternmull joined
17:17 <encodes_> with code borrowed from; https://gist.github.com/cocreature/d366b1e20021d1da07842fced5a6af24
17:18 altjsus joined
17:18 <glguy> encodes_: You "reify" *values* to the type-level. What does it mean to reify kind * -> * types?
17:19 inad922 joined
17:19 saurabhnanda joined
17:20 kritzefitz joined
17:20 beerdrop joined
17:20 danso joined
17:21 <c50a326> why does `stack install --dependencies-only` start downloading a 120MB ghc-tinfo6 package?
17:22 <c50a326> I'm in the third world
17:22 <glguy> GHC doesn't get smaller when you're in the third world, and apparently GHC is a dependency of whatever you're building
17:22 <encodes_> saying that "instance Reifies s (a -> a -> Ordering) => Eq (Ordable s a)" acts to reify the type (a->a->Ordering), then to reify e.g. Functor...
17:22 <geekosaur> stack strongly prefers to use its own ghc, not a separate one.
17:23 <c50a326> geekosaur: does it do that for every single project? :s
17:23 <c50a326> or just the first time I run it?
17:23 <glguy> encodes_: it reifies values that have the type (a -> a -> Ordering)
17:23 <geekosaur> if it already has an appropriate verison installed, it'll reuse it
17:23 fmixing joined
17:23 <geekosaur> but if the thing you're building uses a resolver that needs a different ghc version, it'll install a new one
17:24 acertain joined
17:24 <glguy> encodes_: which values do you have in mind with "e.g. Functor..." You trailed off too early for me to know what you were doing
17:24 <mjrosenb> blerg. I'm trying to install a bunch of packages with profiling turned on, and one of them is failing to build. When I installed it in the past, I used cabal to download the sources, editied them, then installed that into my sandbox.
17:24 <Solonarv> stack can do that
17:24 <glguy> mjrosenb: Now you can add them to your new-build's cabal.project file
17:24 <mjrosenb> Is there a way to do that, but get it to propagate my build flags to this project?
17:25 <mjrosenb> glguy: just add in ghc-options?
17:25 tzemanovic joined
17:26 <glguy> mjrosenb: Maybe this is what you're trying to do? https://www.haskell.org/cabal/users-guide/nix-local-build.html#package-configuration-options
17:26 fmixing joined
17:27 pykello joined
17:27 <encodes_> the example in the paste attempts to reify values of type (a -> f a -> f a) but where this has been phrased using something like (/\a -> (a -> f a -> f a)) as type 'a' is not visible to the constraint on line 47
17:27 patlv joined
17:27 <encodes_> which is the instance of a class of kind * -> * types.#
17:28 <glguy> encodes_: You can use a newtype wrapper in that case: newtype T = T (forall a. a -> a -> Whatever)
17:28 kreetx joined
17:28 <glguy> encodes_: You can use a newtype wrapper in that case: newtype T f = T (forall a. f a -> f a -> Whatever)
17:28 knupfer joined
17:28 <glguy> In order to hide the quantifier
17:29 <encodes_> where?
17:29 saurabhnanda joined
17:29 HiredBlade joined
17:30 iAmerikan joined
17:30 <mniip> curious
17:30 <mniip> % :i Type
17:30 <yahb> mniip: type Type = * -- Defined in `GHC.Types'
17:30 <mniip> % :set -XNoStarIsType
17:30 <yahb> mniip:
17:30 <mniip> % :i Type
17:30 <yahb> mniip: type Type = Type -- Defined in `GHC.Types'
17:31 dpyro joined
17:31 enterprisey joined
17:32 enterprisey joined
17:32 alx741 joined
17:35 borkr joined
17:35 amar_ joined
17:35 <* hackage> nonemptymap - A NonEmptyMap Implementation http://hackage.haskell.org/package/nonemptymap- (ChristopherDavenport)
17:38 vurtz joined
17:39 jan-sipr joined
17:41 logzet joined
17:41 dhil joined
17:42 argent0 joined
17:43 <encodes_> newtype T f = T (forall a. f a -> f a -> f a)
17:44 <encodes_> data Test i f a where Test :: Reifies i (T f) => i -> f -> a -> Test i f a
17:44 <encodes_> Expecting one more argument to `f1' Expected a type, but `f1' has kind `* -> *' * In the type `f'
17:47 joehillen joined
17:48 <cocreature> encodes_: please show us the full error message
17:49 henriksod joined
17:49 <encodes_> the rest is; In the definition of data constructor `Test' In the data declaration for `Test'
17:51 <cocreature> you are using f in T as a type constructor that accepts one parameter. in Test you are trying to use it if it didn’t accept a parameter
17:51 <cocreature> one of those two things needs to change
17:52 <encodes_> doh!
17:53 zariuq joined
17:54 argent0 joined
17:54 senn joined
17:56 Feitan joined
17:56 enterprisey joined
17:57 Wuzzy2 joined
17:57 pera joined
17:58 enterprisey joined
17:58 Feitan left
18:00 tsaka__ joined
18:01 Lokathor joined
18:01 tabaqui1 joined
18:02 <encodes_> ok, that gives a slightly better paste; https://lpaste.net/5183824749435813888
18:02 <encodes_> but now with an UndecidableInstances error :-(
18:03 jmnk joined
18:04 DSM joined
18:04 saurabhnanda joined
18:04 davr0s joined
18:06 mightybyte left
18:08 patlv joined
18:08 replay joined
18:08 p0lyph3m joined
18:09 <Solonarv> you can try just turning on UndecidableInstances, it should be fine
18:09 <Solonarv> the checker is very conservative
18:10 pio_ joined
18:10 p0lyph3m joined
18:10 osa1_ joined
18:12 <encodes_> no need... https://lpaste.net/5163845437748150272
18:14 <encodes_> so at this point can it is possible to discuss how to use Int' in the instance and somehow generate this from an Int on line 50.
18:15 sras joined
18:16 lgas joined
18:16 Lokathor joined
18:16 boyedaea joined
18:16 <sras> When doing type level arithmetic, why do is get this error "• Couldn't match type ‘h’ with ‘(1 + h) - 1’" ?
18:17 <mjrosenb> Setup: internal error when calculating transitive package dependencies.
18:17 <mjrosenb> that sounds bad.
18:17 oisdk joined
18:17 <Solonarv> type level arithmetic is a bit funky if you're not working with concrete numbers
18:18 <nitrix> mjrosenb: Using haddock?
18:18 theelous3 joined
18:19 <rzmt> i feel like the aggregate function is very unnecessary here, am i missing something which does the same much easier? https://lpaste.net/1896872508141862912
18:19 <geekosaur> sras, there are plugins that do that. type level arithmetic is very simple-minded
18:20 <mjrosenb> nitrix: no, I'm trying out cabal2nix, and apparently, it is building docs for everything.
18:20 <nitrix> mjrosenb: I see. Looks like that made you run into this: https://github.com/haskell/cabal/issues/1919
18:21 lortabac_ joined
18:21 phenoble joined
18:22 <mjrosenb> looks like it.
18:22 gentauro joined
18:22 <mjrosenb> now I guess I just need to figure out how to disable documentation.
18:23 argent0 joined
18:23 kreetx joined
18:24 <encodes_> the idea would be to use the definition of construct for lists on line 33
18:24 <gonz_> mjrosenb: I'm not a nix user really, but I've seen people specify `nohaddock` in their overrides.
18:24 sras joined
18:24 dogweather joined
18:25 pie_ joined
18:25 zachk joined
18:25 <mjrosenb> gonz_: which overrides?
18:26 zachk joined
18:27 technocracy[m] left
18:27 <gonz_> mjrosenb: I would suggest having a look at this repo: https://github.com/Gabriel439/haskell-nix
18:27 nksegos_ joined
18:28 <gonz_> jwiegley also has a repo with his setup that isn't project specific, but deals with having different GHC
18:28 <gonz_> GHCs installed
18:28 lgas joined
18:28 <johnw> https://github.com/jwiegley/nix-config/blob/master/overlays/10-haskell.nix
18:28 sm joined
18:29 <mjrosenb> I've actually been mostlu using Gabriel439's github forlearning this :-)
18:29 <boyedaea> u have a code for all: how I write for all in haskell where no for loop
18:29 <johnw> I can't recommend my repo for learning
18:30 <AWizzArd> Will GHC optimize uncalled functions away, so that they won’t end up in a resulting binary?
18:30 <johnw> AWizzArd: if they're not marked as INLINABLE, I think yes
18:30 <mjrosenb> the flag -p requires the program to be built with -prof
18:30 <mjrosenb> YOU DON'T SAY.
18:31 mpahrens joined
18:32 oisdk joined
18:35 bendo joined
18:35 lainon joined
18:35 <boyedaea> how o write programming without loops?
18:36 <quicksilver> use recursion instead, boyedaea
18:36 <boyedaea> quicksilver: can you give example what it means? for all how do we right
18:37 Deide joined
18:37 <quicksilver> > let ntimes 0 c = ""; ntimes n c = c : ntimes (n-1) c in ntimes 7 '*'
18:37 <lambdabot> "*******"
18:37 paidnode joined
18:37 <quicksilver> boyedaea: ^^ for example. print a character n times without a for loop
18:37 <quicksilver> but recursion can be very much like a for loop really.
18:38 <boyedaea> quicksilver: ok difficult to me
18:38 <quicksilver> difficult at first glance
18:38 <quicksilver> if you're not used to it
18:38 <quicksilver> quite enlightening with practice
18:38 <boyedaea> thanks
18:38 <quicksilver> you should pick up a fun beginner's haskell tutorial and work through it
18:39 <boyedaea> quicksilver: which one
18:39 Big_G joined
18:39 amirpro joined
18:41 connrs joined
18:41 <encodes_> so is the type of the first argument to Reify supposed to determine the value of its second argument, or does it use a value of the first type? i.e. its the wrong idea of using Int' rather than Int to return a constructor?
18:41 sgflt joined
18:42 boyedaea left
18:42 Tops2 joined
18:45 tomphp joined
18:45 dtornabene joined
18:46 <encodes_> the use of Proxy seems to indicate otherwise.... so the example of an Int parametrised constructor where this Int is expressed at type level is actually a rare example, so that the (families of?) types which can be used to "encode" class functions are limited?
18:46 UnChallengeD joined
18:47 lgas joined
18:47 language_agnosti joined
18:51 chaosmasttter joined
18:52 <lukelau> If I have a stack of monad transformers like type MyMonad = StateT s (ReaderT r (IO)), how can I reach withReaderT to get into the middle ReaderT?
18:52 <exarkun> Any library for QuickCheck-like stateful testing?
18:53 <cocreature> exarkun: hedgehog supports statemachine testing which pretty good ime
18:53 <cocreature> iirc there is also something for quickcheck but I think it might be in a separate library
18:53 <cocreature> encodes_: by “first argument to Reify” do you mean the “s” argument in “Reifies”?
18:53 <lukelau> I've tried withMyMonad f = lift (withReaderT id f) but then I need to "unlift" f from StateTs (ReaderT r (IO)) to just ReaderT r (IO)
18:54 <zachk> lukelau, have you tried composing lifts with the the monad action you want to run?
18:54 andyhoang1 joined
18:54 <lukelau> exarkun: checkout quickcheck-state-machine
18:54 <exarkun> Great, thanks, I'll check out Hedgehog.
18:54 <johnw> Hedgehog has been working very well for me so far
18:54 <jb55> hedgehog types are quite complicated, I had a hard time using it :(
18:55 <johnw> what are hedgehog types?
18:55 Linter joined
18:55 <jb55> hedgehog's
18:55 <johnw> you just write generators, that's it
18:55 <johnw> I'm not aware of any special types
18:55 <lukelau> zachk: I'm not sure what parts I need to lift
18:55 <exarkun> quickcheck-state-machine, cool, thanks.
18:55 <zachk> :t ask
18:55 <lambdabot> MonadReader r m => m r
18:55 <zachk> :t lift ask
18:55 <lambdabot> (MonadReader a m, MonadTrans t) => t m a
18:55 superguest joined
18:56 <zachk> :t lift . lift $ ask
18:56 <lambdabot> (MonadReader a m, Monad (t2 m), MonadTrans t2, MonadTrans t1) => t1 (t2 m) a
18:56 <zachk> not sure
18:56 skeuomorf joined
18:56 <superguest> > map putStrLn ["Hello", "World"]
18:56 <lambdabot> [<IO ()>,<IO ()>]
18:56 oisdk joined
18:56 raichoo_ joined
18:56 <cocreature> jb55: you mean the ones specifically for state machine testing?
18:57 <jb55> cocreature: yes
18:57 <cocreature> jb55: there are some examples in the repository that I found quite helpful
18:57 justanotheruser joined
18:57 <superguest> > putStrLn "Hello"
18:57 <lambdabot> <IO ()>
18:57 <lukelau> :t withReaderT
18:57 <lambdabot> forall k r' r (m :: k -> *) (a :: k). (r' -> r) -> ReaderT r m a -> ReaderT r' m a
18:57 <geekosaur> superguest, no IO in lambdabot
18:58 keepLearning512 joined
18:58 <superguest> geekosaur, nor does it work in ghci
18:58 <lukelau> :t lift . withReaderT
18:58 <lambdabot> forall k (t :: (* -> *) -> * -> *) r' r (m :: k -> *) (a :: k). MonadTrans t => (r' -> r) -> t ((->) (ReaderT r m a)) (ReaderT r' m a)
18:58 <cocreature> wow, I’m stupid. I changed my boxed array to an unboxed array and wondered for 20 minutes why I’m now getting an error when I write undefined to it
18:59 <geekosaur> superguest, huh?
18:59 <jb55> cocreature: I found the Var/Concrete and type level stuff confusing. I think I spent a day just looking at the types and trying to figure it out. I eventually just started to write my own lib
18:59 language_agnosti joined
19:00 <geekosaur> superguest, if you mean the map putStrLn, that's because map just maps the IO action, it doesn;t *do* the IO action
19:00 <geekosaur> you want traverse, or you want to apply sequence to the resulting list
19:00 iAmerikan joined
19:01 saurabhn_ joined
19:01 SovietBeer joined
19:02 <cocreature> jb55: if you have some concrete question, I might be able to help but if all you tell is that you found it confusing there is little anyone can do to help you :)
19:02 connrs joined
19:03 <geekosaur> superguest, an IO action buried in a list does nothing, it has to be added to the chain of IO actions reachable from main to do anything. (think about it, if they did things "by themselves" then you couldn't put one in a conditional. or a loop.)
19:03 <jb55> cocreature: it's ok I'm not looking for help, just someone mentioned hedgehog and I was voicing my experience :D
19:03 amirpro joined
19:03 mpahrens joined
19:04 <cocreature> fair enough :)
19:06 Meanirelli joined
19:06 amirpro joined
19:06 abhiroop joined
19:06 blackandblue joined
19:07 enterprisey joined
19:07 <superguest> geekosaur, I confused IO for Show there.
19:08 DSM joined
19:09 whowillcode joined
19:09 ian_andrich joined
19:11 dogweather joined
19:12 scottschmidt joined
19:13 abhiroop joined
19:13 conal joined
19:13 vurtz joined
19:14 saurabhnanda joined
19:14 dogweather joined
19:15 blackandblue joined
19:16 <encodes_> cocreature: yes
19:16 StoneToad joined
19:16 kritzefitz joined
19:17 kreetx joined
19:17 <mjrosenb> ok, silly question, what section of my .cabal file do I add profiling: True to?
19:17 oish joined
19:18 <cocreature> encodes_: the universally quantified "s" type parameter exists so that the instance can’t “escape” the scope of reify. and because s is universally quantified here you also won’t be able to unify s with anything else and thereby you still get the coherence property, i.e., there is at most one instance for a given type
19:19 <mjrosenb> also, is something seriously wrong with the haskell ecosystem right now? I feel like 'enable profiling on a project' should not be a multi-day ordeal.
19:19 <cocreature> mjrosenb: do you use new-build?
19:20 <nitrix> mjrosenb: Random guess with the limited information I have, probably the `ghc-options:` line, you can add -fprof-auto.
19:20 <mjrosenb> no, not yet.
19:20 <cocreature> then you probably have to do something like "cabal configure --enable-profiling"
19:20 <cocreature> you don’t configure this via your cabal file
19:20 <mjrosenb> nitrix: I have that. When I run my program, it says that it needs to be built with profiling.
19:20 <cocreature> you can configure it using new-build’s cabal.project file
19:21 <cocreature> new-build will also automatically rebuild all your deps with profiling which the old build will not do iirc
19:21 <mjrosenb> cocreature: is there a getting started guide on that? I've seen pages of documentation on it, but not 'how do I get my currrent setup to the new format'.
19:21 scottschmidt1 joined
19:22 justanotheruser joined
19:22 <cocreature> mjrosenb: https://cabal.readthedocs.io/en/latest/nix-local-build-overview.html
19:22 mnoonan joined
19:22 <dmwit> mjrosenb: If it's just one package, you can `cabal new-build` with no extra effort. If you need multiple packages, then yeah, check the quickstart document cocreature linked.
19:22 <cocreature> mjrosenb: but unless you have some complex setup, just switching "cabal build" to "cabal new-build" might already get you halfway :)
19:23 <cocreature> ah dmwit beat me to it :)
19:23 epsilonhalbe joined
19:23 <mjrosenb> the question still remains: what section does profiling: True go into?
19:23 <dmwit> Your own link beat you harder. "You can configure and build it using Nix-style local builds with this command (configuring is not necessary): cabal new-build"
19:23 <cocreature> mjrosenb: as I already said, it doesn’t go in the cabal file at all
19:23 <cocreature> you can put it in the cabal.project file
19:24 <dmwit> mjrosenb: `cabal new-build --enable-profiling`
19:24 <cocreature> but that’s new-build stuff
19:24 <mjrosenb> so, cabal.project is just another file in the directory alongside foo.cabal?
19:24 <cocreature> or in a parent directory
19:24 <cocreature> (if you have multiple packages)
19:25 <cocreature> cabal.project is similar to stack’s stack.yaml file if you have seen that
19:25 mpahrens joined
19:25 Henson joined
19:26 <encodes_> cocreature: so even using e.g. a Dict or any other attempt to embed more information into the type will fail? so that only type level ints could be used to reify e.g. an Int parametrised list constructor
19:26 plugin_ joined
19:27 <cocreature> encodes_: I’m not following. how does a Dict embed more information into the type?
19:27 diwo joined
19:27 <cocreature> I still have the very strong feeling that you are trying to solve a problem with typeclasses that goes completely against how typeclasses work in Haskell
19:27 mpahrens joined
19:28 <cocreature> but the code you showed us so far was too complex for me to understand it at a quick glance so I might be missing something
19:28 thblt left
19:29 <sclv> mjrosenb: you just need to cabal configure with --enable-profiling and then cabal build afaik?
19:29 <sclv> like all the new stuff is great
19:29 <cocreature> sclv: that won’t rebuild deps, right?
19:29 <sclv> but just for the "classic" way, assuming you have profiling libs installed as well, that should be fine
19:30 <sclv> cocreature: yeah, if you haven't gotten your libs built with profiling you have to build them again, which is a pain
19:30 <sclv> but if you're doing everything all sandboxed its not awful iirc
19:31 argent0 joined
19:31 <sclv> also in general I just set `library-profiling: True` in my ~/.cabal/config
19:31 <cocreature> I’m so glad I mostly don’t have to deal with non-new-build cabal these days :)
19:31 cybai joined
19:31 <exarkun> What's going on when I do `x <- newIORef ()`, `modifyIORef x $ \x' -> throw Foo` in ghci?
19:31 <sclv> (then i never have to worry about having libs built with profiling, because thy always get built that way as well as the standard way)
19:31 vukasink joined
19:32 valentinbuza joined
19:32 exarkun_ joined
19:33 <mjrosenb> cocreature: I have never used stack :-/
19:33 <mjrosenb> cabal: Failed to build documentation for fail- (which is required by
19:33 <mjrosenb> bah.
19:33 <mjrosenb> and that is with cabal new-build --enable-profiling --disable-documentation
19:33 <cocreature> that should only be a warning, not an error iirc?
19:34 <sclv> yeah, its a bug in current new-build
19:34 <exarkun> Laziness I guess
19:34 <sclv> not laziness, bug
19:34 <mjrosenb> well, the command returned 1.
19:34 <sclv> you can set documentation to False in your cabal config
19:34 dogweather joined
19:34 <cocreature> exarkun: right, you are storing the exception in the IORef but you are never forcing the value
19:35 <cocreature> exarkun: that’s why you should generally only use exceptions with throwIO
19:35 <sclv> (oh, sorry, i misread what the laziness comment was in regards to :-))
19:35 danthemy_ joined
19:35 iAmerika1 joined
19:36 DSM joined
19:36 pranz1 joined
19:36 <cocreature> although I would have expected --disable-documentation to work? does this not affect deps?
19:36 <exarkun> sclv: np, sorry for confusion
19:36 <exarkun> cocreature: oof
19:36 <mjrosenb> sclv: which cabal config is that?
19:36 <cocreature> mjrosenb: ~/.cabal/config
19:37 emilypi joined
19:38 <superguest> ?let fruits = ["Apple", "Banana", "Cherry"] in "Apricot" : (tail fruits)
19:38 <lambdabot> Parse failed: Parse error: in
19:38 <exarkun> Backing up, then. What's a good pattern for modifying an IO ref except maybe not if the referenced value satisfies some condition? I thought throwing an exception from the modify function would be better than checking the value first and then only calling modifyIORef sometimes.
19:38 <superguest> ?let fruits = ["Apple", "Banana", "Cherry"]
19:39 <lambdabot> Defined.
19:39 <superguest> > "Apricot" : (tail fruits)
19:39 rihards joined
19:39 <lambdabot> ["Apricot","Banana","Cherry"]
19:39 <exarkun> I don't think I can throwIO in the function I pass to modifyIORef though
19:39 ClathomasPrime joined
19:39 hucksy joined
19:39 <superguest> In your opinion, is it unusual to have parens around `tail fruits` in Haskell code
19:40 <superguest> ?
19:40 <* hackage> parsix - Parser combinators with slicing, error recovery, and syntax highlighting http://hackage.haskell.org/package/parsix- (OlleFredriksson)
19:40 bbrodriguez joined
19:40 <cocreature> superguest: yeah I’d say it’s a bit unusual
19:40 abhiroop joined
19:40 pfurla joined
19:41 Kacia joined
19:41 <encodes_> cocreature: that if the type used was a constraint that all of the functions defined in the classes it demands are implmented would be brought into scope and then could be used.
19:41 tombusby joined
19:42 <cocreature> exarkun: readIORef + throwIO + writeIORef?
19:43 <cocreature> exarkun: oh wait I didn’t read your question properly, no need for throwIO here. wrap the call to writeIORef in something like "when" or "unless"
19:44 <cocreature> :t \p f r -> x <- readIORef r; when (p x) (writeIORef (f x))
19:44 <lambdabot> error:
19:44 <lambdabot> Parse error in pattern: \ p f r -> x
19:44 <lambdabot> Possibly caused by a missing 'do'?
19:44 <cocreature> :t \p f r -> do x <- readIORef r; when (p x) (writeIORef (f x))
19:44 <lambdabot> error:
19:44 <lambdabot> • Variable not in scope: readIORef :: t2 -> m t
19:44 <lambdabot> • Perhaps you meant ‘readSTRef’ (imported from Data.STRef)
19:44 <cocreature> % :t \p f r -> do x <- readIORef r; when (p x) (writeIORef (f x))
19:44 <yahb> cocreature: ; <interactive>:1:44: error:; * Couldn't match expected type `IO ()' with actual type `a -> IO ()'; * Probable cause: `writeIORef' is applied to too few arguments; In the second argument of `when', namely `(writeIORef (f x))'; In a stmt of a 'do' block: when (p x) (writeIORef (f x)); In the expression:; do x <- readIORef r; when (p x) (writeIORef (f x)); * R
19:45 <cocreature> % :t \p f r -> do x <- readIORef r; when (p x) (writeIORef r (f x))
19:45 <yahb> cocreature: (t -> Bool) -> (t -> t) -> IORef t -> IO ()
19:45 <cocreature> ^ exarkun
19:45 <cocreature> encodes_: what is the “type used”. which type do you want to use where? can you provide some example?
19:46 <exarkun> I had some vague concerns about concurrency but I'm still not really clear on how that works in Haskell
19:46 <cocreature> encodes_: I’m sorry if I’m sounding stupid here but I’m really having a very hard time parsing your questions
19:46 <encodes_> this seems contradictory to the idea that the first type of reifies should uniquely determine the second, in that it provides access to functions which return different values depending on the implementation of the class of the constraint.
19:46 <mjrosenb> ok, has anyone had issues with doctest. Should I just install an older version of it, and hope that my problems go away?
19:46 dogweather joined
19:46 conal joined
19:46 <cocreature> exarkun: if you care about concurrency then you need to use atomicModifyIORef
19:46 <mjrosenb> and by doctest, I mean cabal-doctest
19:47 refold joined
19:47 desperek joined
19:47 mreh joined
19:47 fresheyeball joined
19:47 <cocreature> :t \p f r -> atomicModifyIORef (\x -> if p x then f x else x) r
19:47 <lambdabot> error:
19:47 <lambdabot> Variable not in scope: atomicModifyIORef :: (p -> p) -> t -> t1
19:47 <cocreature> % :t \p f r -> atomicModifyIORef (\x -> if p x then f x else x) r
19:47 <yahb> cocreature: ; <interactive>:1:30: error:; * Couldn't match expected type `IORef a' with actual type `p -> p'; * The lambda expression `\ x -> ...' has one argument,; but its type `IORef a' has none; In the first argument of `atomicModifyIORef', namely `(\ x -> if p x then f x else x)'; In the expression: atomicModifyIORef (\ x -> if p x then f x else x) r; * Relevant bindings include;
19:47 pranz2 joined
19:47 <encodes_> e.g. Reifies (Dict Monoid) x =>
19:47 <cocreature> % :t \p f r -> atomicModifyIORef r (\x -> if p x then f x else x)
19:47 <yahb> cocreature: ; <interactive>:1:59: error:; * Occurs check: cannot construct the infinite type: t ~ (t, b); * In the expression: x; In the expression: if p x then f x else x; In the second argument of `atomicModifyIORef', namely `(\ x -> if p x then f x else x)'; * Relevant bindings include; x :: t (bound at <interactive>:1:33); r :: IORef t (bound at <interactive>:1:6); f
19:48 <fresheyeball> anyone out there know about zlib deflate?
19:48 <mjrosenb> https://paste.pound-python.org/show/oU37noaYeeng3QlTM8yW/ is the error that I've been seeing all week with cabal-doctest.
19:48 <fresheyeball> I am trapped in some kind of encoding hell
19:48 <cocreature> % :t \p f r -> atomicModifyIORef r (\x -> (if p x then f x else x, ()))
19:48 <yahb> cocreature: (t -> Bool) -> (t -> t) -> IORef t -> IO ()
19:48 <cocreature> ^ exarkun
19:49 <cocreature> encodes_: you can’t choose the "s" parameter. you need to write an instance that works for any "s" and then you can use it with the "s" that you get from "reify"
19:49 hucksy joined
19:49 <cocreature> exarkun: although if you care about concurrency an MVar or a TVar might be a better choice
19:49 <cocreature> exarkun: and if you’re not sure about how this works in Haskell, I can highly recommend simon marlow’s book (in particular, the second part)
19:50 <encodes_> which assumes that there exists instance (Monoid a) x ...
19:51 <encodes_> instance reifies*
19:51 <exarkun> cocreature: I thought I probably wouldn't stick with IORef but it seemed like a simple place to start learning about this stuff. If I use `atomicModifyIORef` then I'm back to wanting to throw? Or rather, I also want to observe which choice is made. But maybe that's what `b` is for in `atomicModifyIORef`?
19:51 <cocreature> encodes_: you need some instance similar to the one that I used in the gist you found a while back
19:51 jle` joined
19:51 jle` joined
19:51 <cocreature> exarkun: exactly, use the b!
19:52 <cocreature> % :t \p f r -> atomicModifyIORef r (\x -> let b = p x in (if b then f x else x, b))
19:52 <yahb> cocreature: (t -> Bool) -> (t -> t) -> IORef t -> IO Bool
19:52 <encodes_> such as; instance Reifies s (a -> a -> Ordering) => Eq (Ordable s a) ?
19:52 <cocreature> yep
19:52 <encodes_> with newtype Ordable s a = Ordable { unordable :: a }
19:52 <exarkun> cool, thanks
19:53 serendependy joined
19:53 Solonarv joined
19:53 patlv joined
19:53 zariuq joined
19:54 <encodes_> Its not obvious how to use this to obtain various different functions of type (a -> a -> Ordering)
19:55 <cocreature> why do you want to use a typeclass to obtain various different functions of type (a -> a -> Ordering)? just pass the functions of type a -> a -> Ordering around directly?
19:56 andyhoang1 joined
19:57 <encodes_> its an attempt to use (referring to https://lpaste.net/5163845437748150272) reify to obtain something like the class construct from SetT
19:57 darjeeling_ joined
19:59 <encodes_> in that there exists a way to determine various constructors from an Int argument such as that defined on line 50.
20:00 <mjrosenb> so, what files are supposed to be installed for cabal-doctest?
20:00 acertain joined
20:00 <mjrosenb> since it seems to think mine are incorrect
20:00 <* hackage> linux-namespaces - Work with linux namespaces: create new or enter existing ones http://hackage.haskell.org/package/linux-namespaces- (MariosTitas)
20:00 weird_error joined
20:00 nowhereman_ joined
20:00 <mjrosenb> and having just installed 1.0.5, and it still complaining, I am beginning to wonder what is actually wrong.
20:00 <cocreature> encodes_: are you looking for the typelevel natural numbers defined in GHC.TypeLits?
20:01 <cocreature> mjrosenb: what exactly is the error?
20:01 <mjrosenb> cocreature: https://paste.pound-python.org/show/oU37noaYeeng3QlTM8yW/
20:02 abhiroop joined
20:02 <* hackage> expressions-z3 0.1.6 - Encode and Decode expressions from Z3 ASTs http://hackage.haskell.org/package/expressions-z3-0.1.6 (jakubdaniel)
20:02 plugin joined
20:02 <philippD> encodes_: what is the i in Constructable for?
20:04 <cocreature> mjrosenb: ouch that looks bad, which version of cabal and ghc are you using?
20:04 <encodes_> the problem then is that values of type Int is a rare example of values which can be promoted to Type level, and so using something which could bundle arbitrary types which could then be used to parametrise class functions in this way.
20:04 gehmehgeh joined
20:04 pranz3 joined
20:04 <mjrosenb> cabal-install version
20:04 <mjrosenb> compiled using version of the Cabal library
20:04 <philippD> encodes_: with DataKinds you can promote any datatype
20:04 <mjrosenb> The Glorious Glasgow Haskell Compilation System, version 8.2.2
20:04 <encodes_> - such as Dict, which would bring value level functions into scope.
20:05 <mjrosenb> and it has been installed into a sandbox.
20:05 <cocreature> mjrosenb: new-build doesn’t use sandboxes
20:05 <mjrosenb> well, I also get the same error without new-build, in a sandbox.
20:05 <cocreature> mjrosenb: maybe try finding cabal-doctest in ~/.cabal/store and delete it
20:05 <cocreature> mjrosenb: what’s the output of ghc-pkg list?
20:05 <sclv> hrm
20:06 <sclv> don't mess with the store directly!
20:06 <sclv> that'll cause trouble
20:06 rann joined
20:06 dogweather joined
20:06 <cocreature> sclv: well what else do you do if something breaks? getting ghc-pkg unregister to work seems to be rather tricky ime
20:06 <sclv> right
20:06 <sclv> but deleting from the store doesn't work either
20:06 <encodes_> philippD: meaning that reifies could effectively be used in the way described?
20:06 <sclv> it just screws up the whole store
20:07 <cocreature> huh, I seem to recall that it just rebuild the package. I guess I’m misremembering
20:07 <mjrosenb> https://paste.pound-python.org/show/6d0goAkJXazcr7PBJ0C5/
20:07 <sclv> cocreature: you might be right
20:07 <sclv> i could be overly anxious here
20:07 <philippD> encodes_: I'm a little late to the party here. Could you summarize what exaclty you want to do?
20:08 <cocreature> mjrosenb: huh that’s weird, not sure what’s going on there. maybe sclv has an idea?
20:08 fragamus joined
20:08 <cocreature> the fact that both new-build and old build are broken in the same way made me thought it might be a globally installed package but that doesn’t seem to be the case
20:09 <* hackage> parsix - Parser combinators with slicing, error recovery, and syntax highlighting http://hackage.haskell.org/package/parsix- (OlleFredriksson)
20:09 <mjrosenb> so, I started using nix's ghc because arch's is dumb, and did something weird, where they disabled static linking.
20:09 <sclv> mjrosenb: is it this issue? https://github.com/haskell/cabal/issues/4812
20:09 <mjrosenb> I had a ~/.cabal/config that attempted to mitigate that, but I don't think that ever worked.
20:10 <sclv> like if you're building only profiling and not vanilla
20:10 <sclv> or the like
20:10 <mjrosenb> I can try building it without --enable-profiling
20:10 <encodes_> return class functions from a type, which would then be referred to as "encoding" that class (assuming it consists of classes of one function, admitting definition by type synonym such as found on line 42 of the paste)
20:10 agander_ joined
20:11 bergle3 joined
20:12 <sclv> you should check if your cabal config has dynamic linking or static linking set
20:12 <sclv> the linked bug sorta explains the issue. https://github.com/haskell/cabal/issues/1720
20:12 <mjrosenb> it has executable-dynamic: True
20:12 blankhart joined
20:12 <sclv> what you mention about arch and a custom config makes me more suspicious yeah
20:12 <sclv> ok, so that's the issue
20:13 <mjrosenb> and disabling profiling did not fix anything.
20:13 <sclv> you're halfway between a standard setup
20:13 <sclv> and a totally screwy arch setup
20:13 <mjrosenb> should I set executable-dynamic: False?
20:13 <* hackage> self-extract 0.3.1 - A Haskell library to make self-extracting executables http://hackage.haskell.org/package/self-extract-0.3.1 (brandonchinn178)
20:13 <sclv> mm... probably?
20:13 mreh joined
20:13 <sclv> but then you might not have any static libs installed that you need
20:14 <sclv> otoh new-buld should be able to figure that out and handle it
20:14 <sclv> idk how to fix a setup that's been partially dynamic, but that's a good approach
20:14 <sclv> the other option is to power through and as suggested in the last comment add `ghc-options: -dynamic` to your cabal config file
20:14 <sclv> the issue is you only have dynamic and not static libs
20:15 <sclv> but it tries to build the custom setup dynamically
20:15 <sclv> erm i mean statically
20:15 <sclv> and can't find any libs
20:15 chaosmasttter joined
20:15 <cocreature> iirc new-build doesn’t properly handle the case where you only have dynamic libs. that’s what caused all the arch problems
20:15 dogweather joined
20:15 <sclv> so adding that option forces the custom setup to be built dynamically as well
20:15 <philippD> encodes_: have to taken a look at the singletons library?
20:15 <sclv> otoh i suspect if you stick to new-build and just strip out the dynamic options from your config
20:15 <sclv> then maybe new-build will just happily build all the static stuff for you without freaking out
20:15 <sclv> :-/
20:16 <mjrosenb> can I blow away my .cabal/ everything except config, and let it re-populate it all?
20:16 <sclv> don't do that
20:16 <sclv> just change the option
20:16 <sclv> blowing stuff away is a last resort
20:16 <mjrosenb> hrmm
20:16 <mjrosenb> Warning: /home/mjrosenb/.cabal/config: Unrecognized field ghc-options on line
20:16 <mjrosenb> 148
20:17 <mjrosenb> that's my bad.
20:17 <sclv> even when you change options you shouldn't need to blow stuff away, 99% of the time
20:18 youtmon joined
20:18 hph^ joined
20:18 <sclv> (note that if you do decide to do that you can't just wipe out ~/.cabal but also need to wipe out /home/mjrosenb/.ghc/x86_64-linux-8.2.2/)
20:18 orphean joined
20:18 <sclv> (since the latter packagedb points to stuff installed in the former location
20:18 <mjrosenb> that also did not work.
20:18 dedgrant joined
20:19 <* hackage> pusher-http-haskell - Haskell client library for the Pusher HTTP API http://hackage.haskell.org/package/pusher-http-haskell- (willsewell)
20:19 <encodes_> Not sure about that library, its quite deep into GHC? here is an earlier attempt which might help explain the approach; https://lpaste.net/5889345669801443328
20:20 anarchosaurus joined
20:20 <sclv> mjrosenb: ok what about turning off that option and also setting executable-dynamic: False ?
20:20 <encodes_> but attempts made to return a Dict which incorperated the argument on line 34 were not a success..
20:23 zero_byte joined
20:24 <mjrosenb> sclv: I already tried with executable-dynamic: False. That was with both executable-dynamic: False and ghc-options: -dynamic
20:24 <glguy> encodes_: What was the expected outcome?
20:24 <mjrosenb> which probably wasn't the best combination.
20:24 <sclv> yeah that's not the right mix
20:24 <sclv> you either set everything dynamic or nothing dynamic
20:24 <sclv> you don't want to be in th emiddle
20:25 <sclv> also you can't just say what you did and it didn't work
20:25 <sclv> if there's a particular error then you need to give both the command and the error
20:25 <sclv> its hard enough trying to give advice over irc as is
20:25 <sclv> without having all the context :-)
20:25 trcc joined
20:25 <encodes_> glguy: with that approach it was hoped to return Dicts which provided different instances to the same class, which if used together in the same Context would cause terrible Undecidability, but only at that point, without each instance being available in wider scope.
20:26 <cocreature> just let sclv take over your brain for a while
20:26 <mjrosenb> I can pastebin the output of cabal new-build -v if you want :-)
20:26 gabiruh joined
20:26 Folkol joined
20:26 <sclv> i mean, if you can interpret the tickets i linked, they explain what's going on fully
20:27 <encodes_> which eventually failed due to the inability to write (?x :: a) => Dict (Is a) or to infer anything similar using entails...
20:27 <cheshircat> is there a NonEmpty-equivalent set datastructure apart fron NonNull Set (NonNull is from mono-traversable)
20:27 <glguy> encodes_: what you pasted behaved exactly as I would have expected. I'm wondering what specific behavior you'd expected
20:27 brandly joined
20:28 <mjrosenb> it mostly makes sense, but I don't know what the mismatch between cabal-doctest and distributive is in order to fix it :-(
20:28 <sclv> there's no mismatch between the two
20:28 <glguy> You can't have different instances for the same type. Dict wouldn't help you achieve that
20:28 <sclv> the problem is that doctest works by creating a custom setup
20:28 <sclv> and the custom setup is linked statically
20:28 <glguy> Dict uses the normal instance resolution process when constructing Dict _ values
20:28 <sclv> but you have everything else configured to only build dynamic
20:29 <sclv> so then it can't find the static lib for doctest (since it isn't built) and the custom setup goes boom
20:29 <sclv> so you _either_ set your config to _all_ static or _all_ dynamic
20:29 <sclv> and that eliminates the mismatch
20:29 <philippD> encodes_: Why do you need the Is class and Dict? couldn't Dict hold the value itself instead of capturing the Is instance?
20:29 <sclv> basically your current config still bears traces of being the weird one that arch suggested you put together
20:29 <sclv> instead of a bog-standard one
20:30 <mjrosenb> yeah, I am not happy with arch right now.
20:30 <sclv> mjrosenb: yeah everyone is mad at them and they refuse to change :-)
20:30 <sclv> they claim it works well for userland apps and development doesn't matter :-/
20:31 <sclv> one thing you can do is run `cabal user-config diff` and that shows the diff between your cabal config and the "default" one
20:31 argent0 joined
20:31 <mjrosenb> oohhh, that sounds nice.
20:31 <sclv> so you can use that to see what's "nonstandard" in your setup
20:31 <sclv> and just turn that stuff off
20:32 <mjrosenb> it looks like the issue was that I'd set library-vanilla to false.
20:32 <mjrosenb> presumably because arch had changed the definition of library-vanilla? and my shiny new cabal from nix had not.
20:33 <sclv> well the shiny new cabal from nix doesn't overwrite the config file
20:33 <sclv> and arch gave you a funny config file
20:33 abhiroop joined
20:33 <mjrosenb> well, I gave myself a funny config file on arch's recommendation
20:33 <mjrosenb> not sure if that's better or worse...
20:33 <sclv> either way :-)
20:33 nuncanada joined
20:34 language_agnosti joined
20:34 vurtz joined
20:35 <encodes_> The 'Is' class was a way to represent classes of one function as a type synonym, the type Encodes (on line 11 of https://lpaste.net/5889345669801443328) then retrives the type of the class defining function ('b') and provides a new class which "extends" the one provided to one whoes defining function has the additional parameter 'a', which is then said to "encode" the class 'Is b'
20:38 replay joined
20:38 fishythefish joined
20:38 <mjrosenb> sclv: sweet, that worked!
20:38 <sclv> whew!
20:38 <sclv> i was getting frustrated, i can imagine how you felt too :-)
20:39 <sclv> i always love/hate to learn about new weird corner case issues with builds and linking
20:39 <mjrosenb> ok, now for the fun part: to try to enable profiling.
20:39 <encodes_> philippD: 'Is' is a way to access the type of the class defining function, Dict was an attempt to hide Undecidable instances from each other which does not work.
20:40 <philippD> encodes_: I can see that, but what is this supposed to achieve.
20:41 pfurla joined
20:44 <encodes_> a way to automatically extend a class defining function by one parameter
20:44 <encodes_> to "encode" a class by a value.
20:45 zaquest joined
20:46 louispan joined
20:46 fmixing_ joined
20:47 <encodes_> it would allow e.g. functions to return a value encoding thier inverse, such as would be for traversing Shaped Containers whoes constructor has a governing parameter. the discussion of which should be deferred.
20:49 <encodes_> but hopefully not for too much longer
20:51 <superguest> Is the quickest way to append an element into a list is to first convert the element-to-be-added into a list and `++` ?
20:52 mpahrens joined
20:52 <superguest> ?let mylist = ["a", "b", "c"]
20:52 <lambdabot> Defined.
20:52 <superguest> mylist + ["d"]
20:52 <superguest> > mylist ++ ["d"]
20:52 <lambdabot> ["a","b","c","d"]
20:52 vurtz joined
20:52 dented42 joined
20:53 <Solonarv> yeah, can't do it any quicker than that
20:53 <Solonarv> actually
20:53 <Solonarv> @hoogle [a] -> a -> [a]
20:53 <lambdabot> Data.List intersperse :: a -> [a] -> [a]
20:53 <lambdabot> GHC.OldList intersperse :: a -> [a] -> [a]
20:53 <lambdabot> Data.Text.Internal.Functions intersperse :: a -> [a] -> [a]
20:56 marvin2 joined
20:57 dan_f joined
20:57 dented42 joined
20:57 ni291187 joined
20:58 ni291187 left
20:59 <encodes_> the attempts using reify seemed more promising since they seem not to conflict so badly with the typechecker... but the need to encode the functions of the desired type using values promoted to type level is frustrating. This motivated the question about if Dict could be used instead to bring functions defined in class instances into scope, which would essentially allow superclass inheritance to serve in place of promoting complex
21:01 mpahrens joined
21:02 anarchosaurus left
21:03 danso joined
21:03 <* hackage> hlrdb-core - High-level Redis Database Core API http://hackage.haskell.org/package/hlrdb-core- (identicalsnowflake)
21:04 abhiroop joined
21:04 <fresheyeball> hey out there, anyone know about zlib?
21:04 <fresheyeball> I can't get a thing to decompress
21:05 <fresheyeball> Codec.Compression.Zlib: compressed data stream format error (invalid distance too far back)
21:05 <fresheyeball> that is with Codec.Compression.Zlib.Raw.decompress
21:05 <fresheyeball> which seems right api wise
21:06 son0p joined
21:06 Ariakenom joined
21:08 <superguest> someFunction param1 param2 = [...............................]
21:08 <superguest> | <condition>
21:08 <glguy> syntax error and uses tabs
21:08 <superguest> How far in should the indentation go for the `| <condition`
21:08 <superguest> ?
21:08 <Solonarv> doesn't matter
21:08 <monochrom> at least one space.
21:09 <glguy> Up to the author. I like 2 spaces
21:09 <superguest> This is a question on style.
21:09 <monochrom> In fact, it doesn't even need to be on the 2nd line.
21:09 <monochrom> Then 4 spaces. So that a later "where" can be at 2 spaces.
21:10 fmixing joined
21:10 <monochrom> The average programmer indents for 3.7493 spaces.
21:10 mpahrens joined
21:10 <Solonarv> actually I'm pretty sure `where` can be indented at the same level as guards
21:11 RobertUDEM joined
21:11 <monochrom> It can. And like I said, the guards don't even have to be on separate lines.
21:11 pranz4 joined
21:11 <encodes_> not knowing how to work with Proxy Dicts, the closest version to working is; https://lpaste.net/7665210734258683904
21:12 <RobertUDEM> \x -> \y -> ?x :: Am I right to assume that ? would be a function that takes an X as argument? (so : x=a, y=b :: a->c)?
21:13 <monochrom> But when it comes to using spaces to remind humans of scoping, rather than to show off what you know about fine prints, having the "where" a little bit to the left is helpful.
21:13 <glguy> That's either a syntax error, or it is using ImplicitParams, which is something other than what you've described
21:13 <glguy> RobertUDEM: ^
21:13 epsilonhalbe joined
21:13 rzp joined
21:13 jollygood2 joined
21:13 <Cale> glguy: Yeah, this must be from an assignment because other people were asking the same thing
21:13 <Cale> The goal is to determine the type of thing which would go in the place of the question mark
21:14 <RobertUDEM> it's actually a mock exam
21:14 <RobertUDEM> we got our final tomorrow :(
21:14 <encodes_> I guess the problem is the hole on line 59
21:14 <jollygood2> hi. in parsec is there a parsing combinator that accepts a parser and tries to parse with it but without consuming any input, returning True if parsing would succeed, and False otherwise
21:14 <glguy> jollygood2: lookAhead
21:15 <jollygood2> thanks!
21:15 <glguy> encodes_: In order to make a value with type (Dict (Is Int)), you'll need an: instance Is Int declaration in your source file
21:15 lumm joined
21:15 <Cale> RobertUDEM: So yeah, if x :: a, then ? must be a function whose type is of the form a -> t for some type t
21:16 <RobertUDEM> Yeah. Some other students are saying that t is b (y :: b)
21:16 <RobertUDEM> but we don't actually know what the function do right?
21:16 <RobertUDEM> so it's better to use another type
21:17 <glguy> There's no reason that it would have to have the same type as y
21:17 <encodes_> glguy, then coerce a Int could be used, and this would be equivalent to type level Ints, but is more extensible
21:17 <glguy> :t \f x y -> f x -- you can just type this stuff into GHCi
21:17 <lambdabot> (t1 -> t2) -> t1 -> p -> t2
21:18 danthemyth joined
21:18 <Cale> It might also be nice to use the ImplicitParams extension for questions like this:
21:18 <Cale> :t \x y -> ?f x
21:18 <monochrom> You can also use typed hole and ask GHCi of "\x y -> _ x"
21:18 <lambdabot> (?f::t1 -> t2) => t1 -> p -> t2
21:18 <encodes_> oh no it couldnt...
21:19 pranz joined
21:19 soupladler joined
21:19 <encodes_> :r
21:21 tzemanovic joined
21:21 <glguy> encodes_: The unsafeCoerce business that reflection is doing is only marginally safe because of the Rank-2 type used in reify to ensure that the fabricated typeclass can't collide with any other type
21:22 <glguy> Once you've got more than one of these Dict (Is Int) around you won't be able to control which instance is being used
21:23 <soupladler> Hey, are there any general principles to thinking about functional programming? I'm feeling like I'm lacking some kind of fundamental intuition. I just look at problems that would take me a second to solve in imperative style and draw a complete blank.
21:23 <encodes_> this seems to imply the only way is to use promoted types?
21:23 <fresheyeball> Oh I actually made progress!
21:24 pie_ joined
21:24 <fresheyeball> The string decodes base64 just fine, so it needed to be base64 decoded before it can be inflated
21:24 <Rembane> soupladler: Break the problem into smaller parts. Try to solve them in terms of map, filter and fold.
21:24 Linter joined
21:24 <Rembane> soupladler: Do you have any concrete example?
21:24 <encodes_> or support (?x :: a) => Dict (Is a)
21:25 dxld joined
21:25 mizu_no_oto_work joined
21:25 pranz1 joined
21:25 <ggVGc> everything ends up being a fold if you look hard enough
21:26 <encodes_> forcing the Constraint tupling process to detect locally Undecidability conflicts.
21:26 andyhoang1 joined
21:28 <encodes_> at the moment I cant see how this would happen if all is available is Dict
21:28 justanotheruser joined
21:30 oisdk joined
21:31 mreh joined
21:32 <soupladler> Rembane: that's amazing actually. Just read some stuff about map, filter, and fold. I think I was getting hung up on basically every introduction to functional programming using tons of recursion
21:32 <mreh> hmm http://hackage.mobilehaskell.org/ is down
21:34 <Rembane> soupladler: Tons of recursion sounds scary. Have you got your head around recursion?
21:34 darjeeling_ joined
21:34 <soupladler> Technically, I understand the concept. In practice, I have very shaky instincts about it. It's not the kind of thing I naturally reach for, to be honest.
21:35 elfets joined
21:35 abhiroop joined
21:35 <byorgey> soupladler: recursion is fundamental to functional programming, but actually comes up surprisingly little in practice. Typically one works in terms of higher-level functions like map, filter, fold, etc., and those functions do all the recursion for you.
21:36 bas080 joined
21:36 Foritus joined
21:36 <soupladler> Hmm. So good practice for my foundational knowledge would be to do stuff with recursion until it feels natural to me?
21:37 <mreh> For more information about recursion, please read this sentence.
21:37 <Rembane> mreh: What's the base case?
21:37 <mreh> I'm too lazy to read the whole thing
21:37 <Rembane> soupladler: Or you use map, filter and fold until you need recursion.
21:38 <byorgey> soupladler: if it's foundational knowledge you're after, then sure. If you're just after an ability to get stuff done with FP, then not necessarily.
21:38 pranz2 joined
21:38 <soupladler> I'm learning FP basically to broaden my horizons
21:38 <soupladler> get a more varied idea of what programming entails
21:38 <soupladler> I don't need to get anything done.
21:39 <byorgey> Got it. Then practice recursion, for sure.
21:39 <soupladler> Cool :)
21:39 <soupladler> anything I can read?
21:39 <soupladler> Like good general theory books?
21:40 thunderrd joined
21:40 <[exa]> (I kindof wish there was a good newcomer-friendly book on that)
21:42 <Tuplanolla> I always recommend Software Foundations.
21:42 <[exa]> that's a bit too general maybe, but yes
21:42 <pdxleif> I guess I got used to recursion in XSLT.
21:42 <Tuplanolla> It's a good choice if you have three weeks of no pressure to get anything done.
21:42 <Rembane> Tuplanolla: These ones? https://softwarefoundations.cis.upenn.edu/current/index.html
21:43 <Tuplanolla> Yes, Rembane.
21:43 <[exa]> I like the memory on the background
21:43 <[exa]> soupladler: anyway, this is not haskell-specific but I learn functional-style programming from t-y-scheme
21:43 <Rembane> Tuplanolla: Sweet!
21:44 <[exa]> soupladler: https://ds26gte.github.io/tyscheme/
21:44 <Rembane> What about the SICP? Is that book useful in this case?
21:44 <soupladler> That looks really good, actually. Not sure I qualify for 'mathematical maturity' - but I'm working on that.
21:44 <Rembane> soupladler: You can come back here and ask questions if you get stuck.
21:45 <soupladler> Cool, thanks!
21:45 alang joined
21:49 pranz3 joined
21:51 pranz4 joined
21:51 DSM joined
21:52 pranz joined
21:52 enterprisey joined
21:52 wazdee joined
21:53 raynold joined
21:53 codesoup joined
21:53 Helom joined
21:53 <Helom> https://tinyurl.com/ya79dnx5
21:53 pranz1 joined
21:54 Helom left
21:55 <superguest> Is the `where` clause permitted inside list comphrensions?
21:55 WhatisRT joined
21:55 reactormonk joined
21:55 <superguest> > [ x * 2 | x <- g where g = map abs [-1,-2, -3]]
21:56 <lambdabot> <hint>:1:18: error: parse error on input ‘where’
21:56 <glguy> superguest: No, where isn't part of the syntax of expressions, but you can use let there
21:56 pranz2 joined
21:56 <glguy> let g = stuff, x <- g
21:56 abhiroop joined
21:56 lumm joined
21:57 <superguest> thank you
21:58 Destol joined
21:59 conal joined
22:02 rcdilorenzo joined
22:03 edmundnoble joined
22:03 seanparsons joined
22:04 abhiroop joined
22:06 <butterthebuddha> I'm writing an interpreter and I have a "global environment" (represented as a Map) that stores variable bindings. Is it a good idea to use the State monad to pass it around the program? I've never used it before so I'm not sure
22:07 <lyxia> sure it is
22:07 seanparsons joined
22:09 abhiroop joined
22:10 RegEchse joined
22:10 <nowhereman_> hey guys, I'm baffled by an endless loop in my code: https://lpaste.net/2672206249298231296
22:10 <mreh> I wonder if I could compile Haskell to a C library and build it into an android stuido project
22:10 <nowhereman_> when I set a breakpoint on line 8, I get that at the second invocation, previous is a thunk
22:10 <nowhereman_> and forcing it never terminates
22:11 <nowhereman_> also s
22:11 <nowhereman_> (the Cell type is a node in a graph whose third argument is of type [Cell]
22:11 pranz3 joined
22:12 fmixing joined
22:13 <Cale> nowhereman_: Could d become negative?
22:14 <nowhereman_> Cale: possibly but in my case, I tried with distance=2
22:14 <nowhereman_> so the problem appears with d=1
22:15 <Cale> Yeah, seems unlikely :)
22:15 danso joined
22:16 <nowhereman_> also, there's pattern-matching on the first argument being 0
22:17 diwo joined
22:17 diwo joined
22:17 amar joined
22:18 valentinbuza joined
22:18 <mjrosenb> nowhereman_: so...
22:18 <mjrosenb> elem uses an equality check
22:18 diwo joined
22:18 <mjrosenb> if you've built a recursive data structure that has references to itself
22:18 pranz4 joined
22:18 ggreg joined
22:18 <mjrosenb> I don't think (==) will ever be able to return true
22:18 <mjrosenb> since it will recurse infinitely.
22:18 <Cale> That's certainly correct
22:19 diwo joined
22:19 <Cale> Cyclic datastructures are indistinguishable from infinite ones
22:19 jollygood2 joined
22:19 amar joined
22:20 ggreg left
22:20 saurabhnanda joined
22:21 darjeeling_ joined
22:21 saurabhnanda joined
22:21 lortabac_ joined
22:23 greegel joined
22:23 <jollygood2> hi. can someone help me with this code? I tried various combinations of try and lookAhead but I could not escape infinite loop and out of memory error if parser can't parse anything. https://lpaste.net/5911249320111243264
22:24 conal joined
22:25 abhiroop joined
22:25 abhiroop joined
22:26 <jollygood2> added imports to make the code runnable through ghci. https://lpaste.net/111357536933773312
22:28 <nowhereman_> mjrosenb: OK, is there a way to test for equality in a recursive data structure?
22:28 abhiroop joined
22:28 <nowhereman_> in this case, I can get by with comparing coordinates, I guess
22:30 m0rphism joined
22:30 <butterthebuddha> I hate that everyone is so focused on explaining how "thing x" is implemented and how it works, but few people actually show non-trivial examples of how that thing works
22:30 <butterthebuddha> which is much more helpful :
22:34 tzemanovic joined
22:36 jollygood2 joined
22:38 refold joined
22:38 Folkol joined
22:39 abhiroop joined
22:40 scottschmidt1 joined
22:41 bbrodriguez joined
22:42 abhiroop joined
22:43 jao joined
22:44 pranz joined
22:45 xlei joined
22:46 philippD joined
22:48 saurabhnanda joined
22:49 roconnor joined
22:51 saurabhn_ joined
22:51 amar joined
22:52 bbrodriguez joined
22:53 saurabhnanda joined
22:54 pie__ joined
22:55 oisdk joined
22:57 andyhoang1 joined
22:57 abhiroop joined
22:57 Lynxium joined
23:01 shadowdaemon joined
23:02 kvda joined
23:03 rasusto_ joined
23:04 fizbin joined
23:04 Spektrum joined
23:07 scottschmidt joined
23:09 WhatisRT joined
23:12 chao-tic joined
23:17 ian_andrich_ joined
23:18 lainon joined
23:21 jollygood2 joined
23:23 <butterthebuddha> What is the purpose of MonadState and MonadError etc?
23:23 korans joined
23:24 <dmwit> jollygood2: Can you just consume the `"three"` and tell your next parser about it?
23:24 <dmwit> butterthebuddha: To reduce the amount of `lift` needed to write code in a transformer stack.
23:24 Linter joined
23:25 <Solonarv> also, to let you write functions that don't need to know exactly which concrete transformer stack they'll end up running in
23:26 <Solonarv> e.g. I can write statefulThingy :: MonadState Thing m => Foo -> m Bar; barToOtherThing :: MonadError SomeError m => Bar -> m OtherThing
23:27 connrs joined
23:27 <Solonarv> and then `statefulThingy foo >>= barToOtherThing` Just Works (tm)
23:27 AfC joined
23:30 abhiroop joined
23:30 jollygood2 joined
23:32 <jollygood2> dmwit I think could make that work. so just ditch lookAhead I guess?
23:34 silver joined
23:39 jollygood2 joined
23:41 <jollygood2> dmwit, still can't get it to work. changed definition to this: skipLinesUntil p = try p <|> (line >> skipLinesUntil p). it infinite loops when p fails to parse all the lines
23:42 caryoscelus joined
23:43 blankhart joined
23:44 Spektrum joined
23:45 beefjoe joined
23:46 AfC joined
23:53 nowhereman_ joined
23:54 YongJoon joined
23:55 jollygood2 joined
23:55 <jollygood2> I don't understand why it infinite loops. I expeted line parser to fail when eof is reached instead of continuing recursive calls
23:56 ammazza joined
23:56 jackdk joined
23:58 MoarSpaceFi joined