<     May 2017     >
Su Mo Tu We Th Fr Sa  
    1  2  3  4  5  6  
 7  8  9 10 11 12 13  
14 15 16 17 18 19 20  
21 22 23 24 _2_5 26 27  
28 29 30 31
00:01 MarioBranco joined
00:02 infinity0 joined
00:03 <Sonolin> mniip maybe something like
00:03 <Sonolin> > (,) <$> Pure 5 <*> Pure 6
00:03 <lambdabot> error:
00:03 <lambdabot> • Data constructor not in scope: Pure :: Integer -> f a1
00:03 <lambdabot> • Perhaps you meant variable ‘pure’ (imported from Control.Applicative)e...
00:03 <mniip> no it's definitely not the Applicative instance
00:03 <Sonolin> oh ok
00:03 <angerman> joeyh: ohh. so you mean I haven't been clear enough about actually *having* a solution? And just made it sound like it's a dead end?
00:03 dni joined
00:03 zcourts_ joined
00:04 <mniip> Sonolin, actually
00:04 <mniip> I'm looking for a thing for FreeT
00:04 Rotaerk joined
00:04 markasoftware joined
00:05 infinity0 joined
00:06 jleon joined
00:08 infinity0 joined
00:08 wroathe joined
00:09 justan0theruser joined
00:09 <mniip> hmmm
00:09 jleon joined
00:09 mizu_no_oto joined
00:09 <mniip> doesn't look like I can get away with an Applicative
00:10 infinity0 joined
00:11 infinity0 joined
00:12 rey_grr joined
00:14 darjeeli1 joined
00:14 kadoban_ joined
00:14 osa1 joined
00:14 osa1 joined
00:15 alx741 joined
00:15 saussure joined
00:16 dbmikus joined
00:18 plutoniix joined
00:18 <* hackage> mellon-core 0.7.1.1 - Control physical access devices https://hackage.haskell.org/package/mellon-core-0.7.1.1 (dhess)
00:19 <* hackage> mellon-gpio 0.7.1.1 - GPIO support for mellon https://hackage.haskell.org/package/mellon-gpio-0.7.1.1 (dhess)
00:20 <* hackage> mellon-web 0.7.1.1 - A REST web service for Mellon controllers https://hackage.haskell.org/package/mellon-web-0.7.1.1 (dhess)
00:21 halogenandtoast joined
00:22 lambda-11235 joined
00:22 brailsmt joined
00:22 gestone joined
00:23 <mniip> @tell edwardk why is (Functor f, Monad m) => Functor (FreeT f m), this inconveniences me slightly...
00:23 <lambdabot> Consider it noted.
00:23 <thang1> Learning about Kinds right now in Haskell From First Principles
00:23 <thang1> amExcite.gif
00:24 shangxiao joined
00:27 JoelMcCracken joined
00:28 wroathe joined
00:29 jleon joined
00:29 <lpaste> nshepperd pasted “zippy free” at http://lpaste.net/355823
00:29 <nshepperd> this is for Free, not FreeT though
00:30 <mniip> yeah
00:30 <mniip> very similar to what I have here
00:30 netheranthem joined
00:31 <mniip> dammit
00:31 <mniip> MonadPlus m => Alternative (FreeT f m)
00:32 <thang1> lol
00:32 <* hackage> zre 0.1.0.0 - ZRE protocol implementation https://hackage.haskell.org/package/zre-0.1.0.0 (srk)
00:32 <srk> ^^
00:33 <mniip> edwardk, did you just throw these together last second ;(
00:33 andyhuzhill joined
00:33 AfC joined
00:33 nighty-- joined
00:33 saussure joined
00:33 <lpaste> nshepperd annotated “zippy free” with “zippy free (annotation)” at http://lpaste.net/355823#a355824
00:33 <thang1> srk: how do I see the documentation in this anyway? None of the modules have links
00:34 <srk> thang1: no idea why hackage does not generates it automatically
00:34 <thang1> I think it has to wait a second to generate it and then fill everything in
00:34 <srk> sometimes it doesn't appear on the page even after some time
00:35 latro`a joined
00:35 <glguy> srk: Looks like you forgot all the version bounds! Also hackage can't build zeromq, so you'll need to upload the docs yourself
00:35 <srk> aah, ok
00:35 <glguy> srk: You can use this https://github.com/ekmett/lens/blob/master/scripts/hackage-docs.sh
00:36 <srk> glguy: I spend a lot of time deleting upper bounds from upstream projects just to compile in newer stack snapshot /o\
00:36 <mniip> ugh
00:36 <srk> reminds me that I need to send few pull requests as well
00:36 <mniip> what was the applicative mapM in traversable
00:37 <mniip> oh
00:37 <mniip> traverse
00:37 <mniip> that's what it is of course
00:37 <glguy> srk: as long as you don't have any users it won't matter, but it passes the responsibility of figuring out how to get your project building onto them
00:37 <srk> glguy: well I'll try to keep it up to shape with CI, also there's stack.yaml with specific snapshot
00:38 primal_ joined
00:38 <mniip> dammit
00:38 <mniip> the Traversable for FreeT is unnecessarily bound too
00:38 <glguy> srk: the stack.yaml doesn't help if you intend people to use this as a library
00:38 tommd joined
00:38 <EvanR> once again users are the problem
00:38 <srk> ah, ok
00:39 texasmynsted joined
00:40 takle joined
00:40 <srk> glguy: will work on that, also docs need improvement.. but I've wanted to release this already as it's quite usable even in current form
00:43 saussure joined
00:43 <glguy> if you do figure out what versions of things you intend to support, make sure you go back and update this one with the knowledge (or make it impossible to build). Otherwise when other versions conflict the solver will often attempt to just use this early release with no constraints when asked to use your package (just something that happens in general)
00:44 <EvanR> which way is foldables' monoid merging biased
00:45 <EvanR> x <> accum, accum <> x ...
00:45 alx741 joined
00:45 <* hackage> lackey 0.4.3 - Generate Ruby clients from Servant APIs. https://hackage.haskell.org/package/lackey-0.4.3 (fozworth)
00:45 <thang1> Instinctively, I guess right because everyone tends to stick the ugly stuff and errors and such in the left
00:45 stevenxl joined
00:46 <EvanR> which way is right seems to depend on the monoid
00:46 <thang1> Whichever bias allows it to deal with infinite structures is the one I would guess :p
00:46 <EvanR> could be either
00:47 <EvanR> :t foldMap
00:47 <lambdabot> (Monoid m, Foldable t) => (a -> m) -> t a -> m
00:47 <EvanR> > foldMap id [[1],[2],[3]]
00:47 <lambdabot> [1,2,3]
00:48 <EvanR> so be it
00:49 wroathe joined
00:49 markasoftware joined
00:49 jleon joined
00:50 chao-tic joined
00:52 lamduh joined
00:52 saussure joined
00:53 filterfish joined
00:54 gaze__ joined
00:55 <Sonolin> is there a good SQL abstraction library that doesn't use TH?
00:58 TheFuzzball joined
00:59 <* hackage> final-pretty-printer 0.1.0.0 - Extensible pretty printing with semantic annotations and proportional fonts https://hackage.haskell.org/package/final-pretty-printer-0.1.0.0 (dchristiansen)
00:59 wroathe joined
01:00 Zialus joined
01:02 vaibhavsagar joined
01:03 |sync| joined
01:03 rblaze joined
01:04 <* hackage> chronologique 0.2.1.0 - Time to manipulate time https://hackage.haskell.org/package/chronologique-0.2.1.0 (AndrewCowie)
01:04 davr0s joined
01:06 <mniip> hmmm
01:06 <mniip> is that even a thing
01:06 mac10688 joined
01:07 <thang1> look inside yourself. Find the time bender within you. Reach deep within the void... (and turn off your alarm clock)
01:08 <mniip> I think it is possible...
01:08 qapla_org joined
01:10 <thang1> mniip: in regards to the SQL question or the chronologique library?
01:10 <mniip> neither
01:10 saussure joined
01:10 <mniip> the Applicative m => Applicative (FreeT f m)
01:10 <thang1> oooh right, still stuck on that
01:11 <mniip> I was about to make a pull request to 'free' thinking "this is trivial to write"
01:11 <mniip> it was not
01:11 mizu_no_oto joined
01:12 jleon joined
01:13 darlan joined
01:13 jedws joined
01:13 systadmin joined
01:15 mjs2600 joined
01:17 jleon joined
01:17 tromp joined
01:18 <EvanR> mniip: it does work for the Iter monad
01:18 <mniip> Iter = ?
01:18 <EvanR> IterT ~ FreeT Identity
01:19 <EvanR> https://hackage.haskell.org/package/free-4.12.4/docs/Control-Monad-Trans-Iter.html
01:19 <mniip> I don't see a reason it shouldn't
01:19 wroathe joined
01:19 torgdor joined
01:19 <EvanR> me neither
01:20 <mniip> for an Applicative m, IterT m sounds Applicative
01:20 <lamduh> is there a good beginner haskell book that has excercises. learn you a haskell doesnt have any official problems
01:21 <Cale> lamduh: That's generally the problem. Hutton's book has some. The various CIS 194 course materials have a bunch.
01:21 Costar joined
01:21 jleon joined
01:21 bjobjo joined
01:21 <EvanR> oh when m is applicative...
01:21 <lamduh> so cis 194 is a good place to learn?
01:22 <Cale> yeah, I particularly recommend Brent Yorgey's edition of the course
01:22 <lamduh> thanks
01:22 <Cale> http://www.cis.upenn.edu/~cis194/spring13/
01:22 <mniip> ah-ha!
01:23 <lamduh> thanks
01:23 torgdor joined
01:23 <thang1> My favorite book is the Haskell From First Principles book, but the CIS194 course is probably the best free resource for now. It's a bit quick and I had trouble with it when I first tried it out
01:23 <mniip> go (Free f) x = Free (fmap (FreeT . fmap (`go` x) . runFreeT) f)
01:23 <mniip> however I'm not sure that's lawful...
01:23 <Cale> edwardk: (Mildly offtopic) Do you know if there's any work extending stochastic lambda calculi with dependent types?
01:24 <Cale> (you just seem like you might know :)
01:24 lambdamu joined
01:25 <lpaste> mniip pasted “(Functor f, Applicative m) => Applicative (FreeT f m)” at http://lpaste.net/355825
01:25 <mniip> anyone care to look?
01:25 conal joined
01:25 <Cale> It typechecks? Ship it.
01:25 <thang1> Why the inline pragma?
01:25 <mniip> it came from the original code
01:25 <thang1> ah okay
01:26 <Cale> I can't imagine it being all that important, but who knows.
01:26 <Cale> I would usually expect GHC to inline something that small on its own
01:26 <thang1> "It typechecks? Ship it" <-- agreed :p
01:26 <mniip> Cale, I see at least one different implementation that typechecks
01:26 <mniip> it, however, does not agree with `ap`
01:27 <thang1> Although I am somewhat wary of random inline pragmas after I read that article about how an inline pragma actually reduced speed by a ton
01:28 saussure joined
01:28 path[l] joined
01:29 halogenandtoast joined
01:29 <mniip> oh no
01:29 <mniip> I broke it
01:29 <Cale> mniip: Well, you can always swap the order of effects of the "function" and "argument"
01:30 <mniip> nope it's not about swapping
01:30 <mniip> it's about sharing
01:31 cpennington joined
01:32 <mniip> > FreeT [Free [FreeT [Pure id]]] `ap` FreeT [Pure "foo", Free [FreeT [Pure "bar"]]]
01:32 <mniip> FreeT [Free [FreeT [Pure "foo",Free [FreeT [Pure "bar"]]]]]
01:32 <mniip> > FreeT [Free [FreeT [Pure id]]] <*> FreeT [Pure "foo", Free [FreeT [Pure "bar"]]]
01:32 <mniip> FreeT [Free [FreeT [Pure "foo"]],Free [FreeT [Free [FreeT [Pure "bar"]]]]]
01:34 mizu_no_oto joined
01:34 <thang1> I think you broke the bot
01:35 indi__ joined
01:36 thekyriarchy joined
01:38 wroathe joined
01:38 chao-tic joined
01:38 gestone joined
01:41 andyhuzhill joined
01:41 mizu_no_oto joined
01:42 kaychaks joined
01:42 Welkin joined
01:43 plugin joined
01:44 WhiskyRyan joined
01:45 <mniip> hmmm
01:45 renzhi joined
01:46 saussure joined
01:47 jleon joined
01:47 liyang joined
01:47 <plugin> I'm trying to write some data to the audio buffer using the Audio.Jack package but my program keeps throwing "testAccSynth.hs: printf: argument list ended prematurely" when I run it. I can't find any code locally or in Audio.Jack that calls printf, can anyone advise on how I might proceed debugging?
01:48 skrnnm joined
01:50 sproingie joined
01:53 <suzu> try ./binary +RTS -xc
01:53 cdg joined
01:54 revtintin joined
01:54 <mniip> so it seems, that 'FreeT (return (Pure id)) <*> x = x'
01:54 joco42 joined
01:55 <mniip> yes 'FreeT (return (Free f)) <*> x = FreeT (return (Free ...))'
01:55 <mniip> yet*
01:56 saussure joined
01:56 <mniip> so it follows that I must 'bind' the contents of the first FreeT in order to determine the 'shape' of the contents of the resulting FreeT
01:56 <mniip> and Applicative is not enough
01:57 flatmap13 joined
01:57 afarmer joined
01:58 indi_ joined
01:58 wroathe joined
01:59 saussure joined
02:00 hucksy joined
02:00 saussure joined
02:01 gugah joined
02:02 primal joined
02:02 cschneid_ joined
02:02 jleon joined
02:03 AerialBoundaries joined
02:05 Reshi joined
02:08 tefter joined
02:08 Goplat joined
02:10 Amadiro- joined
02:10 Johan_Meh joined
02:13 <* hackage> camh 0.0.3 - write image files onto 256(or 24bit) color terminals. https://hackage.haskell.org/package/camh-0.0.3 (HironaoKomatsu)
02:13 johnw joined
02:14 <mniip> hmm
02:14 <mniip> curious
02:14 wroathe joined
02:14 <mniip> Yoctoparsec's Parser has the same *structure* as FreeT Reader
02:14 <mniip> but different instances
02:16 <Rotaerk> hmm now to figure out how to implement (a -> Maybe b) -> Consumer b m r -> Pipe a a m r
02:17 Bare joined
02:19 <johnw> just a guess, but: \f c -> for cat (\a -> forM_ (f a) $ \b -> c b)
02:19 <Welkin> toctoparsec? o.o
02:19 <Welkin> yoctoparsec*
02:19 <johnw> oh, and a yield in there to pass it down the pipe too
02:19 <Welkin> lol mniip
02:19 <Welkin> it's your library
02:19 systadmin joined
02:20 drewbert joined
02:20 indi_ joined
02:20 <mniip> Welkin, I just decided to write some nontrivial combinators for it
02:21 geekosaur joined
02:21 <mniip> more nontrivial than 'token' as closed under MonadPlus
02:21 primal joined
02:21 <sproingie> chocoparsec
02:21 <mniip> and then everything hit me
02:21 louispan joined
02:22 <mniip> I can't even write a '(Alternative b, Eq t) => [t] -> Parser b t [t]'
02:22 jleon joined
02:22 <mniip> everything wants a Monad constraint on b
02:23 <Rotaerk> johnw, well you make it look easy >_>
02:25 <Rotaerk> I don't have an intuitive enough grasp of pipes yet to just whip out a solution
02:25 andyhuzhill joined
02:25 <johnw> that's what we're here for :)
02:25 <Rotaerk> heh
02:26 <johnw> the "for cat" thing is pretty idiomatic, and appears in the pipes libraries rather often
02:26 <johnw> the forM_ is just Foldable making the Maybe easier to unpack
02:27 <lyxia> meow
02:27 <johnw> oh, 'c b' probably isn't right, you might need a specific commit to submit to the consumer
02:27 felixphew joined
02:27 <Rotaerk> the a should only be yielded from the pipe if it's *not* converted to a b
02:27 <johnw> ah, then you want a case
02:27 <Rotaerk> calling this partialConsume or something
02:27 <felixphew> how does one change state in alex?
02:27 <johnw> i see
02:27 <johnw> you want to steal things from the input
02:27 <felixphew> the examples aren't making it very clear
02:27 <Rotaerk> yep
02:28 <Rotaerk> my goal is to fork the stream into two consumers
02:28 <Rotaerk> so my strategy is to partially consume it with one, then with another
02:28 <Rotaerk> (and extensible to N consumers)
02:30 <lyxia> mniip: it looks like these Monad constraints are there for pre-AMP compatibility, at least
02:31 darjeeli1 joined
02:31 <mniip> nope
02:32 <mniip> not all of them
02:32 andyhuzhill joined
02:32 <mniip> ah
02:32 <mniip> ahhhh
02:32 <mniip> I see
02:32 Koterpillar joined
02:33 ertes joined
02:33 <lyxia> Actually you could also add Functor constraints everywhere
02:34 zeonic98 joined
02:34 <zeonic98> Hi all
02:34 wroathe joined
02:34 sleffy joined
02:34 <zeonic98> How is everyone
02:35 <felixphew> pretty good
02:37 <zeonic98> I'm pretty sure I'm in the wrong channel
02:38 <zeonic98> But maybe you could point me in the correct direction of that's cool
02:38 <MarcelineVQ> It's pretty cool here
02:39 <Axman6> zeonic98: what're you after?
02:39 <zeonic98> I wondered if there was such thing as a disabled room.
02:40 <zeonic98> I'm trying to find some people that have Parkinson's
02:41 primal_ joined
02:41 plutoniix joined
02:41 takle joined
02:41 <zeonic98> That aside. Is there a topic here or can we talk about anything?
02:41 <johnw> the topic is Haskell
02:41 <johnw> there are other channels for more general chat
02:42 <Rotaerk> zeonic98, what I'm curious about is how you found this channel and didn't know what it was about
02:42 <zeonic98> That I can answer.
02:42 <zeonic98> I googled helpful freenode chat
02:42 <Rotaerk> hahah
02:42 jleon joined
02:42 <Rotaerk> yes, this place is quite helpful
02:43 <Rotaerk> just focused on a specific subject
02:43 <Rotaerk> also, (for cat) seems very similar to (await >>=), just slightly less general
02:43 <zeonic98> So it's a programming language?
02:43 <Rotaerk> yes
02:43 <kadoban> #freenode might be a decent place to start, though I'm not sure what actual big just plain chat channels there are. Freenode is focused towards kind of software projects and etc. quite a lot.
02:44 CoderPuppy joined
02:44 <zeonic98> Okay I'll try that.
02:44 <mniip> freenode isn't here for general chat, so don't expect to find a good channel
02:44 wroathe joined
02:45 <zeonic98> Tbh I've never used it until now for general chat
02:45 indi_ joined
02:46 <zeonic98> Mostly for tech advice when I'm stuck with Linux questions or #scripts etc
02:46 primal joined
02:46 macalinao joined
02:46 jleon joined
02:47 <Rotaerk> err wait no... similar signature, but await >>= only happens once...
02:47 exferenceBot joined
02:49 <mniip> zeonic98, ##linux is a channel that exists
02:49 <mniip> so is ##programming
02:49 <mniip> and many more
02:49 <Welkin> and ##freenode
02:49 <zeonic98> Thanks. I've used them before. Very helpful
02:50 chao-tic joined
02:50 <Welkin> don't forget about mniip's favorite #lua
02:50 <mniip> times have changed
02:51 primal joined
02:51 Koterpillar joined
02:52 path[l] joined
02:52 Sh4rPEYE joined
02:52 afarmer joined
02:52 hexagoxel joined
02:53 segmond joined
02:53 justanotheruser joined
02:54 michbad joined
02:55 Jeanne-Kamikaze joined
02:56 yellowj joined
02:56 andyhuzhill joined
02:57 <zeonic98> Nothing out there, anyone bored and fancy a chat
02:58 jmcarthur joined
02:58 <glguy> zeonic98: This is the wrong channel for find general chat
02:59 <zeonic98> Yeah I know. Sorry. People are more friendly here. I'll clear off.
03:00 mizu_no_oto joined
03:00 <johnw> Rotaerk: await >>= will only get one value from the input, unless you use recursion or some kind of looping construct
03:00 CoderPuppy joined
03:01 Reshi joined
03:01 primal_ joined
03:01 WhiskyRyan joined
03:01 andromeda-galaxy joined
03:03 yellowj joined
03:05 Fairy joined
03:06 srh joined
03:06 indi_ joined
03:06 primal joined
03:07 jleon joined
03:07 <thang1> damnit, I was gonna reply to him but I was too late
03:08 <thang1> there's a #medicalschool irc on irc.snoonet.org that he might look into and there's #casualConversation on irc.snoonet.org that's entirely for, well, casual conversation
03:08 <glguy> No, that wouldn't be on topic
03:08 <thang1> Well it's about as ontopic as mentioning the existence of ##programming :p
03:10 brynedwards joined
03:11 sleffy joined
03:12 felixsch_ joined
03:12 jleon joined
03:15 jleon joined
03:16 tommd joined
03:17 Jeanne-Kamikaze joined
03:17 Koterpillar joined
03:18 wroathe joined
03:20 <* hackage> yahoo-finance-api 0.2.0.2 - Read quotes from Yahoo Finance API https://hackage.haskell.org/package/yahoo-finance-api-0.2.0.2 (cdepillabout)
03:20 coltfred_ joined
03:20 mjora7 joined
03:21 Costar joined
03:21 primal_ joined
03:22 zeonic98 joined
03:22 <zeonic98> Hi all. Me again. Google is correct this is the most helpful channel
03:22 <thang1> hey!
03:22 <zeonic98> Hi
03:23 gestone joined
03:23 <thang1> Here I'll query you so we're not clogging up the main channel
03:24 AbelianGrape joined
03:24 ertesx joined
03:24 pavonia joined
03:25 aarvar joined
03:25 <AbelianGrape> Is there any typeclass that will tell me the cardinality of a type? E.g. it should give me 2^64 for Int64 or Word64, 2^8 for Word8 or Int8, etc.
03:25 <dmj`> > maxBound :: Int
03:25 beerdrop joined
03:25 <lambdabot> 9223372036854775807
03:26 <AbelianGrape> dmj`: That doesn't tell me the total number of inhabitants of the type.
03:26 <AbelianGrape> I guess I could do maxBound - minBound
03:27 <thang1> https://hackage.haskell.org/package/Cardinality
03:27 <AbelianGrape> Wow, that's a lot more involved than I expected
03:27 <thang1> Don't think that's exactly what you wanted, but it's something!
03:27 <kadoban> > maxBound - minBound :: Int8
03:27 <nshepperd_> That package seems like a different thing
03:28 <lambdabot> -1
03:28 <AfC> There's an Enum instance, you could walk all the values and count. Especially if it's cold where you are, good excuse to run the CPU to heat up the place.
03:28 <AbelianGrape> kadoban: You would have to translate to a larger type first
03:28 <kadoban> Yes
03:28 juanpaucar joined
03:28 wroathe joined
03:28 <AbelianGrape> > (fromIntegral (maxBound :: Int8) :: Int64) - (fromIntegral (minBound :: Int8) :: Int64)
03:28 <lambdabot> 255
03:29 <AbelianGrape> Ah, +1
03:29 indi_ joined
03:29 <mniip> AbelianGrape, what would you want for Double?
03:30 <mniip> 2^64-1 ?
03:30 <kadoban> AbelianGrape: Note that that's actually off by one too.
03:30 <mniip> 2^64-1-2^53?
03:30 <AbelianGrape> mniip: Nothing. Double wouldn't make sense for this application
03:30 <AbelianGrape> Would only be required for integral types
03:30 <mniip> so you're only interested in primitive int/word types
03:31 <mniip> then fromIntegral maxBound/minBound is the way to go
03:31 Koterpillar joined
03:31 <AbelianGrape> Not necessarily. data Foo = A | B | C | D would work too
03:31 eklavya joined
03:31 <kadoban> Anything that's Enum and Bounded should be fairly easy I think
03:31 <AbelianGrape> Good thinking
03:32 mbuf joined
03:35 louispan joined
03:37 sproingie joined
03:37 primal joined
03:38 wroathe joined
03:38 juhp joined
03:38 hybrid joined
03:40 _sras_ joined
03:41 lamduh joined
03:41 conal joined
03:42 sproingie joined
03:44 <_sras_> Using Swagger, How can I add a description to an api endpoint? Can I do it from the endpoint's type signature itself?
03:44 yamad joined
03:46 dihuteno joined
03:47 Koterpillar joined
03:49 ianandrich joined
03:49 wroathe joined
03:50 indi_ joined
03:53 primal joined
03:53 jleon joined
03:54 Johan_Meh joined
03:58 jleon joined
03:58 wroathe joined
03:59 <jle`> ph88: yes that is me :)
03:59 <dmj`> _sras_: servant swagger?
03:59 <dmj`> _sras_: iirc you can annotate api description endpoints with lenses in the main swagger type
04:00 otto_s joined
04:00 <_sras_> dmj`: Yes. I see I can do something like this https://github.com/GetShopTV/swagger2/blob/73c4c7775e6dbe3f88ab69142d113dd6548a6d01/examples/hackage.hs#L65-L82
04:01 <_sras_> dmj`: But I have an existing schema generated from the api type. I want to add descriptions to the existing endpoint, instead of adding them from scratch, like that code seems to be doing...
04:03 <dmj`> _sras_: servant-swagger is meant for producing a new swagger document from a servant api description. Swagger is strictly more expressive than what we have at the type-level available to us in servant, so the lens annotations are necessary. What you’re proposing is that we generate servant type level definitions from a quasi quoter that contains the
04:03 <dmj`> swagger spec. There’s been talks about this, but no movement.
04:06 <dmj`> Your options are 1) wait a few years for dependent haskell, 2) write the library the generates haskell from a swagger spec. 3) try to remake your current swagger spec in haskell
04:06 <dmj`> that*
04:10 <thang1> dmj`: do you think dependent types can be used in a functional logic language?
04:10 <Axman6> _sras_: take a look at https://github.com/data61/bom-solar-webservice/blob/master/app/Main.hs#L195 to see how to add information to the automatically generated docs
04:11 meba joined
04:11 path[l] joined
04:12 <dmj`> _sras_: it works via tags iirc, https://gist.github.com/dmjio/d35b2254803490ebe6c07b251077d4c4
04:12 <dmj`> _sras_: you can’t do it inline
04:12 <dmj`> if that’s what you’re referring to
04:13 <dmj`> thang1: #idris is an example of dep. types in a functional language
04:13 infinity0 joined
04:14 <thang1> Idris doesn't have any logic facilities in it though
04:15 <thang1> I'm talking about functional logic languages such as Curry (a blending of narrowing strategies a-la Prolog combined with fp)
04:16 systemfault joined
04:16 systemfault joined
04:17 codygman joined
04:17 <dmiles> thang1: i came ot the same conclusion abotu Idris :(
04:18 <codygman> Is there a way to write this with higher order functions? My mind is stuck on something like foldMap fold
04:18 <codygman> http://lpaste.net/355827
04:18 SpinTensor joined
04:20 shangxiao joined
04:21 <andromeda-galaxy> codygman: trying to get a handle on what this is doing... just out of curiosity, logically speaking, why does go add acc to the output list every time it recurses?
04:21 <andromeda-galaxy> and why is there a separate case for [x] vs. (x:xs)?
04:22 <johnw> codygman: if this gets any bigger, just use fgl
04:22 heurist joined
04:23 wroathe joined
04:23 <andromeda-galaxy> seconded! this kind of graph is a good fit for fgl
04:23 <codygman> johnw: I thought fgl might be appropriate, but I had a hard time figuring out how to use it since I haven't used graphs much in general. I suppose I was trying to learn graphs (to some extent) and how to use FGL. Thanks for the recommendation.
04:23 mjora7 joined
04:24 <andromeda-galaxy> codygman: also afaict in no recursive call to go does acc ever get added to. So acc is always []?
04:24 <codygman> andromeda-galaxy: It has [x] for singleton calls and (x:xs) for when multiple items are in the list
04:25 <andromeda-galaxy> codygman: [x] = (x:[])
04:25 <andromeda-galaxy> is there a logical reason why singletons are different?
04:26 <johnw> codygman: I use it for lots of things
04:26 bydo joined
04:26 <codygman> andromeda-galaxy: I'm quite tired and barely managed to get this to work. I tried taking out my singleton case and only "b" was returned. I'm not sure ATM i can elaborate more on that particular point beyond "I get the right results as written, but removing that case gives the wrong one".
04:26 <johnw> insEdges [...] (insNodes [...] empty)
04:26 <codygman> johnw: Alright, I'll check out the docs again and see if they resonate with me after coming back to them
04:27 <johnw> then you can dfs or bfs to get the nodes in some order, and use context, or query, to look at the successors and predecessors
04:27 modi123_1 joined
04:27 <andromeda-galaxy> codygman: okay, hmm. I'm not quite sure whether or not that code is exactly what you were hoping for though
04:28 <andromeda-galaxy> (q: does this work: getRevDeps = concatMap (concatMap getRevDeps . getRevDep)
04:28 <andromeda-galaxy> )
04:28 <andromeda-galaxy> codygman: ^
04:28 <andromeda-galaxy> (assuming the idea is that getRevDeps "a" gives the transitive dependencies of a, where getRevDep gives the immediate ones
04:28 afarmer joined
04:30 <codygman> andromeda-galaxy: Expected type: [Char] -> [b]; Actual type: [[Char]] -> [b]
04:31 <andromeda-galaxy> oops sorry hang on one second
04:32 <andromeda-galaxy> codygman: I means concatMap getRevDeps . getRevDep
04:32 juanpaucar joined
04:33 <andromeda-galaxy> oh wait I see why that won't work
04:33 <andromeda-galaxy> nvm
04:33 wroathe joined
04:33 <Welkin> isn't concatMap just >>=?
04:33 <Welkin> :t concatMap
04:33 <lambdabot> Foldable t => (a -> [b]) -> t a -> [b]
04:33 <Welkin> :t (>>=)
04:33 <lambdabot> Monad m => m a -> (a -> m b) -> m b
04:33 <Welkin> er
04:33 <Welkin> :t (=<<)
04:33 <lambdabot> Monad m => (a -> m b) -> m a -> m b
04:34 <andromeda-galaxy> Welkin: it works on inputs that are traversable not monad maybe? also I usually figure if there is a well named alias for bind, might as well use it
04:34 Scip joined
04:34 <codygman> johnw: Embarassingly enough it seems my issue not understanding fgl was not remembering what edges were :S
04:34 <johnw> do you know now?
04:34 <Welkin> I'd love to use graphs more often
04:34 <Welkin> I never have a use case for them
04:35 <codygman> johnw: The links between nodes I believe
04:35 <EvanR> everythings a graph!
04:35 <johnw> nodes are just numbers, and edges are just pairs of numbers
04:35 <andromeda-galaxy> codygman: do you care that the output is bfs and not dfs
04:35 jleon joined
04:35 <Welkin> it's almost always Map/Set or Array/Sequence
04:35 <johnw> the "meaning" is that nodes [1,2] and edges [(1,2)] is a graph of two points with a directional line between them
04:35 <johnw> i use fgl quite a lot, but usually for analyzing programs
04:36 <codygman> andromeda-galaxy: Yes, I have an application that has dependencies. Basically I'm using this to find all reverse dependencies and then signal when the entire chain has completed.
04:36 <EvanR> theres a lot more out their the objects and arrays
04:36 <EvanR> than
04:36 <EvanR> there
04:36 <codygman> johnw: Thanks, that simple visualization helps quite a bit.
04:36 <andromeda-galaxy> codygman: ah okay. if it does work with dfs instead then the "obvious" HOF version of getRevDeps is probably concatMap (\x -> x:getRevDeps x) . getRevDep
04:37 <andromeda-galaxy> but that makes ["b","c","f","d","g","e"]
04:37 <johnw> codygman: fgl allows you to place arbitrary "labels" on both nodes and edges, which is how you associate real information with the graph elements
04:37 <andromeda-galaxy> (but yeah, listen to johnw, fgl is the right thing to use)
04:38 <codygman> andromeda-galaxy: I don't mind the order, I end up just doing: all (== Done) . map getAppStatusByName $ ["b","c","f","d","g","e"] anyway
04:39 <andromeda-galaxy> codygman: do you mean by that that you hardcoded the dependencies in?
04:40 <andromeda-galaxy> but anyway I think the snippet I tossed up a minute ago is a reasonable answer to "what's a HOF way of finding transitive revdeps given this thing"
04:40 gestone joined
04:40 <andromeda-galaxy> if you want pointfree you can use uncurry () . (id &&& getRevDeps) instead of the lambda
04:40 <codygman> andromeda-galaxy: No, I was meaning to imply the code used to generate the ["b","c","f","d","g","e"] is getRevDepsByName "a", so the full code would be: all (== Done) . map getAppStatusByName $ getRevDepsByName "a"
04:40 <andromeda-galaxy> oh I see that makes more sense
04:41 <andromeda-galaxy> how did you impleent getRevDepsByName?
04:41 <andromeda-galaxy> (it sounds like maybe the same as my getRevDeps?)
04:41 <codygman> andromeda-galaxy: concatMap (\x -> x: getRevDeps' x) . getRevDep -- ;)
04:42 takle joined
04:42 <andromeda-galaxy> cool, I'm glad if my commentary could push you on the right track ;-)
04:42 Sh4rPEYE joined
04:43 <codygman> johnw: I almost wish the dependency chains I was dealing with were large enough to nudge me a bit more to learn/use fgl... the library looks awesome. Time is limited though :/
04:43 <codygman> andromeda-galaxy: Yep, that will work for me. Thanks!
04:43 <johnw> codygman: tell me what you want, and I'll code it for you
04:43 <andromeda-galaxy> np!
04:43 <johnw> for data input, DOT files is pretty ideal
04:43 <johnw> if you don't already have a format
04:44 <codygman> well, I have a response from chronos which is in csv format. One second I can give a sample.
04:44 <johnw> i'll leave the input parsing to you, just tell me the type of the analysis function you want
04:44 <johnw> and how its output should relate to its input
04:48 <halogenandtoast> Crazy question if anyone knows Spock (or Scotty, or Wai) If I want to have my server handle multiple domains which might have different TLS certs, is that possible
04:48 <codygman> johnw: I'm unsure how to describe it. Perhaps this is enough. The csv data I parse turns into: [("Node","app-name1"),("Node","app-name-2"),("Link", "app-name1", "app-name2")]
04:48 <halogenandtoast> I haven't messed with SSL at all with these and I don't want to dig a big hole if all I'm going to find is dead bodies.
04:48 <andromeda-galaxy> halogenandtoast: I'm 99% sure that WAI can handle SNI...
04:49 <johnw> codygman: ok, that works
04:49 <johnw> codygman: and you just want reverse dependency order
04:49 <codygman> johnw: In that case I would only want app-name-2, but frequently there are many links for a single node. Yes, reverse dependency order. Thanks!! :)
04:49 <johnw> I assume it's [("Link", ["app-name1", "app-name2"])]
04:50 <johnw> ok, give me a few mins
04:50 <codygman> johnw: Yes, you are correct. I'm sorry.
04:50 <halogenandtoast> andromeda-galaxy: I'm gathering that as well.
04:50 <halogenandtoast> hmm
04:51 <halogenandtoast> I suppose my question is whether or not it's possible to use multiple certs depending on the domain coming in.
04:52 <andromeda-galaxy> isn't that the point of SNI? On each domain, you can serve the correct cert before the HTTP part of the connection gets going
04:52 <Lokathor> so if I pick the Lazy StateT to start, will that somehow bite me hard later?
04:53 <halogenandtoast> andromeda-galaxy: sorry I read "can handle SSL"
04:54 <johnw> codygman: ok to use lens, or no?
04:54 <andromeda-galaxy> although warp-tls may not be supporting sni as well as the underlying tls library does
04:56 <andromeda-galaxy> halogenandtoast: keter apparently supports SNI now (https://github.com/snoyberg/keter/pull/144)so I would surmise ti is porbably possible... not sure exacty how though, sorry
04:57 <halogenandtoast> andromeda-galaxy: thanks for looking into it. This is at least a good start.
04:58 jleon joined
04:58 permagreen joined
04:58 jgertm joined
04:59 wroathe joined
05:00 SeMas joined
05:00 <codygman> johnw: Yes to lens
05:00 <johnw> nice
05:01 <codygman> johnw: I *think* I have a pretty good handle on lens, I use it pretty often for json parsing.
05:01 <codygman> and Prisms for AST's
05:02 <andromeda-galaxy> halogenandtoast: one other thing btw: Network.TLS supports sending Credentials based on the HostName freceived via SNI (look at ServerHooks in Network.TLS). But warp-tls doesn't support it, so you would have to use runSettingsConnection yourself and manually handle setting up the TLS
05:03 path[l] joined
05:03 armyriad joined
05:05 andyhuzhill joined
05:05 <halogenandtoast> andromeda-galaxy: seems complicated, but I'll have to give it a shot
05:06 <halogenandtoast> I wonder if I should just use a reverse proxy with nginx
05:06 <johnw> codygman: ok, done
05:06 liyang joined
05:07 <halogenandtoast> that way my app doesn't care.
05:07 <johnw> codygman: https://github.com/jwiegley/notes/blob/master/haskell/Codygman.hs
05:07 <johnw> probably nicer ways to do it, but that's the first approximation
05:07 <andromeda-galaxy> halogenandtoast: it's a ltitle bit nasty, but probably not *too* bad... you can probably copy most of runTLSSocket and runTLSSocket'
05:07 <Welkin> halogenandtoast: doesn't care about what?
05:07 <johnw> as you can see, the graph construction and deconstruction is really the least of it
05:07 <halogenandtoast> Welkin: doesn't care about the SSL certificate.
05:07 <Welkin> you could use nginx for that, but I use keter
05:07 <andromeda-galaxy> Welkin: halogenandtoast is writing a webapp that needs to serve on multiple domains with SNI
05:08 <Welkin> keter is pretty easy to set up
05:08 <codygman> johnw: Cool! Taking a look now
05:08 <halogenandtoast> Welkin: Yeah I'm looking in to Keter, I have to convince my infra team to use it though.
05:08 <andromeda-galaxy> nginx reverse proxies, keter now supports SNI, also the app code could set it pu itself, which is what I was pointing halogenandtoast at possibilities for
05:09 <andromeda-galaxy> johnw: niiiice...
05:09 <halogenandtoast> Oh btw Welkin I think I asked you about 301 redirects the other day...
05:09 <Welkin> yes
05:09 <halogenandtoast> I solved it
05:09 <Welkin> using wai or some spock builtin?
05:09 <halogenandtoast> https://github.com/halogenandtoast/mirin/blob/master/app/Main.hs#L77
05:10 <Welkin> okay
05:10 <Welkin> that looks like basically the same as responseLBS
05:10 Sh4rPEYE joined
05:10 <halogenandtoast> Yeah, I just couldn't figure out how to make responseLBS play nice.
05:11 <halogenandtoast> Probably similar, but I didn't find this code too troublesome
05:11 <halogenandtoast> Fairly easy to understand
05:11 <halogenandtoast> Welkin: I'm going to try keter for a personal application.
05:11 <Welkin> I didn't know Spock had those wrapper functions
05:11 <Welkin> that's similar to yesod as well
05:12 <halogenandtoast> Welkin: it's one of those things that made me remember why I occasionally love monads.
05:13 <halogenandtoast> I mean, if I knew better, I'd probably love them all the time.
05:13 <halogenandtoast> but I'm dumb and sometimes we fight a lot.
05:14 <Lokathor> @pl (\di -> return $ convertRGBA8 di)
05:14 <lambdabot> return . convertRGBA8
05:14 <Welkin> https://github.com/snoyberg/keter/blob/master/README.md
05:14 <Welkin> I found that helpful (along with the examples linked in there)
05:14 <halogenandtoast> I spent 10 minutes this morning trying to show off random numbers in ghci and I did let gen = newStdGen; print $ take 5 (randoms gen)
05:15 <halogenandtoast> I couldn't understand the error "No instance for (RandomGen (IO StdGen))"
05:15 <codygman> johnw: Oh wow, that's cool. Alright, guessing that context just gets the label?
05:15 <johnw> yeah
05:15 dec0n joined
05:15 NocnaShada joined
05:15 <johnw> and the map is because you can't lookup nodes from their label
05:15 <halogenandtoast> Welkin: yup I'll follow along, I have a simple Yesod app I have on digital ocean
05:15 <c_wraith> halogenandtoast: mostly that means you've got an extra IO in there.
05:15 <c_wraith> halogenandtoast: oh, you've probably figured it out now. :)
05:15 <halogenandtoast> c_wraith: right, I realized the problem eventually
05:15 ianandrich joined
05:16 <halogenandtoast> c_wraith: It was silly because I wrote the example in a hs file and ran runhaskell to show it working
05:16 <halogenandtoast> and blamed ghci
05:16 <halogenandtoast> When I wrote the hs file, I did it correctly.
05:16 meandi_2 joined
05:16 tommd joined
05:17 <Welkin> I tried to write a recursive fibonacci generator in purescript before remembering that purescript is strictly evaluated, so it exhausts the stack space
05:17 <halogenandtoast> ha oh no
05:17 <halogenandtoast> I've awarded myself some points for understanding your problem.
05:18 <Welkin> I take laziness for granted it seems
05:18 <halogenandtoast> It's a wonderful thing.
05:18 <johnw> codygman: even better would be to use freer-effects, but I figured that would be pushing it :)
05:18 <johnw> that's one of my new favorite libraries
05:18 <halogenandtoast> Alright, time to try out Keter.
05:19 wroathe joined
05:20 <Rotaerk> hmm, now instead of partial pipe transformers, like... (i -> Maybe i') -> Pipe i' o m r -> Pipe i o m r -> Pipe i o m r
05:20 <Rotaerk> and: (i -> Maybe i') -> Consumer i' m r -> Pipe i o m r
05:21 jleon joined
05:21 <Rotaerk> I'm considering something more like: (i -> DSum k Identity) -> DMap k SomePipeFrom -> Pipe i o m r
05:21 <Rotaerk> not really sure how that type should look exactly though
05:21 fakenerd joined
05:22 <Rotaerk> as in, the first function picks (via tagging) which pipe to pump it through
05:22 <Rotaerk> each pump can have different input, but must all produce the same output (o)
05:22 <Rotaerk> though maybe the partial way is better, simpler...
05:23 <johnw> I've heard so many sentences begin that way... ;)
05:23 <Rotaerk> which way
05:24 <johnw> maybe the partial way is better, simpler
05:24 <Rotaerk> oh :P
05:24 <Rotaerk> I think *using* the one with DMap might be nicer
05:24 <Rotaerk> maybe >_>
05:25 jleon joined
05:25 Bardusbasium joined
05:26 jgertm joined
05:27 zcourts joined
05:28 <Rotaerk> nah, would have to make a tag type for every use
05:28 <Rotaerk> even if I could get the type signature right
05:29 <c_wraith> you could make a single GADT tag type instead.. :P
05:29 wroathe joined
05:30 ericsagnes joined
05:32 watersoul joined
05:32 <halogenandtoast> c_wraith: thanks for reminding me that I still don't know why I use the GADT extension
05:32 <halogenandtoast> reading https://wiki.haskell.org/GADTs_for_dummies now
05:33 systemfault joined
05:33 <c_wraith> halogenandtoast: the key idea is that a GADT allows you to add more restrictions to the type of a data constructor, and recover that information when you match the constructor.
05:33 osa1 joined
05:34 <johnw> One thing that GADTs allow you to do is to qualify constructors
05:34 <johnw> yeah, what c_wraith said
05:34 <nshepperd> hmm, Data.Bits has an Eq constraint
05:34 <johnw> like, you could have constructor that are only allowed while a system is initializing, and others that can only happen after its done initializing
05:34 <nshepperd> a holdover from the Eq a => Num a days?
05:35 <nshepperd> I can't use it in my eDSL like that :(
05:35 kamog joined
05:35 tomboy64 joined
05:36 <Rotaerk> c_wraith, well, what I was thinking is that I would do something like... split (\case { Foo x -> ToFooPipe :=> Identity x; Bar y -> ToBarPipe :=> Identity y })
05:36 <halogenandtoast> c_wraith: I have no idea what that means yet, but soon :tm
05:36 <cocreature> nshepperd: I guess you could argue that they should be equal when all Bits are equal
05:37 juanpaucar joined
05:37 <Rotaerk> and then the next parameter would somehow be a DMap associating ToFooPipe with a Pipe expecting the type of the x, and ToBarPipe with a Pipe expecting the type of y
05:37 <Rotaerk> and thus routing each value to the right pipe
05:37 <kadoban> nshepperd: Does it have an infinite number of bits or something? Can't think what other cases Eq wouldn't make sense on
05:37 watersoul joined
05:37 <cocreature> kadoban: as soon as your type does not _only_ consist of bits and includes things like functions it can’t be Eq
05:37 tromp joined
05:38 <kadoban> Oh, right
05:38 <nshepperd> cocreature: well, the problem is that testBit and popCount are in there really
05:39 <nshepperd> you can't test the bits of an expression with free variables, even though all the 'productive' bitwise operations are applicabl
05:40 <nshepperd> this is like the difference between Num and Integral/Real
05:40 <codygman> Am I missing something, or can Data.Time.Format not parse this date with it's current formatters? 2014-03-08T16:57:17.507Z
05:41 <glguy> it can parse that
05:41 <cocreature> nshepperd: yeah splitting this up would have been nice
05:42 <cocreature> codygman: what problems are you running into?
05:45 eacameron joined
05:46 <* hackage> hackernews 1.1.2.0 - API for Hacker News https://hackage.haskell.org/package/hackernews-1.1.2.0 (DavidJohnson)
05:48 kantokomi joined
05:49 jhrcek joined
05:49 <codygman> cocreature: Well I *think* the 507Z in 2014-03-08T16:57:17.507Z is picoseconds or the %q modifier, but I don't think it supports modifying the length and only allows 12 characters of picosecond. I could be wrong on both counts.
05:49 <glguy> iso8601DateFormat (Just "%T%Q%Z")
05:49 <glguy> "%Y-%m-%dT%T%Q%Z"
05:50 <cocreature> codygman: it’s %Q not %q
05:51 <mniip> not nano?
05:52 brailsmt joined
05:53 <codygman> glguy, cocreature: Yep, this worked: parseTimeM True defaultTimeLocale "%Y-%m-%dT%T%Q%Z" "2014-03-08T16:57:17.507Z" :: Maybe LocalTime
05:54 <codygman> or using the iso8601DateFormat function: parseTimeM True defaultTimeLocale (iso8601DateFormat (Just "%T%Q%Z")) "2014-03-08T16:57:17.507Z" :: Maybe LocalTime
05:54 jluttine joined
05:54 <glguy> With the Z on the end it's meant to be a ZonedTime
05:54 <codygman> glguy: Oh, thanks. I didn't know. Well then here we go: parseTimeM True defaultTimeLocale (iso8601DateFormat (Just "%T%Q%Z")) "2014-03-08T16:57:17.507Z" :: Maybe ZonedTime
05:54 wroathe joined
05:55 <codygman> thanks for the help everyone, good night! :)
05:55 <halogenandtoast> Is there a Keter plugin for Hedis?
05:56 joco42 joined
05:58 primal_ joined
05:58 armyriad joined
05:59 <halogenandtoast> or a suggested path for adding a redis instance to my application.
06:00 mjora7 joined
06:00 <EvanR> does ~ ever do anything in let ~(Ctor p1 p2 p3) = expr in expr2 do anything
06:00 <EvanR> er minus the last two words
06:01 <johnw> it defers the deconstruction
06:01 <johnw> until you evaluate any of p1 p2 or p3
06:01 <EvanR> but...
06:01 <glguy> No, it doesn't do anything in a let binding
06:01 <EvanR> > let Just x = Nothing in 5
06:01 <lambdabot> 5
06:01 <EvanR> ok
06:01 <johnw> oh, nothing in let?
06:01 <EvanR> so let is always lazy
06:01 <EvanR> without bang
06:02 jleon joined
06:02 <c_wraith> yes. let/where bindings are lazy. case/lambda/function pattern bindings are strict
06:03 fakenerd joined
06:03 <EvanR> lambda is strict even though you dont get a choice?
06:03 <glguy> ~ is meaningful in let bindings when not used at the outer-most pattern
06:03 <glguy> > let (x,~(y,z)) = ((),undefined) in x
06:03 <lambdabot> ()
06:03 dni joined
06:03 <glguy> > let (x,(y,z)) = ((),undefined) in x
06:03 <lambdabot> *Exception: Prelude.undefined
06:04 <EvanR> oh geez
06:04 <cocreature> how can I link to headings created via "-- * name" in the export list of a module?
06:04 <glguy> EvanR: I don't understand your question about lambda, though.
06:04 thebardian joined
06:05 <EvanR> the top most pattern in a let doesnt need to be checked now, since theres only one thing it could be without being an error, you can defer it
06:05 <mniip> he says that since you have only one pattern it would make sense to make it irrefutable
06:05 <EvanR> might as well be lazy
06:05 <EvanR> > (\(Just x) -> 4) Nothing
06:05 <lambdabot> *Exception: <interactive>:3:2-15: Non-exhaustive patterns in lambda
06:05 <Lokathor> i wish there was a way to derive a Show instance with any non-show data being replaced with just the fieldname
06:05 <EvanR> > (\~(Just x) -> 4) Nothing
06:05 <lambdabot> <hint>:1:13: error: parse error on input ‘->’
06:05 <EvanR> urg
06:05 juhp joined
06:06 jleon joined
06:06 <glguy> The binding of a lambda and the one in a let also differ in how they generalize
06:06 <mniip> > (\(~(Just x)) -> 4) Nothing
06:06 <lambdabot> 4
06:06 <glguy> > (\ ~(Just x) -> 4) Nothing
06:06 <MarcelineVQ> > (\ ~(Just x) -> 4) Nothing -- space
06:06 <lambdabot> 4
06:06 <lambdabot> 4
06:08 primal joined
06:08 <mniip> oh yes
06:08 sirreal joined
06:08 juhp joined
06:08 <mniip> > let (\~) = (+) in 1 \~ 2
06:08 <lambdabot> 3
06:09 <mniip> makes sense
06:09 <EvanR> you can write perl in any language!
06:09 <mniip> not in perl
06:09 xtreak joined
06:10 <EvanR> i just noticed a situation where i looped unless i put ~ on arguments to a function which were unwrapping a newtype ctor
06:10 <EvanR> but thats all it unwrapped
06:10 <EvanR> it seems like you can be lazy for free in that situation
06:11 <EvanR> oops not a newtype, a record
06:11 <mniip> perhaps you had some more matching inside?
06:11 <EvanR> no just variables for the 3 fields
06:11 <mniip> then it's not a newtype
06:12 <EvanR> so not even the underhead of newtype
06:12 <EvanR> theres only one thing a record could be...
06:12 <mniip> errr no
06:12 meba joined
06:12 <mniip> you can write newtype records
06:12 <mniip> and newtype gadts
06:12 uglyfigurine joined
06:12 <EvanR> a one constructor product type
06:13 hurkan joined
06:13 <mniip> shame you can't write Dict as a newtype but I had a proposal for that somewhere
06:13 hurkan left
06:13 <glguy> I don't think you can have a newtype GADT
06:13 <EvanR> seems like a situation where "just be lazy dont worry about it"
06:13 <EvanR> even do it by default like the let is
06:14 <mniip> @let newtype G a where C :: Char -> G Int
06:14 <lambdabot> .L.hs:171:9: error:
06:14 <lambdabot> • A newtype constructor must have a return type of form T a1 ... an
06:14 <lambdabot> C :: Char -> G Int
06:14 <mniip> oh right, ofc, constraints
06:14 <mniip> I guess you are kinda correct then, you can't write a non-regular datum as a newtype gadt
06:15 <glguy> right
06:15 <glguy> EvanR: Even though a data type might only have one constructor, that doesn't mean you don't have to allocate the value for that case, or that it might not be a thunk in need of evaluation
06:15 mrkgnao joined
06:15 <mniip> assuming RankN and Existential though
06:16 <mniip> EvanR, you're using record newtypes all over the place actually
06:16 <mniip> Identity, Compose,
06:16 <mniip> most of mtl
06:16 SkyPatrol joined
06:16 <glguy> Existentials+newtype don't help with the contexts
06:16 <glguy> But you can newtype a polymorphic type with RankNTypes
06:16 <mniip> @let newtype N = N (forall a. a)
06:16 <lambdabot> Defined.
06:16 <mniip> @let newtype N' = forall a. N' a
06:17 <lambdabot> .L.hs:172:14: error:
06:17 <lambdabot> • A newtype constructor cannot have existential type variables
06:17 <lambdabot> N' :: forall a. a -> N'
06:17 <mniip> okee
06:17 quobo joined
06:17 <mniip> never studied the formal rules, I've always just kinda grokked the representation thing
06:18 primal_ joined
06:18 FreeBirdLjj joined
06:19 systadmin left
06:20 nomadic joined
06:22 sternmull joined
06:24 inad922 joined
06:24 CacoS joined
06:25 jleon joined
06:26 nomadic left
06:28 primal joined
06:30 zcourts joined
06:32 renzhi joined
06:33 davr0s joined
06:34 <hanna> Style question: What's a good way to layout the definition of a record type with alternatives (multiple constructors)?
06:34 Johan_Meh joined
06:36 Guest87 joined
06:37 <hanna> Right now I'm doing this but it looks kinda wanky: https://0x0.st/EOq.txt
06:37 <johnw> pretty much how I'd do it
06:37 <kadoban> Records with multiple constructors aren't usually a good idea, as far as I understand. All of the record access functions are partial
06:37 <cocreature> another option is to extract the record parts in separate types
06:37 dni joined
06:38 <cocreature> i.e., make a record type Foo and then use data FooBar = Foo Foo | …
06:38 sproingie joined
06:38 sproingie joined
06:39 <cocreature> but that can be annoying
06:40 <hanna> kadoban: that's fair, but I'm only using them for record-style constructors and deconstructors
06:40 <hanna> Not access
06:40 eacameron joined
06:41 alfredo joined
06:42 tomboy64 joined
06:43 takle joined
06:44 primal_ joined
06:44 ubsan_ joined
06:47 <thang1> So... Got a question
06:47 <thang1> Is there a nice easy way to filter a bunch of things from something?
06:48 <cocreature> thang1: like "filter"?
06:48 <thang1> To be specific, it'd be really nice to be able to type something like "filter (contains vowels) "sentence" " and get the result "sntnc"
06:48 <thang1> Sure, I know how to use filter, but it only works for one thing. So I can filter all the 'a's out of a sentence, but then I have to chain 5 different filters to get all the vowels out
06:49 <cocreature> > filter (`elem` "aeiou") "sentence"
06:49 <lambdabot> "eee"
06:49 <cocreature> eh that was the wrong way around
06:49 herr_jth joined
06:49 _herr_jth joined
06:49 <cocreature> but you get the idea
06:49 <cocreature> > filter (not . (`elem` "aeiou")) "sentence"
06:49 <lambdabot> "sntnc"
06:50 <EvanR> thang1: you can combine many conditions into one function by using Monoid
06:50 <EvanR> two monoids actualy
06:51 <EvanR> but chaining multiple filter f .'s is probably simpler
06:51 <thang1> ಠ_ಠ I'm an idiot
06:51 <thang1> I was totally overcomplicating that greatly in my head lol, thanks
06:51 <sternmull> I would like to do "newtype Foo = forall a. Show a => Foo a". But GHC says "A newtype constructor cannot have a context in its type". It works when i replace newtype with data.
06:51 <cocreature> thang1: we all are from time to time :)
06:51 <EvanR> :t filter even . filter (< 4)
06:51 <lambdabot> Integral a => [a] -> [a]
06:52 <thang1> I was doing some stuff like filter (elem x "aeiou") and it kept being annoying
06:53 brailsmt joined
06:55 sullyj3 joined
06:56 <sullyj3> is there a builtin version of this: interactLine f = getLine >>= (putStrLn . f)
06:56 <johnw> sternmull: newtype Foo = Foo (forall a. Show a => a)
06:56 govg joined
06:57 primal joined
06:57 <nshepperd_> sternmull: yeah, new type constructors have no runtime representation, so there would be nowhere to store the Show dictionary
06:58 chat joined
06:58 <sternmull> johnw: Thanks, that works. Needs RankNTypes but thats ok for me.
06:58 duckqlz joined
06:58 monadicDuck joined
06:59 <nshepperd_> I don't know if what johnw wrote is what you want, because that is a different thing (a universal rather than an existential)
07:00 mgu_ joined
07:00 gestone joined
07:00 <johnw> that's a very good point
07:01 <sternmull> nshepperd_: Maybe you are right. elems = [Foo 123, Foo "hello"] does not compile with "newtype Foo = Foo (forall a. Show a => a)".
07:01 eacameron joined
07:01 jleon joined
07:02 <nshepperd_> (in fact there are no values of (forall a. Show a => a) apart from bottom, because Show a provides no way to build an a)
07:04 <sternmull> So it seems i really have to use data.
07:05 raatiniemi joined
07:05 <nshepperd_> 'data Foo = forall a. Show a => Foo a' is basically the same as 'data Foo = forall a. Foo (Show a) a' after the dictionary transformation
07:07 jleon joined
07:07 primal_ joined
07:07 <nshepperd_> The constructor has two arguments, one of which is a Show dictionary. So it doesn't work with newtype for the same reason that newtype constructors can't have two arguments normally
07:09 <nshepperd_> Well, and I guess there's also the fact that pattern matching has to be able to fail, in order to justify bringing a Show constraint in scope. But pattern matching on newtypes never fails
07:10 <sternmull> I don't understand 'data Foo = forall a. Foo (Show a) a'. It seems like the (Show a) in there somehow adds a constraints to the forall thing. But it reads strange to me.
07:12 jhrcek_ joined
07:12 takuan joined
07:12 <EvanR> its odd syntax
07:13 <EvanR> if you use GADT syntax it is more clear
07:13 <EvanR> data Foo where
07:13 <EvanR> Foo :: Show a => Foo a
07:13 <EvanR> er
07:14 <EvanR> nshepperd_ your second version has two args on Foo
07:15 <EvanR> oh thats the ctor
07:15 <EvanR> data Foo where
07:15 thc202 joined
07:15 <EvanR> MkFoo :: Show a => Foo
07:16 jchia joined
07:16 tommd joined
07:17 dni joined
07:19 mattp_ joined
07:19 takle joined
07:20 yamad joined
07:20 <nshepperd> data Foo where { Foo :: Show a => a -> Foo }
07:21 <nshepperd> ^ two arguments, (Show a) and a
07:21 <Lokathor> I have a (Maybe a), and an (a -> IO ()), is there some slick way to just make it run the IO bit if the maybe is a just, and otherwise have it do nothing
07:21 <Lokathor> i'm sure there's a magical one word combinator, or perhaps 7 punctuation marks placed just so
07:21 <johnw> traverse
07:21 <cocreature> Lokathor: traverse_
07:21 <cocreature> or mapM_
07:22 <Lokathor> ah, see, there we are then
07:22 <EvanR> i see the example for how unsafePerformIO can basically execute unsafeCoerce
07:22 <cocreature> it took me way too long to figure out that you can use traverse_ for that
07:22 eacameron joined
07:22 <EvanR> but i do not understand how the type system is not stopping it
07:22 vlatkoB joined
07:22 <EvanR> or how it normally gets stopped by the type system
07:22 oisdk joined
07:22 <EvanR> something about "polymorphic values"
07:23 <Lokathor> cocreature, I'm already importing Control.Monad for other reasons, so mapM_ it is
07:23 <Lokathor> i was trying fmap at first, silly me
07:24 <cocreature> Lokathor: but traverse_ is more general! :)
07:24 mattyw joined
07:24 <Lokathor> but the types are fully known already!
07:24 <cocreature> Lokathor: but the Applicative instance could be more performant!
07:24 <EvanR> whatever reads better
07:24 <Lokathor> of IO?
07:24 <Lokathor> for FFI wrapping code?
07:24 <Lokathor> hmmmmm
07:24 <cocreature> :)
07:25 <Lokathor> seems suspect
07:25 <nshepperd> EvanR: because unsafePerformIO (newIORef undefined) :: forall a. IORef a
07:25 Robin_Jadoul joined
07:25 <nshepperd> which means it can be used as an IORef String once, and then as an IORef Int later
07:25 <EvanR> x <- newIORef undefined...
07:26 louispan joined
07:26 <EvanR> is different?
07:26 <nshepperd> yes
07:26 <EvanR> how
07:27 <nshepperd> newIORef undefined >>= (\ref -> ...)
07:27 <nshepperd> the type of 'ref' is not 'forall a. IORef a'
07:27 <EvanR> i suppose it cant be
07:27 <Lokathor> newtyping a StateT
07:27 <Lokathor> ugggghhhhh i hate it so much
07:27 <EvanR> but what is it?
07:28 <nshepperd> because that would require the lambda to be rank-2
07:28 justan0theruser joined
07:28 <nshepperd> uh, I would call it 'undetermined'
07:28 <nshepperd> i'm sure there's an actual technical term but i don't know it
07:29 <EvanR> is forall a. IORef a a impredicative type?
07:29 <nshepperd> its type is 'IORef a', for some free variable a to be determined by unification
07:30 <EvanR> ok and you could use it one way, not use it, but not use it two different ways
07:30 <EvanR> now i get it
07:30 <nshepperd> yeah
07:31 dni joined
07:31 <EvanR> what is the type of ref, "depends on what ... is"
07:32 <hanna> Hmm. Is there a `group` or `chunk` pipe that groups values into lists of size N? i.e. group :: Int -> Pipe a [a] m r; `group 3` would turn a stream like [1..10] into [ [1,2,3], [4,5,6], [7,8,9], [10] ]
07:32 <EvanR> that seems like a funny effect of unsafePerformIO
07:32 <EvanR> :t chunksOf
07:32 <lambdabot> Int -> [e] -> [[e]]
07:32 <hanna> The motivation: I have a `producer` that produces a list of entries, and a `consumer` that takes these entries and stores them in a database. For a variety of reasons I want to store them in the database in batches, rather than entry-by-entry
07:32 <EvanR> > chunksOf 3 [1..10]
07:33 <lambdabot> [[1,2,3],[4,5,6],[7,8,9],[10]]
07:33 <tsahyt> are there any naming conventions for lenses to newtype wrappers? say I have newtype Foo = Foo { getFoo :: Bar }, what should the lens to getFoo be called?
07:33 <osa1> I have a large servant API and I want to provide client functions for a subset of the endpoints, is this possible? servant-client's `client` functions doesn't allow this
07:33 <tsahyt> or is there some more elegant way in lens to deal with newtypes?
07:33 <hanna> tsahyt: lens has a class for newtypes
07:33 <osa1> ah! I think I found a way. never mind please ignore
07:34 <EvanR> oh pipe question
07:34 <EvanR> pipes
07:34 nickolay joined
07:34 <hanna> I guess I could write my own, just puzzled that this is not already defined somewhere; it seems useful for a number of things
07:35 <EvanR> might be in a pipes add on lib
07:35 connrs joined
07:35 <tsahyt> hanna: found it, thanks!
07:36 <hanna> I think I can do what I want but not with that type signature
07:36 <* hackage> sibe 0.2.0.5 - Machine Learning algorithms https://hackage.haskell.org/package/sibe-0.2.0.5 (mdibaiee)
07:36 <hanna> The problem is that there's no “non-blocking await”
07:36 <hanna> but I could probably write something that transforms a producer instead
07:37 <EvanR> why does it need to be non blocking
07:37 grayjoc joined
07:37 primal joined
07:37 <hanna> well if I do it the naive way I would fail to include the last [10]
07:38 <hanna> because the producer would terminate while my `group` is still stuck in `await`, right?
07:38 sproingie joined
07:38 tromp joined
07:38 <EvanR> on 9 or on 10 ?
07:38 <EvanR> not sure i understand
07:38 <hanna> well this is how I would write it naively
07:39 <hanna> forever $ replicateM 3 await >>= yield
07:39 <EvanR> makes sense
07:39 <EvanR> except for the last 3
07:39 <EvanR> can you detect if the input is over with
07:39 <hanna> Yes, how do I handle with premature termination?
07:40 <hanna> I think I could sequence the producer with another producer
07:40 mark___ joined
07:40 <halogenandtoast> Anyone have experience with Keter, I can't seem to get a "server" running.
07:40 <hanna> but then it seems like I need to account for this failure possibility in the body somehow, so I can pass on the values to that “termination” pipe...
07:40 <halogenandtoast> I have no idea how to debug this
07:40 <EvanR> this is too complicated
07:41 <mark___> I'm new to this, and I have some really simple code here that has the error "parse error on input <module name>". Can someone help? https://pastebin.com/mnwBRpse
07:41 thunderrd_ joined
07:41 user___ joined
07:41 <sullyj3> Are there any base functions that would make this nicer? it's for generating pascals triangle, you subsequently map sum over the result.
07:42 <lpaste> sullyj3 pasted “windows” at http://lpaste.net/355830
07:42 <halogenandtoast> the only log output I see is: 2017-05-25 07:36:52.47: Unpacking bundle '/opt/keter/etc/../incoming/NhkReader.keter'
07:43 jleon joined
07:43 oisdk_ joined
07:46 jleon joined
07:47 primal_ joined
07:47 fakenerd joined
07:49 <Lokathor> @pl (\s -> s {window = window})
07:49 <lambdabot> (line 1, column 10):
07:49 <lambdabot> unexpected "{"
07:49 <lambdabot> expecting variable, "(", operator or ")"
07:49 <Lokathor> drat, i figured as much
07:50 eacameron joined
07:51 yoneda joined
07:52 jleon joined
07:54 brailsmt joined
07:55 bablisok joined
07:56 torstein joined
07:56 yamad joined
07:57 primal joined
07:58 joco42 joined
07:59 ErinvanderVeen joined
08:00 DisruptiveNL joined
08:02 wroathe joined
08:02 mthek joined
08:03 sabin joined
08:04 govg joined
08:06 shangxiao joined
08:06 zero_byte joined
08:07 jleon joined
08:07 <sabin> Is there a specific haskell beginner channel?
08:08 <Rembane> sabin: I can't find it right now, you can ask your questions here.
08:08 <cocreature> sabin: beginner questions are completely fine here! (there is #haskell-beginners iirc if you really want a separate channel)
08:09 marfoldi joined
08:09 <halogenandtoast> I got keter running, apparantly the setup script doesn't work
08:10 <halogenandtoast> because why would that be useful?
08:11 wroathe joined
08:11 bvad joined
08:12 sabin joined
08:13 toby1851 joined
08:14 toby1851 joined
08:14 ragepandemic joined
08:15 toby1851 joined
08:15 eacameron joined
08:15 btk joined
08:18 indi_ joined
08:20 indi_ joined
08:21 raichoo joined
08:22 twomix joined
08:22 chat_ joined
08:25 <hexagoxel> sullyj3: you can use zip/zipWith. And summing last is probably a rather inefficient route.
08:26 APic joined
08:26 filterfish joined
08:27 eacameron joined
08:27 primal_ joined
08:27 wroathe joined
08:30 jleon joined
08:31 BartAdv joined
08:32 <mniip> sullyj3, I would use 1: and ++[1] and the zip`ap`tail trick
08:33 juanpaucar joined
08:34 eklavya joined
08:34 simukis joined
08:34 takle joined
08:34 <sullyj3> :t ap
08:34 <lambdabot> Monad m => m (a -> b) -> m a -> m b
08:35 <sullyj3> :t ap zip tail
08:35 <lambdabot> [a] -> [(a, a)]
08:35 <sullyj3> > ap zip tail [1..10]
08:35 <lambdabot> [(1,2),(2,3),(3,4),(4,5),(5,6),(6,7),(7,8),(8,9),(9,10)]
08:36 <sullyj3> oh, ok.
08:36 primal joined
08:36 <sullyj3> mniip: but then the list becomes heterogeneous though? since the first and last elements aren't pairs?
08:37 balor joined
08:37 eacameron joined
08:37 wroathe joined
08:39 osa1_ joined
08:40 NoCreativity_ joined
08:40 lep-delete joined
08:42 simendsjo joined
08:42 govg joined
08:43 Kreest__ joined
08:43 <sullyj3> also, anyone have a good resource for explaining that zip `ap` tail trick? my understanding of applicatives is basic
08:43 <mniip> sullyj3, you zipWith (+) it, duh
08:44 <mniip> for functions,
08:44 <mniip> ap f g x = f x (g x)
08:45 turbonikke89 joined
08:46 primal_ joined
08:48 whald joined
08:49 davr0s joined
08:49 turbonikke89 left
08:51 danvet_ joined
08:52 dni joined
08:52 sanitypassing joined
08:53 jleon joined
08:54 castlelore joined
08:55 brailsmt joined
08:56 WhereIsMySpoon joined
08:56 primal joined
08:57 yamad joined
08:58 wroathe joined
08:58 <sullyj3> mniip: cool, ta
08:59 jleon joined
09:00 WhereIsMySpoon left
09:01 xtreak joined
09:02 meba joined
09:03 xtreak_ joined
09:03 bvad joined
09:04 wonko7 joined
09:05 SkyPatrol joined
09:06 ragepandemic joined
09:06 primal_ joined
09:07 <sullyj3> How's this look? nextRow' row = 1:(zipWith (+) <*> tail $ row) ++ [1]
09:08 xtreak joined
09:08 gawen joined
09:09 <tsahyt> I want to use lens to modify something in a structure, but for the operation I need a different part of the structure. e.g. I'd use over (foo . bar . each . quux) but for the function I'll need a view of (foo . bar . each . xuuq) for the corresponding element in each
09:09 chichou joined
09:09 <tsahyt> not sure if this question makes sense. it's a bit hard for me to even phrase lens questions because I lack experience with it
09:10 <tsahyt> anyhow, how would I go about this?
09:11 Bardusbasium joined
09:11 vydd joined
09:11 dni joined
09:13 shangxiao joined
09:15 anodium joined
09:16 SkyPatrol joined
09:16 romank joined
09:17 primal joined
09:17 <brynedwards> :r
09:17 <brynedwards> :r
09:17 silentoxygen joined
09:18 wroathe joined
09:18 Wizek_ joined
09:18 jleon joined
09:24 mstruebing joined
09:24 netheranthem joined
09:24 TheFuzzball joined
09:25 inad922 joined
09:26 Johan_Meh joined
09:26 <hexagoxel> tsahyt: over (foo . bar . each) _ and continue from there? not sure if you can fill that hole elegantly, but it should work.
09:26 <hanna> tsahyt: one way you could do is over (foo.bar.each) $ \x -> do something using x^.xuuq
09:26 primal_ joined
09:26 <hanna> but it's been a long while since I've lensed
09:27 <tsahyt> hexagoxel, hanna: that's about what I ended up doing
09:27 <hanna> you could probably find a combinator that “merges” quux and xuuq into a view on a tuple or something
09:27 <sullyj3> is there a way to view specialized type signatures of polymorphic functions? eg given (<$>) :: Functor f => (a -> b) -> f a -> f b could I specify f = [] and get (<$>) :: (a -> b) -> [a] -> [b] ?
09:27 <hanna> and then mape \(a,b) -> (a, modify b using a)
09:27 <hanna> map*
09:27 <tsahyt> hmm right
09:28 <hanna> but who knows
09:28 <tsahyt> "who knows" is pretty much my entire stance on lens
09:28 saussure joined
09:28 <hanna> if you have to think about this problem too much then you're not gaining simplicity by using lens
09:28 <hanna> so stick to what works
09:28 <tsahyt> but in this case here it really makes sense to use it
09:28 <tsahyt> I'm working with a somewhat deeply nested AST here, transforming it in multiple steps
09:28 <hanna> lens is a tool to make your code simpler, not more complicated :)
09:28 <tsahyt> tearing that apart manually and rebuilding it on every step is a massive pain
09:28 <tsahyt> so I finally gave in to lenses
09:29 tsmish joined
09:29 govg joined
09:29 xtreak_ joined
09:30 <hexagoxel> :t \x -> (<$>) x `asAppliedTo` []
09:30 <lambdabot> (a -> b) -> [a] -> [b]
09:30 <tsahyt> :t asAppliedTo
09:30 <lambdabot> (a -> b) -> a -> a -> b
09:30 <tsahyt> hmm that's useful
09:30 jleon joined
09:30 <hexagoxel> sullyj3: it is still rather cumbersome for this example.. dunno.
09:32 <balor> The `-ddump-deriv` flag doesn't appear to dump the implementation of derived Typeable instances. Is this observation correct? I can dump derived instances of Functor and Show.
09:33 wroathe joined
09:33 <sullyj3> :t hexagoxel I'm not seeing asAppliedTo on hoogle?
09:33 <lambdabot> error:
09:33 <lambdabot> parse error (possibly incorrect indentation or mismatched brackets)
09:33 acidjnk22 joined
09:33 <sullyj3> oops
09:33 harendra joined
09:34 <hexagoxel> @src asAppliedTo
09:34 <lambdabot> f `asAppliedTo` a = f where _ = f a
09:34 <lambdabot> infixl 0 `asAppliedTo`
09:35 jleon joined
09:35 <sullyj3> < (<>) `asAppliedTo` []
09:35 <sullyj3> > (<>) `asAppliedTo` []
09:35 <lambdabot> error:
09:35 <lambdabot> • No instance for (Typeable t0)
09:35 <lambdabot> arising from a use of ‘show_M438695397355665942115330’
09:36 <sullyj3> :t (<>) `asAppliedTo` []
09:36 <lambdabot> [t] -> [t] -> [t]
09:36 Levex joined
09:36 inad922 joined
09:36 <sullyj3> (<>) `asAppliedTo` [] $ [1..5] [6..10]
09:36 <sullyj3> > (<>) `asAppliedTo` [] $ [1..5] [6..10]
09:36 <lambdabot> error:
09:36 <lambdabot> Precedence parsing error
09:36 <lambdabot> cannot mix ‘asAppliedTo’ [infixl 0] and ‘$’ [infixr 0] in the same i...
09:36 primal joined
09:36 <harendra> Can someone help me on a question about MonadTransControl?
09:36 <sullyj3> > ((<>) `asAppliedTo` []) [1..5] [6..10]
09:37 <lambdabot> [1,2,3,4,5,6,7,8,9,10]
09:37 juanpaucar joined
09:38 <hexagoxel> sullyj3: The TypeApplications extension would be nicer, but lambdabot does not support it yet.
09:38 uglyfigurine joined
09:38 <hexagoxel> it is ghc-8 iirc
09:38 sproingie joined
09:40 <hexagoxel> harendra: best chance of finding that out generally is asking the question :)
09:40 <hexagoxel> @let f `asAppliedTo2` a = f where _ = \b -> f b a
09:40 <lambdabot> .L.hs:173:1: warning: [-Woverlapping-patterns]
09:40 <lambdabot> Pattern match is redundant
09:40 <lambdabot> In an equation for ‘asAppliedTo2’: asAppliedTo2 f a = ...
09:40 locallycompact joined
09:41 <hexagoxel> :t (<$>) `asAppliedTo2` []
09:41 <lambdabot> (a -> b) -> [a] -> [b]
09:41 wonko7 joined
09:42 ErinvanderVeen joined
09:42 <harendra> hexagoxel: alright. here is the question.
09:43 wroathe joined
09:43 wonko7 joined
09:43 Gurkenglas joined
09:45 <harendra> the definition "defaultLiftWith t unT = \f -> t $ liftWith $ \run -> f $ run . unT" seems to be using liftWith of the wrappend monad. Whereas if I look at how liftWith is defined for MaybeT it does not seem to be doing so: "liftWith f = MaybeT $ liftM return $ f $ runMaybeT". Does'nt it have to recurse like defaultLiftWith does?
09:45 kirillow joined
09:45 <tsahyt> given an AST (defined as a recursive sum type) with prisms, can I modify all nodes that match some constructor recursively? e.g. modify all the Bars in (Foo (Bar Quux) (Foo (Bar Quux)))?
09:46 zcourts joined
09:46 saussure joined
09:46 primal_ joined
09:48 <phadej> tsahyt: you'll need something like http://hackage.haskell.org/package/lens-4.15.2/docs/Control-Lens-Plated.html
09:49 <tsahyt> phadej: thanks, I'll look into it
09:49 <cocreature> plated is awesome
09:50 safe joined
09:51 <phadej> somehow suggested that with TH support now in recursion-schemes one can "autoderive" Plated; helps to start fast
09:51 <cocreature> I just use the Data.Data default instance most of the time because I’m lazy
09:51 target_i joined
09:52 osa1 joined
09:53 <osa1> ugh.. I have a module that fails to type check when I enable TypeFamilies
09:53 <osa1> without TypeFamilies it compiles fine
09:53 <cocreature> osa1: TypeFamilies implies a bunch of other extensions so maybe one of those is the problem
09:53 <phadej> cocreature: sometimes you have things which aren't Data :(
09:53 <osa1> hmm good point
09:53 <osa1> let me check the user manual
09:53 <phadej> probably MonoLocalBinds
09:54 <osa1> Implies: -XMonoLocalBinds, -XKindSignatures, -XExplicitNamespaces
09:54 <phadej> i.e. probably you have to give a type-annotation to something in `where` clauses, to make it again polymorphic
09:54 xtreak joined
09:54 <osa1> yup, NoMonoLocalBinds solved it
09:55 <phadej> I'd rather add a type-annotation
09:55 <osa1> yeah that's what I'll do because I can't even re-order my pragmas with this
09:55 <cocreature> huh, I didn’t even know NoMonoLocalBinds works in that situation
09:55 <phadej> TypeFamilies + NoMOnoLocalBinds is unsupported combination
09:55 <osa1> NoMonoLocalBinds has to come after TypeFamilies
09:55 saussure joined
09:56 jleon joined
09:56 brailsmt joined
09:56 <phadej> the manual says:
09:56 primal joined
09:56 <phadej> > The flag -XMonoLocalBinds is implied by -XTypeFamilies and -XGADTs. You can switch it off again with -XNoMonoLocalBinds but type inference becomes less predicatable if you do so. (Read the papers!)
09:57 <lambdabot> <hint>:1:125: error: parse error on input ‘type’
09:57 jchia1 joined
09:57 ErinvanderVeen joined
09:57 Cerise joined
09:57 Cerise joined
09:58 yellowj joined
09:58 marr joined
09:59 joco42 joined
10:00 xtreak joined
10:02 yamad joined
10:03 wroathe joined
10:06 dni joined
10:06 unK_ joined
10:07 primal_ joined
10:07 mulk joined
10:08 ph88^ joined
10:09 danza joined
10:10 przemkovv joined
10:13 saussure joined
10:13 erikd joined
10:13 magicman joined
10:14 primal joined
10:14 Raddamu joined
10:14 dunx joined
10:15 Raddamu joined
10:15 augur joined
10:16 Raddamu joined
10:16 <Raddamu> L
10:16 raddamu2 joined
10:17 jleon joined
10:18 yellowj joined
10:18 hanna joined
10:19 SkyPatrol_ joined
10:19 fotonzade joined
10:19 bablisok joined
10:21 sgflt joined
10:21 augur joined
10:22 primal_ joined
10:22 jaspervdj joined
10:23 saussure joined
10:23 wroathe joined
10:24 <* angerman> is around in case anyone has questions re cross compiling th :-)
10:26 mstruebing joined
10:27 primal joined
10:28 fakenerd joined
10:30 dc0de joined
10:30 <* hackage> accelerate-llvm-ptx 1.0.0.1 - Accelerate backend generating LLVM https://hackage.haskell.org/package/accelerate-llvm-ptx-1.0.0.1 (TrevorMcDonell)
10:31 ziocroc joined
10:31 yqt joined
10:31 Johan_L joined
10:31 bablisok joined
10:32 cyborg-one joined
10:32 chichou joined
10:33 primal_ joined
10:37 bennofs joined
10:38 meoblast001 joined
10:38 mgu_ left
10:39 im0nde joined
10:39 tromp joined
10:40 jleon joined
10:41 saussure joined
10:41 juanpaucar joined
10:44 wroathe joined
10:45 jleon joined
10:45 TCZ joined
10:45 fnurglewitz joined
10:46 mattyw joined
10:47 ziocroc2 joined
10:49 stevenxl joined
10:49 latro`a joined
10:50 arpl joined
10:50 eklavya joined
10:51 jleon joined
10:53 primal joined
10:54 wroathe joined
10:55 jleon joined
10:56 gestone joined
10:57 brailsmt joined
10:58 oisdk joined
10:58 saussure joined
11:00 gillesmajor joined
11:01 mothcoffin joined
11:01 Xanather joined
11:02 Snircle joined
11:04 <* hackage> ngx-export 0.3.2.1 - Helper module for Nginx haskell module https://hackage.haskell.org/package/ngx-export-0.3.2.1 (lyokha)
11:05 Icewing joined
11:08 saussure joined
11:09 eacameron joined
11:10 nighty-- joined
11:13 primal_ joined
11:14 xtreak joined
11:14 wroathe joined
11:15 jleon joined
11:16 balor joined
11:17 mmn80 joined
11:17 tremon joined
11:18 jleon joined
11:19 xtreak joined
11:21 ErinvanderVeen joined
11:22 wroathe joined
11:22 jleon joined
11:23 miklcct joined
11:23 primal joined
11:24 fendor joined
11:26 jleon joined
11:26 edwtjo joined
11:26 edwtjo joined
11:26 saussure joined
11:26 darlan joined
11:28 <* hackage> creatur 5.9.15 - Framework for artificial life experiments. https://hackage.haskell.org/package/creatur-5.9.15 (AmyDeBuitleir)
11:28 tsmish joined
11:29 eacameron joined
11:30 jleon joined
11:30 HoierM_ joined
11:31 silver joined
11:31 prophile joined
11:33 wroathe joined
11:34 shangxiao joined
11:38 sproingie joined
11:38 sproingie joined
11:39 eacameron joined
11:41 juanpaucar joined
11:44 primal_ joined
11:44 abrar joined
11:44 mohsen_ joined
11:44 <cocreature> does optparse-applicative have a way to use default options that are computed in IO or do I first need to use a Maybe and read the value after parsing?
11:44 saussure joined
11:45 asm_ joined
11:45 bjz joined
11:46 <sternmull> how do i get ghc-mod to see the sources of my dependencies? I used "stack unpack" for a dependency and used that directory in "packages" of stack.yaml but ghc-mod still can not "go to definition" for it.
11:46 jleon joined
11:46 <cocreature> sternmull: I don’t think you can
11:47 <sternmull> cocreature: But ghc-mod can locate definitions in my modules. Why not also in dependencies when they are build from source...
11:48 <cocreature> sternmull: because GHC doesn’t know that you build them from source and where the sources live.
11:49 <ph88^> i like to put a conduit in a vector, i found a package but it's 5 years old https://github.com/jhance/vector-conduit not sure what to do
11:49 <cocreature> sternmull: codex should be able to do this
11:49 eacameron joined
11:49 <sternmull> cocreature: codex looks interesting, thanks.
11:49 <angerman> cocreature: default options in IO sounds ... bah...
11:49 <angerman> cocreature: that would force IO all the way.
11:50 <cocreature> angerman: well everybody uses "execParser" anyway which lives in IO :)
11:50 <cocreature> angerman: I have a -j option and want it to default to getNumCapabilities. that doesn’t seem that unreasonable
11:51 <brynedwards> ph88^: conduit-combinators uses MonoFoldable typeclass which has a Vector instance
11:51 <angerman> cocreature: no, that doesn't sound unreasonable.
11:52 <angerman> cocreature: make your Option data type monoidal, and merge the parsed one with you `def` one from IO ;-)
11:52 takle joined
11:52 <cocreature> angerman: but then I still need to separately execute some IO action instead of just running execParser
11:53 <cocreature> I guess that’s not so bad
11:53 wroathe joined
11:54 primal joined
11:54 saussure joined
11:56 <brynedwards> ph88^: in fact it has sinkVector as well https://hackage.haskell.org/package/conduit-combinators-1.1.1/docs/Conduit.html#v:sinkVector
11:56 sw1nn joined
11:56 tusj joined
11:56 HoierM_ joined
11:56 <angerman> cocreature: I don't see how you can force it *into* execParser.
11:57 <cocreature> angerman: yeah I don’t see that either. I was hoping I had missed something in the API of optparse-applicative :)
11:57 halogenandtoast joined
11:57 <angerman> well, I'll try to see if I can manage to cross compile yesod...
11:58 brailsmt joined
11:58 <cocreature> good luck with that :)
11:58 <ph88^> brynedwards, that looks good ! do you think it would be an option to implement my own allocation strategy ? i see it starts at 10 then doubles
11:58 <angerman> I really hope people do not confuse the post from yesterday with the one from today...
12:00 joco42 joined
12:00 WhereIsMySpoon joined
12:01 eklavya joined
12:01 btk joined
12:02 NdaX404 joined
12:02 NdaX404 left
12:02 NdaX404 joined
12:03 jedws joined
12:04 NdaX404 left
12:04 primal_ joined
12:04 wroathe joined
12:04 yamad joined
12:05 jleon joined
12:07 <ph88^> is there a way to let ghci infer types and then give possible type synonyms for it ?
12:08 <angerman> ph88^: you mean String instead of [Char]?
12:09 jleon joined
12:09 rey_gr joined
12:10 erikd joined
12:10 bendo joined
12:11 tromp joined
12:11 Bardusbasium joined
12:12 saussure joined
12:12 netheranthem joined
12:13 WhereIsMySpoon left
12:13 wroathe joined
12:14 primal joined
12:16 Cerise joined
12:16 Cerise joined
12:16 tommd joined
12:20 yogsototh joined
12:21 Bardusbasium joined
12:23 exferenceBot joined
12:23 ErinvanderVeen joined
12:23 connrs joined
12:23 primal_ joined
12:24 balor joined
12:25 cretiq joined
12:30 saussure joined
12:32 vektorweg1 joined
12:33 primal joined
12:34 omilu joined
12:35 |sync| joined
12:36 systadmin joined
12:38 erikd joined
12:38 eHammarstrom joined
12:38 wroathe joined
12:39 fakenerd joined
12:39 saussure joined
12:39 flatmap13 joined
12:40 lc_ joined
12:41 fkurkowski joined
12:41 afldcr joined
12:41 muzzle joined
12:43 miklcct joined
12:43 <muzzle> Hi
12:43 Levex joined
12:43 <muzzle> so in haskell every function is supposed to have only one argument, right?
12:44 sdothum joined
12:44 jleon joined
12:44 <lyxia> yes
12:44 paolino joined
12:44 <muzzle> so why do those two functions in http://lpaste.net/355834 behave differently ?
12:45 <muzzle> shouldn't they have the exactly same behaviour?
12:46 <Tuplanolla> You're using `Debug.Trace`, so all bets are off, muzzle.
12:46 dni joined
12:46 <lyxia> it can be explained though
12:46 <muzzle> Tuplanolla what I really want to find out is, if I can keep haskell from re-evaluating 's' on every function call...
12:47 <muzzle> and my idea was that traceShow should be called every time the value is evaluated, right?
12:48 <Geekingfrog> doesn't s depend on a and b? And in that case you would need to recompute it every time a or b change right ?
12:48 <lyxia> in the first case traceShow will be evaluated at most once every time f is applied to two arguments
12:49 <muzzle> Geekingfrog right, but technically I could just not do that when using fmap
12:49 <lyxia> muzzle: and in the second it is evaluated at most once for every time g is applied to three arguments
12:49 <davean> muzzle: f introduces a lambda that g doesn't
12:50 <davean> muzzle: this gives GHC somewhere to capture
12:50 <muzzle> so f a b str isn't really equal to \a -> \b -> \str -> ... in that respect?
12:50 dni_ joined
12:50 miklcct joined
12:51 <davean> muzzle: https://wiki.haskell.org/Worker_wrapper
12:51 <lyxia> muzzle: in f if you move s into a nested where clause under f' you might get the behavior of g back
12:52 tromp joined
12:52 <davean> muzzle: if you tried to rewrite those as full out lambdas you might see it clearer - but to be clear the behavior would be "correct" if it was swapped too
12:54 primal_ joined
12:54 paolino joined
12:54 cdg joined
12:55 fendor joined
12:55 <* hackage> snipcheck 0.1.0.1 - Markdown tester https://hackage.haskell.org/package/snipcheck-0.1.0.1 (nmattia)
12:56 anzuof joined
12:56 brailsmt joined
12:56 erikd joined
12:56 mjs2600 joined
12:57 Cassiopaya joined
12:57 <Tuplanolla> Nesting shouldn't matter here, lyxia.
12:57 systadmin joined
12:57 saussure joined
12:59 wroathe joined
12:59 yellowj joined
13:00 eacameron joined
13:01 <muzzle> what is the preceise contract of debug.trace? That it prints every time, that it's argument thunk is evaluated?
13:02 <Tuplanolla> It's the same as for `unsafePerformIO`, which I recall had some elaborate documentation.
13:02 <c_wraith> muzzle: it creates a new thunk that produces output when it is forced. When it is forced, it also forces its argument to WHNF
13:03 <c_wraith> Its second argument, that is.
13:03 meba joined
13:03 <c_wraith> Once it is evaluated, that exact thunk won't produce output again.
13:04 <Geekingfrog> Btw, in what sense `unsafePerformIO` is unsafe ?
13:04 <c_wraith> Geekingfrog: in the sense that you give up all control over evaluation order and even how many times it's evaluated
13:04 <c_wraith> Geekingfrog: because the compiler assumes the result is a pure expression that can be inlined all over harmlessly
13:04 <Tuplanolla> You can produce a segmentation fault with it, Geekingfrog.
13:05 jleon joined
13:05 iAmerikan joined
13:05 mizu_no_oto joined
13:05 xtreak joined
13:05 <c_wraith> Also, that that with polymorphic references that's usually prevented by the type system.
13:05 <muzzle> Geekingfrog: I guess it's also unsafe in the sense that it doesn't show that it's an IO action in it's result type
13:06 <ongy> Tuplanolla: without stuff from Foreign or ffi?
13:06 <Tuplanolla> You only need an `IORef`, ongy.
13:06 <c_wraith> ongy: yeah, it's actually documented in the docs for unsafePerformIO
13:06 <Tuplanolla> There are more creative ways too.
13:07 miklcct joined
13:07 saussure joined
13:07 <c_wraith> Geekingfrog: if you use unsafePerformIO, you give up all control over when GHC might run the action - and it's free to run it exactly when you don't think it ever will. And it probably will. :)
13:08 jleon joined
13:09 <Tuplanolla> We also have `unsafeDupablePerformIO`, `inlinePerformIO`, `accursedUnutterablePerformIO` and friends if you want even fewer guarantees.
13:09 wroathe joined
13:09 Itkovian joined
13:10 eacameron joined
13:10 <Geekingfrog> Yeah, I've heard of these as well, the last one has a nice comment in its source code as well :D
13:10 <Tuplanolla> Some may be deprecated; I don't remember.
13:10 theelous3 joined
13:11 coltfred_ joined
13:11 primal joined
13:11 davr0s joined
13:13 <ongy> inlinePerformIO is deprecated and just accursedUnutterablePerformIO
13:14 bablisok joined
13:18 cschneid_ joined
13:20 wroathe joined
13:20 beekill95 joined
13:21 takle joined
13:22 cyborg-one joined
13:22 erikd joined
13:24 etehtsea joined
13:24 primal_ joined
13:25 saussure joined
13:25 cpennington joined
13:26 <lyxia> Tuplanolla: nesting does matters because GHC is very conservative about floating out local bindings. I mean in this case you're free to try f2 and see for yourself. http://lpaste.net/355834
13:26 wroathe joined
13:30 <Tuplanolla> Ah, in my head I nested them the other way, lyxia.
13:31 ilyaigpetrov joined
13:31 anodium joined
13:32 <lyxia> trace also seems much safer than unsafePerformIO
13:32 plugin joined
13:33 iAmerikan joined
13:33 <Tuplanolla> That is, `let s = t in let f = s in f` instead of `let f = let s = t in s in f`.
13:34 primal joined
13:34 ianclark joined
13:35 <lyxia> I don't see how this unifies with the pasted code
13:35 oish joined
13:35 obadz joined
13:36 <lyxia> anyway, IMO the situation with trace is much more nuanced than "all bets are off"
13:37 albertus1 joined
13:38 ystael joined
13:38 Bille1 joined
13:38 sproingie joined
13:39 <Tuplanolla> I like your optimism.
13:39 cschneid_ joined
13:40 meba joined
13:40 SkyPatrol joined
13:41 bablisok joined
13:42 cpennington joined
13:42 sepp2k joined
13:43 plutoniix joined
13:43 saussure joined
13:43 kritzcreek joined
13:43 primal_ joined
13:44 Valoo joined
13:44 plutoniix joined
13:45 tomus joined
13:45 tsmish joined
13:47 wroathe joined
13:47 Bare- joined
13:47 zcourts joined
13:48 eklavya joined
13:51 trism joined
13:52 richi238 joined
13:52 aarvar joined
13:54 primal joined
13:55 tsmish joined
13:57 matzy_ joined
13:57 `^_^v joined
13:57 gestone joined
13:58 ChristopherBurg joined
13:58 bjz_ joined
13:59 jhenligne joined
14:01 saussure joined
14:01 joco42 joined
14:02 Sonderblade joined
14:04 eacameron joined
14:04 primal_ joined
14:04 juanpaucar joined
14:05 yamad joined
14:06 Johan_L joined
14:07 wroathe joined
14:07 eschnett joined
14:08 saussure joined
14:08 tromp joined
14:09 desku joined
14:09 ij joined
14:09 <ij> What does cabal2nix's "--shell" do?
14:09 juanpaucar joined
14:10 jathan_ joined
14:11 mr_sm1th joined
14:12 TheFuzzball joined
14:13 <* hackage> creatur 5.9.16 - Framework for artificial life experiments. https://hackage.haskell.org/package/creatur-5.9.16 (AmyDeBuitleir)
14:13 primal joined
14:14 eacameron joined
14:16 filterfish joined
14:18 sproingie joined
14:18 placidex joined
14:19 coltfred_ joined
14:19 stevenxl joined
14:20 bennofs joined
14:21 Itkovian joined
14:21 systadmin joined
14:23 qnikst joined
14:24 primal_ joined
14:25 tzh joined
14:26 eacameron joined
14:27 wroathe joined
14:28 darlan joined
14:28 takle joined
14:28 chlong joined
14:29 Bardusbasium joined
14:29 ristos_ joined
14:30 james999 joined
14:31 skeuomorf joined
14:34 primal joined
14:34 <Lokathor> today's complaint of the day: show does the right thing for anything that isn't a String, but it does the wrong thing on Strings :P
14:34 jao joined
14:34 ristos_ joined
14:34 Johan_L joined
14:34 ristos joined
14:35 <lyxia> what does it do wrong
14:37 carlomagno joined
14:37 eacameron joined
14:37 brailsmt joined
14:37 Bardusbasium_ joined
14:38 yellowj joined
14:38 <hexagoxel> Lokathor: does it do the right thing for (String, String) ?
14:38 FreeBirdLjj joined
14:39 <Lokathor> lyxia, it doesn't just do "id" :P instead it escapes a few things
14:39 <lyxia> just as designed
14:39 <Lokathor> hexagoxel, probably the same issue there
14:40 <hexagoxel> Lokathor: you looking in ghci? because ghci `print`s.
14:40 wroathe joined
14:40 justan0theruser joined
14:40 dsh joined
14:41 <Lokathor> hexagoxel, this is true in or out of ghci. You can't write a generic printing operation that does the "right thing" without rigging up your own typeclass or something
14:42 <Lokathor> and, as i recall, you also can't easily rig up your own typeclass for it because you need to write one instance for Show s => EasyPrint s, and then another for EAsyPrint String, and then you get a clash
14:42 <Lokathor> i could be wrong on the last part
14:42 bennofs joined
14:42 <hexagoxel> > text $ show "hello, world"
14:42 <lambdabot> "hello, world"
14:43 <hexagoxel> Lokathor: you really find that to be too much escaping?
14:43 Kreest_ joined
14:43 primal_ joined
14:43 <Lokathor> well considering that you (1) just passed it through text (2) saw your double quotes in your output, yes
14:44 bennofs joined
14:45 oisdk_ joined
14:45 <lyxia> Although it gets abused, the primary goal of show is to produce a Haskell representation of a value
14:45 <clamchowder> Question: how do I parse a string, where the parser succeeds and returns s if the string is of format *s*, and s neither begins nor ends with a space and s does not contain any *?
14:46 <Lokathor> lyxia, yes, I understand what you're saying on taht front :P
14:46 augur joined
14:46 <ph88^> hey guys, i'm using this function https://hackage.haskell.org/package/conduit-combinators-1.1.1/docs/Data-Conduit-Combinators.html#v:sinkVector why is it slower than going to list first? https://bpaste.net/show/5cf3431109e3
14:46 <clamchowder> using parsec
14:47 <hexagoxel> Lokathor: text just omits an additional "show"
14:47 <Lokathor> ph88^, "growing the vector as necessary to fit more elements.", maybe you're doing too many reallocations?
14:47 <ph88^> Lokathor, how can i check if i do too many ?
14:48 bennofs joined
14:48 Sh4rPEYE joined
14:48 <Lokathor> ph88^, well I don't know. But it should generally be faster to use a Vector, so that's all I can think of
14:49 bennofs joined
14:49 Laney joined
14:50 dni joined
14:50 <clamchowder> I thought of doing lookAhead first and then get the s: lookAhead $ (noneOf " ") >> (manyTill anyChar $ try $ (noneOf $ " *") >> (char '*')
14:50 Levex joined
14:50 <Lokathor> hexagoxel, okay but what I want, if I was not clear, is the ability to say (smartPrint val) and have that act like (print val) for any type that's not String, and (putStrLn val) for String values. Particularly also, (smartPrintMany [thing1, thing2, etc])
14:51 <clamchowder> I thought of doing lookAhead first and then get the s: do{ char '*'; lookAhead $ (noneOf " ") >> (manyTill anyChar $ try $ (noneOf $ " *") >> (char '*'); manyTill anyChar (char '*')}
14:51 rblaze joined
14:51 wroathe joined
14:51 <Lokathor> but as far as I've ever seen you can't create an easy to use version of python's print statement in Haskell
14:51 <hexagoxel> Lokathor: i'd agree that needs either a new typeclass or an additional Data constraint.
14:52 <mniip> Lokathor, one se
14:52 <mniip> c
14:52 <lyxia> Lokathor: what you proposed works if you just add an {-# OVERLAPPING #-} pragma
14:52 <Lokathor> hexagoxel, hmmmm, I don't think that such a typeclass can easily be made... but tell me about this Data constraint?
14:52 skrnnm joined
14:52 <clamchowder> but this will not parse say "*a*" because the lookAhead rejects because the inside "a" has length 1
14:53 <Lokathor> lyxia, interesting suggestion. will it just pick the more specific instance when things overlap?
14:53 <lyxia> yes
14:54 <hexagoxel> Lokathor: you could generically traverse the input, wrapping all Strings in a newtype wrapper that has a different Show instance. then `show`.
14:54 <mniip> :t showStr
14:54 <lambdabot> ShowStr' a (ShowIsStr a) => a -> String
14:54 primal joined
14:54 <mniip> > showStr ("foo", 123, ["bar"])
14:54 <lambdabot> "(\"foo\",123,[\"bar\"])"
14:54 <mniip> > showStr "asd"
14:54 <lambdabot> "asd"
14:55 prophile joined
14:55 bennofs joined
14:56 sproingie joined
14:56 <Lokathor> that seems right ish
14:56 ErinvanderVeen joined
14:56 <Lokathor> i have to leave the house in 5 minutes, unfortunately
14:56 yqt joined
14:57 oisdk joined
14:57 fotonzade joined
14:57 <hexagoxel> i thought you wanted "(foo,123,[bar])"
14:58 <Lokathor> i do
14:58 <Lokathor> yeah seems to be right
14:58 <hexagoxel> :t everywhere'
14:58 <lambdabot> error: Variable not in scope: everywhere'
14:59 <hexagoxel> ah, nevermind. lambdabot has no syb.
15:00 <mniip> python wouldn't do "(foo,123,[bar])"
15:00 osa1 joined
15:00 osa1 joined
15:01 bennofs joined
15:01 epsilonhalbe joined
15:01 <Lokathor> mniip, you're right, but i've gotta go sadly
15:01 <Lokathor> perhaps we can fret over this another time
15:01 wroathe joined
15:02 ramennoodle joined
15:02 yamad joined
15:02 Itkovian joined
15:02 bjz joined
15:02 <hexagoxel> Lokathor: you can write what i have in mind using syb: everywhere, one of the "ext" functions, and a newtype.
15:02 <mniip> print calls __str__, and while str's __str__ is id, most structures' __str__ invoke __repr__ on the parts
15:02 ramennoodle left
15:03 cschneid_ joined
15:03 <mniip> so print(foo) -> foo.__str__(), print([foo]) -> "[" + foo.__repr__() + "]"
15:03 <* hackage> som 9.0.2 - Self-Organising Maps. https://hackage.haskell.org/package/som-9.0.2 (AmyDeBuitleir)
15:03 JakePeralta joined
15:04 primal_ joined
15:04 uglyfigurine joined
15:05 Khisanth joined
15:05 juanpaucar joined
15:05 <shapr> good MORNING!
15:06 |sync| joined
15:07 plugin joined
15:08 prophile joined
15:10 SkyPatrol_ joined
15:10 tsmish joined
15:11 <maerwald> shapr: you're discriminating people in other timezones!
15:11 <plugin> I have a call to storablevector withStartPtr that appears to be throwing a runtime error: "printf: argument list ended prematurely" I'm not sure how to proceed tracking down the issue. could anyone advise? gist is here: https://gist.github.com/o1lo01ol1o/6744a18c973407facb11aa3f121373d4
15:11 <cocreature> what’s the upper limit on the number of constructors a type can have?
15:12 wroathe joined
15:12 <cocreature> INT_MAX or is it something significantly smaller?
15:12 <shapr> maerwald: it's not really morning here either
15:12 <mniip> cocreature, iirc there are no restrictions
15:12 <mniip> so probably on the scale of INT_MAX
15:12 <cocreature> mniip: alright, thanks
15:13 <shapr> cocreature: If you find out, I want to hear about it.
15:13 mac10688 joined
15:13 eklavya joined
15:13 <shapr> I suspect compiling a module with INT_MAX constructors will be slow.
15:13 <cocreature> yeah, although I won’t get in the order of INT_MAX but it might be a few hundred
15:13 dni joined
15:13 Bardusbasium joined
15:14 <cocreature> I guess I can always fallback to pattern synonyms and hope they compile faster
15:14 primal joined
15:14 <mniip> a thousand cons compiles just fine
15:14 <cocreature> great, I should be safe then
15:14 <shapr> mniip: how did you discover that?
15:15 <mniip> > ("data D=" ++) $ intercalate "|" $ map (\x -> "C" ++ show x) [1..1000]
15:15 <lambdabot> "data D=C1|C2|C3|C4|C5|C6|C7|C8|C9|C10|C11|C12|C13|C14|C15|C16|C17|C18|C19|C...
15:15 <mniip> copy-paste
15:15 <EvanR> and the case expression will probably end up being a table, so thtas not that slow
15:16 <EvanR> haskell rox
15:16 <shapr> yes!
15:16 Guest87_ joined
15:16 <shapr> I'm building a simple REST API comparison, Haskell/Spock vs Python/Flask
15:16 <shapr> flask is making me sad in many ways :-/
15:17 <EvanR> pretty bad if the other thing in the comparison is making you too sad to finish the comparison
15:17 <shapr> persistent includes db migrations
15:17 <shapr> EvanR: I'm giving a talk, so I will finish the comparison, but golly Haskell is nice.
15:17 <EvanR> i dont know much about flask
15:17 <EvanR> maybe ill check out that talk
15:18 <shapr> A cup of monads, an ounce of persistence, a pinch of lucid html templating.
15:18 sgflt joined
15:18 <shapr> EvanR: I haven't tried to arrange a video recording, but I'll see if I can do that.
15:19 erikd joined
15:19 <hanna> If I call a C++ function from a C shim and this C++ function throws an exception when the C shim is called via the FFI, what happens?
15:19 <EvanR> when and where?
15:19 <shapr> EvanR: Atlanta, two weeks from now.
15:19 <hanna> Do I get an IOException?
15:19 <mniip> with TH, I just defined a datum with 10k constructors
15:19 <mniip> albeit it took multiple seconds
15:19 <mniip> for anyone who wants to experiment,
15:19 <mniip> $(return $ return $ DataD [] (mkName "D") [] Nothing (map (\x -> NormalC (mkName $ "C" ++ show x) []) [1..10000]) [])
15:19 <EvanR> hanna: havent tried it, but i would guess an instant crash
15:20 <EvanR> via the default C++ exception mechanism
15:20 <shapr> EvanR: I could give the talk again at HacBoston, will you be there?
15:20 <hanna> EvanR: okay
15:20 <ij> Do I talk nix+haskell here or elsewhere?
15:20 jgertm joined
15:21 jmiven joined
15:21 zero_byte joined
15:23 <EvanR> shapr: having trouble finding hac boston info
15:23 <shapr> yeah, someone needs to put together a website, probably me :-/
15:23 <EvanR> sounds cool
15:23 <shapr> but hey, I can use this Spock thing for that!
15:23 <shapr> It's one of the three middle weeks in July
15:23 <shapr> EvanR: you're nawlens?
15:23 <EvanR> i can also zipper to atlanta potentially
15:23 <EvanR> yes
15:24 flatmap13 joined
15:24 levex_ joined
15:24 <shapr> I should visit there more often, last time was the Jazz Festival two years ago.
15:25 <EvanR> i am all that there is of haskell here period
15:25 kmels joined
15:25 <shapr> I feel that way about Atlanta sometimes.
15:25 <EvanR> which as far as web dev goes isnt much at all
15:25 <EvanR> since i dont do web dev haskell
15:25 <shapr> spock / persistent / lucid is easier than I expected/remembered.
15:26 NoCreativity joined
15:26 hybrid joined
15:26 grayjoc joined
15:26 <ph88^> is there any way i can see the chunks of memory that are being allocated by my program?
15:26 <EvanR> i need to try all that stuff, im just scared of the library complexity
15:26 <shapr> EvanR: it's surprisingly simple. I started with the spock.li tutorial that serves up json from a sqlite db
15:27 <shapr> then last night I grabbed spock-examples from github and re-learned some lucid.
15:29 pbogdan joined
15:29 dbmikus joined
15:29 wroathe joined
15:29 juanpaucar joined
15:31 ons joined
15:33 juanpaucar joined
15:33 primal_ joined
15:35 Levex joined
15:36 SpinTensor joined
15:36 <EvanR> ph88^: theres ghc-viz
15:39 Swizec joined
15:40 eacameron joined
15:41 ianandrich joined
15:41 <EvanR> shapr: ill be on the lookout for these itineraries
15:43 afarmer joined
15:44 primal joined
15:44 joeytwiddle joined
15:44 oisdk joined
15:45 pelegreno___ joined
15:46 raynold joined
15:47 oisdk joined
15:48 Sailor4772 joined
15:48 augur joined
15:48 zcourts joined
15:48 masquerade joined
15:48 razwelles joined
15:49 shapr joined
15:49 wroathe joined
15:50 stvc joined
15:50 shapr joined
15:50 <hanna> acid-state question: I'm processing a few hundred posts per second and storing a log of posts that have been processed (as ID intervals); would it be a bad idea to issue an Update for every single post storing only the `id :: Int`? Right now I'm essentially doing them in batches and then issuing storing an interval (Int, Int) for every couple of hundred, but I'm having difficulties with this approach since I
15:50 <hanna> can end up in an inconsistent state if the process crashes after processing a post but before reaching the next “checkpoint”
15:51 <hanna> Issuing an Update per post would remove this problem, but I'm worried about performance / efficiency issues
15:51 jmelesky joined
15:52 jdnavarro joined
15:52 <EvanR> each update just append data to a log
15:52 james999 joined
15:52 <hanna> yeah but I'm worried about the log growing too quickly if I append to it per post rather than per X hundred posts
15:52 kennyp joined
15:52 <hanna> and as far as I can tell acid-state doesn't automatically trim the log?
15:53 <EvanR> the real work would be done on checkpoint or recovery
15:53 Sailor joined
15:53 mothcoffin joined
15:53 tabaqui joined
15:53 yellowj joined
15:53 <EvanR> premature optimizsation!
15:53 primal_ joined
15:54 aconz2` joined
15:54 eazar001 joined
15:54 romank joined
15:55 saurabhnanda joined
15:55 urodna joined
15:55 <saurabhnanda> is there an easy way to set field's value, via lenses, only if the source value is not Nothing. Sample code: https://gist.github.com/saurabhnanda/ca405b6c580de3c4e5452b65f2e6ff8b
15:55 <hanna> EvanR: I'm asking to see if anybody has an answer before I have to go and benchmark it
15:55 afarmer joined
15:56 <brynedwards> shapr: :o I just finished writing that Spock REST tutorial like a week ago. How did you find it?
15:56 conal joined
15:56 govg joined
15:57 <sdx23> hanna: you already got the answer. If you're concerned about the data, do updates. Checkpointing is sensible to faster load the state on application startup but otherwise not needed.
15:58 sproingie joined
15:58 sproingie joined
15:58 maarhart joined
15:58 eacameron joined
15:58 Johan_L joined
15:59 anodium joined
15:59 Swizec joined
16:00 <lyxia> saurabhnanda: depSingular %~ (<|> Just (lookupHStore h "..."))
16:00 wroathe joined
16:00 simukis joined
16:00 <saurabhnanda> lyxia: how exactly did you figure that out?!
16:00 <saurabhnanda> ...teach a man to fish...
16:01 <saurabhnanda> lyxia: where is <|> coming from?
16:01 <lyxia> saurabhnanda: Alternative from Control.Applicative
16:01 Sonolin joined
16:02 joco42 joined
16:02 <saurabhnanda> lyxia: and what's the difference between .~ and %~
16:03 <lyxia> If you want to set a value only in place of Nothing, that's what <|> is good for.
16:03 eschnett joined
16:03 <lyxia> but using <|> you actually get a function to *modify* the field, rather than *set* it, hence %~ over .~
16:04 <saurabhnanda> lyxia: couldn't match Text with Maybe (Maybe Text)
16:04 primal joined
16:04 <lyxia> ah I think I mixed things up
16:04 <lyxia> is the field not a Maybe?
16:04 <saurabhnanda> I'm trying to set a value only if the **incoming** value is not nothing.
16:04 <saurabhnanda> the record field is not Maybe. The value being set is a Maybe.
16:04 <lyxia> ahhh
16:05 <saurabhnanda> it's the reverse thing
16:05 <lyxia> okay sorry, I would pattern match on the incoming value
16:05 <saurabhnanda> system has a bunch of default values. Override only if the user specifies Just x
16:06 <saurabhnanda> filed https://stackoverflow.com/questions/44184898/how-to-override-a-default-value-via-lenses-only-if-incoming-value-is-not-nothi
16:06 <saurabhnanda> I'm sure there's a combinator lurking in the lens library somewhere.
16:07 <lyxia> I doubt it
16:07 Swizec joined
16:09 tromp joined
16:09 <lyxia> DD.def @Nouns & maybe id (depSingular .~)
16:09 <lyxia> DD.def @Nouns & maybe id (depSingular .~) (lookupHStore h "...")
16:10 <hanna> sdx23: EvanR: I gave it a test. Ran it for 10 million insertions; the “naive” approach (run update per post) gave me an acid-state dir the size of ~1 MB, and the “smart” approach (run update in batches of 1000) gave me an acid-state dir the size of ~1 GB
16:10 wroathe joined
16:10 <hanna> so it does seem like acid-state dir size, and presumably performance, correlates 1:1 with the frequency of events you issue
16:10 Swizec_ joined
16:11 <hanna> let's see if adding createCheckpoint+createArchive helps
16:12 <saurabhnanda> lyxia: (DD.def Nouns) & depSingular %~ (\x -> maybe x id (lookupHStore h "dep_label_singular"))
16:13 OscarZ joined
16:13 connrs joined
16:13 samvher joined
16:14 <sproingie> i wonder why acid-state would need so much more space once a transaction was committed. do i misunderstand how it works?
16:15 <lyxia> saurabhnanda: also works
16:15 OscarZ joined
16:16 <saurabhnanda> thanks!
16:16 <hanna> Indeed, with createArchive those ~1GB are moved to a separate subdir `Archive`
16:17 fakenerd joined
16:17 <hanna> Why doesn't acid-state support automatically deleting them? I struggle thinking of a use case in which keeping old archives around is useful
16:17 <hanna> Since it's not like acid-state supports rollback
16:18 brailsmt joined
16:19 sellout- joined
16:20 <EvanR> hanna: disk space is usually not a concern in acid state
16:20 <EvanR> its memory
16:20 <sproingie> disk space is always a concern if it grows without bound
16:20 cdg joined
16:20 <hanna> I have the opposite issue; my working set is tiny (a few kB) and I'm generating massive amounts of changes
16:21 <hanna> on the order of gigabytes
16:21 <hanna> Storing all that seems ridiculous
16:21 <EvanR> if you find out the Archive is not used
16:21 <* hackage> line 3.1.0 - Haskell SDK for the LINE API https://hackage.haskell.org/package/line-3.1.0 (noraesae)
16:21 <EvanR> you can periodically delete it if it exists
16:21 <hanna> Indeed, I can; I'm puzzled as to why acid-state does not do this automatically
16:21 <hanna> it seems like it's designed to fail
16:21 <EvanR> hanna: to support acid, you really have to keep it around
16:21 <hanna> But why? the docs explicitly mention you can delete Archive as you see fit
16:22 <hanna> so clearly it's no longer needed
16:22 <EvanR> to support acid you have to keep the log until you checkpoint
16:22 <sproingie> external housekeeping can be a real pain, now you need your cron job to understand your app, at least where it lives
16:22 <EvanR> so youre going to use a lot of disk space
16:22 <EvanR> but the archive, im not sure
16:22 <sproingie> tho in the case of a single archive dir, that's hardly onerous
16:23 <EvanR> the behavior of your apps wrt to disk space usage is always an external issue
16:23 <EvanR> call sysops if you run out of space
16:23 <EvanR> get more
16:23 <EvanR> luckily this archive is not used and so cant reduce performance until you run out of disk
16:23 <sproingie> yah, as external housekeeping goes it's not so bad
16:24 saurabhnanda joined
16:24 mstruebing joined
16:24 <sproingie> unlike cassandra. if you forget to clean that regularly, the whole cluster will bog down til it falls over
16:24 <EvanR> "historically" disk is not the concern $-wise
16:24 <hanna> I mean the standard fix here for me will be inserting a removeDirectory (acidDir </> "Archive")
16:24 <hanna> but I'm annoyed by having to hack like this
16:24 <EvanR> right after checkpointing
16:25 <EvanR> makes sense
16:25 <mniip> ski, ooh, I recently came up with a thing related to SEC, you might wanna take a look
16:25 bennofs_matrix joined
16:25 <EvanR> you could also submit a pull request to disable the archive
16:25 <* hackage> glirc 2.21.1 - Console IRC client https://hackage.haskell.org/package/glirc-2.21.1 (EricMertens)
16:25 saussure joined
16:25 <sproingie> there's an inflection point where more disk costs a *lot* more
16:25 <hanna> I'll give it a shot
16:25 <EvanR> sproingie: it doesnt sound like hanna is anywhere near this amount
16:25 <sproingie> but ok, not the worst maintenance headache
16:26 oisdk joined
16:26 <EvanR> hanna: in the case that there is a bug in acid state, this archive is probably the only way to recover
16:27 <EvanR> so if this was mission critical probably good idea to not delete it
16:27 <hanna> I suppose that makes sense
16:27 <johnw> mniip: where is it at?
16:27 <hanna> Still, a “trimLog” function would make sense
16:27 <hanna> I'll try implementing it and submit a PR
16:27 <EvanR> trimlog = checkpoint
16:27 <mniip> one sec, lpaste is lagging
16:27 arpl left
16:27 <EvanR> deleteBackupArchive would make sense
16:27 drewbert joined
16:28 <hanna> I mean I basically need to copy/paste the createArchive code but remove the part that saves them
16:28 osa1 joined
16:28 osa1 joined
16:28 eacameron joined
16:28 <sproingie> could make it so if Archive isn't writable, it warns (once) then ignores it thereafter
16:28 <EvanR> you probably need to actually save it
16:28 <ski> mniip : hm ?
16:28 <EvanR> then delete it after the checkpoint completes, and syncs
16:28 <EvanR> tricky
16:28 <EvanR> like hard syncs
16:29 <mniip> johnw, ski, basically, the FlipT/Apply here: http://lpaste.net/355313
16:29 <EvanR> which may not make sense in case of NFS
16:29 <sproingie> nothing makes sense with NFS
16:29 <mniip> the thing we're doing is, making a datatype with a certain type parameter being the last argument
16:30 <sdx23> EvanR: don't mix up checkpoints and archives. Archives is (superfluous) Log moved to a different directory after a checkpoint was made.
16:30 <EvanR> makes sense
16:30 <EvanR> i dont know how acid state does it
16:30 <sproingie> undeletable .nfsargebargle files, those were the bane of my existence at my last $workplace
16:30 wroathe joined
16:30 <hanna> updating the acid-state per post also provides some major performance issues even on tmpfs where sync() should be essentially free; issuing 10 million ioctls vs issuing 10k ioctls is a question of ~1 min vs ~1 second
16:30 <hanna> although I think I could live with ~1 min extra time per 10 million posts
16:30 <mniip> consider something like natVal :: KnownNat n => p n -> Integer
16:31 <mniip> what if your 'p' doesn't have a nat argument in last position
16:31 <hanna> but I'm worried about sync() per post on HDD
16:31 <EvanR> hanna: it sounds like youre more worried about idempotence here than very granular acid
16:31 <ph88^> anyone know snoyberg ?
16:31 <hanna> I think I'll go the hard way after all, which is basically modifying my code to use DB transactions in order to synchronize the db_commit with the acid_update
16:31 <EvanR> which you could exploit to get more thoughput
16:31 <johnw> ph88^: if I admit that I do, what sort of question will follow?
16:32 <mniip> :t ((), 'a', True)
16:32 <lambdabot> ((), Char, Bool)
16:32 <mniip> :t FlipT $ Apply ((), 'a', True)
16:32 <lambdabot> FlipT Apply Bool ((,,) ()) Char
16:32 <mniip> :t FlipT $ FlipT $ Apply ((), 'a', True)
16:32 <lambdabot> FlipT (FlipT Apply Bool) Char (,,) ()
16:32 <mniip> and so on
16:32 <ph88^> johnw, i was a bit shut down, don't understand why
16:33 sellout- joined
16:33 <ski> mniip : that's nice :)
16:34 kaychaks joined
16:34 Johan_L joined
16:34 primal_ joined
16:34 <mniip> you can also "extract" the 'n' from 'P (Q n D)' with Compose
16:34 mjs2600 joined
16:35 <mniip> :t FlipT $ Compose $ Just (Left 'a')
16:35 <lambdabot> FlipT (Compose Maybe) b Either Char
16:35 <ski> mniip : now i'm wondering whether `induce4 = unwrap . unflop . unflop . unflop . induce . flop . flop . flop . wrap' could be shrunk (avoiding conceptual repetition, DRY) to something like `induce4 = (wrapping . flopping . flopping . flopping) induce'
16:35 <mniip> ski, not for 'induce'
16:35 <mniip> because RankN
16:35 <mniip> would involve dependent types
16:35 <ski> yea, i was fearing that that might be a problem here
16:35 <sproingie> floperators
16:35 zariuq joined
16:36 <mniip> well, sure, you could write a 'flopping'
16:36 <sproingie> you just can't read that code aloud and not giggle
16:36 <mniip> but it would be specialized to 'forall n. n -> (n + 1)'
16:36 <* ski> has been thinking, on and off, about something similar, for equality (and possibly also inequality) chain proofs
16:36 <mniip> i.e not useful in general
16:37 <mniip> you know, the best part is the backwards type inference
16:37 <mniip> where you don't see the FlipT types but see the type you're dismantling
16:38 <mniip> :t natVal
16:38 <lambdabot> error: Variable not in scope: natVal
16:38 <ski> it's nice, yes
16:38 bablisok joined
16:38 <mniip> :t natVal
16:38 jadrian joined
16:38 <lambdabot> KnownNat n => proxy n -> Integer
16:38 <mniip> :t natVal . Apply
16:38 <lambdabot> KnownNat n => f n -> Integer
16:38 <mniip> :t natVal . FlipT . Apply
16:38 <lambdabot> forall l (n :: Nat) (f :: Nat -> l -> GHC.Types.*) (b :: l). KnownNat n => f n b -> Integer
16:38 <mniip> :t natVal . FlipT . FlipT . Apply
16:38 <lambdabot> forall l l1 (n :: Nat) (f :: Nat -> l -> l1 -> GHC.Types.*) (b :: l) (b1 :: l1). KnownNat n => f n b b1 -> Integer
16:39 Swizec joined
16:39 <mniip> :t natVal . Compose . FlipT . FlipT . Apply
16:39 <lambdabot> forall k1 l l1 (n :: Nat) (g :: Nat -> k1) (f :: k1 -> l -> l1 -> GHC.Types.*) (b :: l) (b1 :: l1). KnownNat n => f (g n) b b1 -> Integer
16:39 <mniip> stuff like that
16:39 <mniip> really cool imo
16:39 <* ski> nods
16:40 <ski> having to choose a particular argument ordering can be annoying, at times
16:40 <mniip> now you don't have to!
16:40 wroathe joined
16:41 <jadrian> stack can't search/suggest missing packages by looking at imports can it?
16:41 <ski> but getting lost in a forest of `Flip's,&c. haven't seen that fun, either
16:41 <ski> this may be a nice partial solution
16:41 ErinvanderVeen joined
16:43 simukis joined
16:44 <jadrian> mniip, ski: I wasn't following the conversation, but just to be clear, you're not talking about argument order in the general case right?
16:44 <cocreature> jadrian: jadrian it can but only if they are already installed (but not in build-depends)
16:44 <jadrian> that is, this is not about being able to define a functior on `b` for an `F b a`
16:44 <mniip> jadrian, we're talking about argument order in type constructors
16:44 <mniip> uhh
16:44 <mniip> no
16:44 unK_ joined
16:45 <jadrian> cocreature: oh I see
16:45 <mniip> jadrian, not in this particular case. We're talking about a class of functions that operate on 'forall p. p b'
16:45 <mniip> and fitting a 'F b a' into such a function
16:46 <mniip> for functors you might want to look at edwardk's Hask Functor
16:46 <mniip> that does some really cool stuff
16:46 <jadrian> mniip: don't know it, got to check it out
16:46 <wilornel> can you have a definition like so? `data MyFoo = MyFoo { name :: String, bar :: (a -> b) }? As in, bar would be an incomplete data type?
16:47 <jadrian> wilornel: incomplete? you mean because of the `a` and `b`?
16:49 <liste> wilornel: you can have "data MyFoo a b = MyFoo { ... }" OR use a GADT
16:49 <sproingie> i'd love it if IDE support meant it could reorder args as a one-click fix
16:49 <liste> wilornel: a GADT is like "data MyFoo where MyFoo :: String -> (a -> b) -> MyFoo"
16:50 Swizec joined
16:50 eacameron joined
16:50 <liste> wilornel: (or, with less confusing constructor name) a GADT is like "data MyFoo where MkMyFoo :: String -> (a -> b) -> MyFoo"
16:51 <sproingie> i always liked that ocaml has named args. though not so much the syntax
16:51 wroathe joined
16:51 <liste> (not sure how records and GADT's mix, maybe someone else is?=
16:51 <sproingie> GADTs with record labels is a thing
16:52 shivansh joined
16:52 shivansh left
16:52 <sproingie> there's some (sensible) restrictions on overlap
16:53 armyriad joined
16:54 primal joined
16:54 <mniip> liste, you can write record GADTs
16:54 <liste> @define data Foo where Foo :: { bar :: String, baz :: a -> b } -> Foo -- wilornel
16:54 <lambdabot> Defined.
16:54 <mniip> hmm
16:54 <mniip> last time I checked lambdabot had issues with record gadts
16:54 t7 joined
16:55 jgertm joined
16:55 <wilornel> jadrian: Incomplete as in a possible candidate for bar would be `(,) 1`
16:55 fendor joined
16:55 <liste> > let foo = Foo { bar = "hi there", baz = id } in (baz foo) 5
16:55 <lambdabot> error:
16:55 <lambdabot> • Cannot use record selector ‘baz’ as a function due to escaped type var...
16:55 <lambdabot> Probable fix: use pattern-matching syntax instead
16:56 <mniip> your foralls are backwards
16:56 <mniip> you're letting a skolem tyvar escape
16:56 ErinvanderVeen joined
16:56 <liste> yeah
16:56 <mniip> hmm
16:56 <mniip> @define data D where D :: forall a. { field :: forall f. f a } -> D
16:56 <lambdabot> Parse failed: Parse error: {
16:56 <mniip> there
16:56 <wilornel> so for MyFoo, could I have `MyFoo "TheString" ( (,) 1 ) ?
16:56 <liste> that's the problem you mentioned?
16:56 <mniip> yes
16:57 <mniip> came up naturally when I tried defining natural transformations
16:57 fragamus joined
16:57 <ph88^> where can i find the actual exectuable in a stack project? so far i've only been using stack exec
16:57 texasmynsted joined
16:57 <mniip> data NT (k :: kk -> kk -> *) (l :: ll -> ll -> *) (f :: kk -> ll) (g :: kk -> ll) where
16:57 <mniip> NT :: (Functor k l f, Functor k l g) => { runNT :: forall a. Ob k a => l (f a) (g a) } -> NT k l f g
16:58 <wilornel> I'm so confused
16:58 <EvanR> what is a skolem tyvar
16:58 <mniip> EvanR, skolemized type-variable
16:58 <liste> ph88^: .stack-work/dist/...
16:58 <EvanR> yeah what is that
16:58 <mniip> think like...
16:59 <mniip> foo :: (forall a. a -> b) -> b
16:59 <EvanR> yeah
16:59 <mniip> if you say 'foo id'
16:59 <mniip> that would be foo id :: a
16:59 <mniip> where a is from the 'forall a'
16:59 <Sonolin> are orphan instances a bad idea?
16:59 gestone joined
16:59 <mniip> but that would mean the type variable would escape its scope
16:59 <sproingie> Sonolin: they're a code smell. sometimes unavoidable.
16:59 <EvanR> wait, foo id is valid?
16:59 <Sonolin> hmm ok
16:59 <mniip> no
17:00 fendoer joined
17:00 <ph88^> how can i make a zip for release ?
17:00 <jadrian> wilornel: I wouldn't call that incomplete
17:00 <EvanR> ok, so back to the question
17:00 <Sonolin> sproingie I ran into them because I'm trying to separate my persistance implementation, from my API
17:00 <mniip> it is invalid exactly because 'a' cannot escape its scope
17:00 <EvanR> whats a skolemized type variable
17:00 <Sonolin> so, for instance, I have a Data.User module which just exports the User types, and then I have an Api.User which implements the actual API (Aeson + Servant)
17:00 <jadrian> liste: you appear to want a record whose second field can take any function
17:01 <Sonolin> and another module Storage.User that implements the persistance backend
17:01 <Sonolin> am I going about this the wrong way?
17:01 <sproingie> Sonolin: if you control both modules, it's not quite "orphaned". the danger is largely from importing a different implementation than expected
17:01 <jadrian> liste: also for some reason you appear not to want to parameterise your datatype over `a` and `b`
17:01 <mniip> EvanR, uhhh
17:01 <liste> jadrian: yeah, I was demonstrating to wilornel how to define a type with type variables in the definition that are not present in the type
17:01 <Sonolin> yea this is all contained in the same project (atm at least) sproingie
17:01 <jadrian> liste: so I would say there are two answers
17:01 merijn joined
17:02 iAmerikan joined
17:02 <jadrian> liste: one answer would be, yes you can have that with existential data types
17:02 <EvanR> which thing in your story is that for example?
17:02 <mniip> a
17:02 <* hackage> esqueleto 2.5.2 - Type-safe EDSL for SQL queries on persistent backends. https://hackage.haskell.org/package/esqueleto-2.5.2 (bitemyapp)
17:02 <EvanR> whats with this terminology?
17:02 <mniip> EvanR, during typechecking of a lambda like this, the type of the argument of 'id' is a type variable that cannot unify with anything
17:02 <jadrian> liste: the other answer would be, most likely you actually want the type constructor to be parameterised even though you don't think you do
17:03 argent0 joined
17:03 begriffs joined
17:03 <ph88^> bbl
17:03 <EvanR> mniip: no? you could pass it const and use it on various things inside the lambfa
17:03 <jadrian> liste: I would be inclined to think it's the latter, at least until you provide for a good reason not want that parameterization
17:03 <sproingie> if classes obeyed visibility rules like everything else, orphan instances would probably be a non-issue
17:03 <mniip> EvanR, when you use a function, e.g (id :: forall a. a -> a) ()
17:03 <mniip> the typechecker unifies a ~ ()
17:04 primal_ joined
17:04 <liste> jadrian: yes, with using existentials you just push the problem around without solving it
17:04 <mniip> when you define a function, (\x -> ...) :: forall a. a -> a, the typechecker says that 'x :: a' but nothing can "displace" a
17:04 Valoo joined
17:04 <mniip> so you can't unify a ~ ()
17:04 <mniip> because that would break the forall
17:04 <mniip> only, maybe, unify some other tyvar with it
17:05 dc0de joined
17:05 <jadrian> liste: well, most likely but I don't know what problem you're talking about, as the only problem you posed was the definition of such a type without parameters
17:05 <EvanR> so that is what a skolemized type variable is
17:05 <EvanR> now what is zonking a skolem
17:05 <jadrian> liste: the existential will solve that problem
17:05 <mniip> zonking is the jargon for substituting
17:05 <jadrian> liste: but yes I don't see how that is useful, so most certainly you'll have other problems
17:05 <sproingie> ZONK ALL THE SKOLEMS
17:05 poissonmann joined
17:05 <jadrian> liste: I don't know what you're trying to do though, and why you don't want those parameters
17:05 <EvanR> ah
17:06 <mniip> well, a bit more specific than that
17:06 <mniip> I'd have to check with the GHC wiki to tell exactly what it includes and what it doesn't
17:06 <jadrian> liste: so it's a bit hard to reason, since I don't really know what it is that you want to solve
17:06 sleffy joined
17:07 chankari joined
17:07 <jadrian> liste: so I guess the best starting point would be to make your case as to why you don't want those parameters there
17:07 <liste> jadrian: me? I'm not doing anything but demonstrating that there can be a type with parameters in the constructor that are not present in the type signature
17:07 <jadrian> what would the problem be
17:07 <liste> jadrian: to wilornel
17:07 <jadrian> liste: and I got confused with names...
17:07 <jadrian> liste: sorry!!
17:07 biglama joined
17:08 <mniip> when you typecheck '(flip :: forall a b c. (a -> b -> c) -> b -> a -> c) (id :: d -> d)', you derive a substitution: [(a -> b) ~ d, c ~ d]
17:08 conal joined
17:08 <mniip> er
17:09 <mniip> [a ~ d, (b -> c) ~ d]
17:09 tommd joined
17:09 connrs joined
17:09 perrier-jouet joined
17:09 <liste> jadrian: no problem :)
17:09 <mniip> zonking is the stuff that turns '(type variable mess). b -> a -> c' into 'forall b c. b -> (b -> c) -> c'
17:09 tromp joined
17:10 <mniip> or something like that
17:10 <mniip> or related to that
17:10 <mniip> aha
17:10 cdg joined
17:10 <mniip> according to GHC wiki, zonking is both, because type variables are mutable cells
17:11 wroathe joined
17:12 <EvanR> thats what i thought
17:12 <mniip> the latter is, I assume, tidying
17:12 <EvanR> the mutation process of the unification algorithm
17:13 sphinxo joined
17:13 <sproingie> zonking sounds a lot like instantiation
17:13 <EvanR> that cant be it
17:13 <EvanR> thats instantiation
17:14 primal joined
17:15 <mniip> sproingie, would you call 'a ~ f b' instantiation
17:16 Bardusbasium_ joined
17:16 <mniip> or even, would you call 'a ~ b' instantiation
17:16 <sproingie> ah, no. i'm going by the smattering of info and seeing "substituting variables with actual types" and the analogy popped in my head
17:17 <EvanR> actual types, not actors
17:18 rblaze joined
17:18 Elish joined
17:19 gestone joined
17:21 asm_ joined
17:21 al-damiri joined
17:21 wroathe joined
17:23 govg joined
17:23 mjs2600 joined
17:24 teggi joined
17:27 perrier-jouet joined
17:27 Bassetts joined
17:30 Kon joined
17:31 <EvanR> i just converted (4, Just 'c') to Just (4,'c') with sequence, am i missing a more general version
17:31 samvher joined
17:31 <sproingie> they're not exactly isomorphic
17:31 <srhb> I seem to get InvalidUrlException no matter what I try to pass to a http-proxy app. Has anyone used this successfully, and what's a test request I can try?
17:31 <EvanR> huh
17:32 <EvanR> :t sequenceA
17:32 <lambdabot> (Applicative f, Traversable t) => t (f a) -> f (t a)
17:32 <EvanR> ah ha
17:33 <EvanR> the haskell goddess sequencea
17:33 <Kon> I want to learn data structures , should I learn it language agnostic and then try to implement in haskell or is it better to learn it directly in haskell
17:34 primal_ joined
17:34 <glguy> You'll never be done learning data structures, and will do well to implement what you're learning as you go
17:34 cretiq joined
17:35 halogenandtoast joined
17:35 <Kon> So which book is recommended for learning data structure functional way
17:36 <liste> @where okasaki
17:36 <lambdabot> http://www.cs.cmu.edu/~rwh/theses/okasaki.pdf
17:36 <liste> Kon: ^ that, and the book version
17:37 <liste> https://www.amazon.com/Purely-Functional-Structures-Chris-Okasaki/dp/0521663504
17:37 <Tuplanolla> A typical cycle goes as follows, Kon: set out to solve a problem, reinvent something in the process, realize you did and read all about how someone else did it better.
17:38 eacameron joined
17:38 <Kon> Thank you all for your help :)
17:38 <sproingie> okasaki might be a tad heavy. classic data structures books work all right if you pay particular attention to recursive data structures
17:39 osa1 joined
17:39 <jadrian> Kon, liste, sproingie: was about to say the same, Okasaki is pretty heavy for first timers. If that's the case I'd recommend this: www.iro.umontreal.ca/~lapalme/Algorithms-functional.html
17:39 pmade joined
17:40 <EvanR> sproingie: many of art of computer programming algorithms just dont translate to haskell
17:40 <Cale> Tuplanolla: Another typical cycle goes as follows: Set out to solve a problem, look for what others have done in that space, realise it's all terrible, branch the closest thing to being reasonable and hope that the upstream maintainer is still alive.
17:40 <maerwald> EvanR: idiomatic haskell you mean
17:40 <EvanR> yeah
17:40 oisdk joined
17:40 <maerwald> I like the quicksort example https://augustss.blogspot.de/2007/08/quicksort-in-haskell-quicksort-is.html
17:40 <Tuplanolla> Let's not crush their spirits yet, Cale.
17:41 <sproingie> yah AoCP is particularly yuck in that regard, self-modifying MIX code
17:41 <sproingie> great if you like a turing machine model of computation, not so good otherwise
17:42 alfsten joined
17:42 <EvanR> hmm
17:43 <jadrian> sproingie: I do (somewhat) disagree with the notion that classic data structures are that helpful though, even if you focus on recursive
17:44 <sproingie> jadrian: they're plenty useful, just focus on the actual structure and not the imperative implementation
17:44 replay joined
17:44 <jadrian> sproingie: well, a circular linked list is recursive
17:44 <jadrian> sproingie: that's not going to help you much
17:45 <jadrian> sproingie: the notion of state is fundamental
17:45 cables joined
17:45 <EvanR> wouldnt call a circular linked list recursiv
17:45 <sproingie> a linked list certainly is
17:45 <EvanR> since its not an expression
17:45 wroathe joined
17:45 <jadrian> sproingie: and of course you can use Ref's but then you're simulating the imperative approach
17:45 <jadrian> EvanR: the type is
17:45 <EvanR> its a assortment of heap objects
17:45 <nshepperd> it's good to learn about things like bloom filters and such, that aren't really considered 'functional'
17:45 connrs joined
17:46 <sproingie> hell you could do worse than a deep dive into linked lists
17:46 Bardusbasium_ joined
17:46 <nshepperd> (but they're not not functional either)
17:46 <EvanR> jadrian: eh... the type of a circular linked list?
17:46 <jadrian> sproingie: a linked list may be... it isn't if you e.g., put a pointer to each end so you can do a FIFO
17:46 <sproingie> tying the knot on a circular linked list would be a fun exercise
17:46 <EvanR> its a cyclic data structure, not a recursive expression
17:46 DisruptiveNL joined
17:47 <jadrian> sproingie: most things you learn to do with linked lists in C don't translate
17:47 <sproingie> hm yah good point. actually it's as simple as repeating a single list
17:47 <jadrian> sproingie: sure and for that you do need a functional data structures book, that's the point
17:47 <Tuplanolla> Relating to this: does anyone know of nonasymptotic time and space investigations of various data structures?
17:48 <nshepperd> all the different tree data structures are great for functional though
17:48 <sproingie> jadrian: i think we're just talking past each other. i specifically mentioned to look at the structures, not the algorithms
17:48 <nshepperd> i think that's what was meant by recursive
17:48 <nshepperd> trees are sort of inductively defined in a way that circular linked lists aren't
17:49 alfsten joined
17:49 dddddd joined
17:49 <wilornel> I am hitting this weird compilation error. Given `data BinaryTree = Leaf | Node (BinaryTree a) a (BinaryTree a) deriving (Eq, Show, Ord)`, if I do `((Node Leaf (1 :: Integer) Leaf) :: BinaryTree Integer)`, I get • Couldn't match type ‘Integer’ with ‘BinaryTree a’
17:49 <nshepperd> if you take any part of a circular linked list, you have something that isn't a circular linked list
17:49 <wilornel> Expected type: BinaryTree (BinaryTree a)
17:49 <wilornel> Actual type: BinaryTree Integer
17:49 saurabhnanda joined
17:50 <jadrian> sproingie: well, these are structures... a linked list with a pointer to head and tail is a structure
17:50 <sproingie> a linked list with either nil or another linked list is also a structure
17:50 <jadrian> sproingie: I mentioned algorithms because structures are defined with particular goals in mind
17:50 <EvanR> would be nice to have
17:50 <Kon> sproingie: You are talking about learning language agnostic , learning how they works .
17:50 <glguy> wilornel: Your data declaration doesn't match the error message
17:51 <sproingie> Kon: exactly
17:51 <glguy> wilornel: You can paste the actual code and actual error message to http://lpaste.net
17:51 <jadrian> sproingie: yes both are... and my point is while that one example does translate, most won't
17:51 <jadrian> sproingie: check any basic standard course on algorithms and data structures in C, look at the structures that are taught
17:51 <sproingie> the typical examples with the boxes and arrows tend to translate pretty well
17:52 <sproingie> if it's C or java source, not so much
17:52 eacameron joined
17:52 <jadrian> sproingie: no, not really... because for the most part they aren't used in a purely functional way
17:52 <EvanR> sproingie: i dont think it does
17:53 <EvanR> many things you write in haskell are ambiguous as far as that box and arrow goes
17:53 <jadrian> sproingie: circular doesn't work, double linked doesn't work, pointers at both ends doesn't work, etc
17:53 Johan_L joined
17:53 <EvanR> soundness in the presence or absense of sharing..
17:53 <sproingie> closest thing to double-linked i can think of would be a zipper
17:53 ianclark joined
17:54 uglyfigurine joined
17:54 <EvanR> which doesnt give you access to both sides
17:54 <wilornel> glguy: http://lpaste.net/355842 . I was messing around with other things as well. If needed, I can simplify the file
17:55 descender joined
17:55 <glguy> wilornel: you need to attach the error , too
17:55 wroathe joined
17:56 <Tuplanolla> Swap the arguments of the folding function, wilornel.
17:56 coltfred joined
17:57 <wilornel> http://lpaste.net/355842
17:58 sellout- joined
17:58 hive-mind joined
17:58 <glguy> foldTree (\x y -> x) :: b -> BinaryTree b -> b
17:58 <glguy> foldTree (\y x -> x) :: b -> BinaryTree a -> b
17:58 <sproingie> i guess i'm extrapolating too much from my own experience. learned lisp by doing my data structures class in emacs lisp
17:58 <glguy> Like Tuplanolla said
17:59 <wilornel> Ah, right! For some reason flycheck was highlight x and y in red in the proper ordering
17:59 JuanMiguel joined
17:59 <wilornel> Also, I forgot to think about reading this thing from left to right and doing the bindings mentally
18:01 <wilornel> Thank you glguy and Tuplanolla
18:01 dfeuer joined
18:01 path[l] joined
18:03 tzh joined
18:04 mfukar joined
18:05 skeuomorf joined
18:06 wroathe joined
18:07 takle joined
18:08 Valoo joined
18:08 hanna joined
18:08 dc0de joined
18:10 bodisiw joined
18:11 hybrid joined
18:11 erikd joined
18:12 TheInfosphere joined
18:12 _jak joined
18:12 eacameron joined
18:13 brailsmt joined
18:13 joco42 joined
18:13 sighingnow joined
18:14 primal joined
18:14 im0nde joined
18:14 <nshepperd_> Are iorefs expensive in GHC? There must be some special bookkeeping required to make them work with the generational collector?
18:15 coltfred joined
18:15 <EvanR> that special bookkeeping happens with all mutable structures
18:15 <EvanR> beware!
18:15 ErinvanderVeen joined
18:16 zcourts joined
18:16 wroathe joined
18:16 saussure joined
18:17 <nshepperd_> I guess the same problem applies to tying the knot, so there must be a cheap solution
18:19 zcourts_ joined
18:19 <nshepperd_> The problem is that older generations can point to newer generations
18:20 <EvanR> it does degrade performance from what i read
18:20 <sproingie> confine it in a STRef maybe?
18:20 <sproingie> (if applicable)
18:20 juanpaucar joined
18:22 saussure joined
18:23 saurabhn_ joined
18:23 <nshepperd_> I guess maybe we just add the object to a "to be scanned" list whenever it points to something newer. But that sounds bad
18:24 dfeuer_ joined
18:24 carlosda1 joined
18:26 wroathe joined
18:27 Wuzzy joined
18:28 Valoo left
18:29 sellout- joined
18:29 CacoS joined
18:30 flatmap13 joined
18:30 eschnett joined
18:30 zzz joined
18:31 RegEchse joined
18:31 unK_ joined
18:32 brailsmt joined
18:33 erikd joined
18:34 leat joined
18:35 begriffs_ joined
18:36 simukis joined
18:37 Achylles joined
18:40 jleon joined
18:40 osa1 joined
18:40 osa1 joined
18:41 not_on_fp joined
18:46 Bassetts joined
18:46 wroathe joined
18:46 connrs joined
18:47 pbogdan joined
18:48 alx741 joined
18:49 primal joined
18:50 alx741 joined
18:52 brailsmt joined
18:54 primal_ joined
18:57 anodium joined
18:58 watersoul joined
19:00 Croniamental joined
19:01 osa1 joined
19:02 bodisiw joined
19:03 ziocroc2 joined
19:07 wroathe joined
19:09 mac10688 joined
19:12 SkyPatrol joined
19:13 ccomb joined
19:14 primal joined
19:14 joco42 joined
19:15 sssilver joined
19:16 Itkovian joined
19:17 augur joined
19:17 cyborg-one joined
19:18 quobo joined
19:20 mada joined
19:20 bendo joined
19:21 gawen joined
19:22 ziocroc2 joined
19:23 `^_^v joined
19:24 primal_ joined
19:27 wroathe joined
19:28 ziocroc2 joined
19:29 skrnnm joined
19:30 mivael__ joined
19:30 skeuomorf joined
19:30 bollu joined
19:30 <bollu> cocreature: pin
19:30 <bollu> ping*
19:31 connrs joined
19:32 <bollu> @tell cocreature where is CallableOperand in llvm-hs?
19:32 <lambdabot> Consider it noted.
19:32 fnurglewitz joined
19:32 <cocreature> bollu: git grep ftw :)
19:33 <bollu> cocreature: I did try -_^
19:33 <cocreature> oO
19:33 <cocreature> works just fine for me
19:33 <cocreature> it’s in LLVM/AST/Operand.hs
19:33 <cocreature> currently it’s a type synonym but it should really just be a separate type
19:33 <cocreature> bollu: btw I’ve finished the lexer for tablegen.
19:33 <bollu> "type CallableOperand = Either InlineAssembly Operand" ?
19:34 <cocreature> yep
19:34 <bollu> cocreature: ah, that's good, I was considering sitting down and doing that
19:34 primal joined
19:34 <bollu> cocreature: so, should we change this to an actual type with Intrinsic as well?
19:35 <cocreature> yep
19:36 infamis joined
19:37 erikd joined
19:38 wroathe joined
19:38 <* hackage> stutter 0.1.0.1 - (Stutter Text|String)-Utterer https://hackage.haskell.org/package/stutter-0.1.0.1 (nmattia)
19:38 path[l] joined
19:41 zzz joined
19:43 tromp joined
19:44 augur joined
19:44 primal_ joined
19:46 mgu joined
19:46 zzz joined
19:48 dfeuer_ joined
19:48 connrs joined
19:48 esph joined
19:49 Johan_L joined
19:52 dfeuer joined
19:52 JuanMiguel joined
19:53 primal joined
19:54 Coldblackice_ joined
19:55 dfeuer__ joined
19:57 juanpaucar joined
19:58 crosleyt joined
19:58 wroathe joined
19:59 heurist joined
19:59 juanpauc_ joined
20:04 primal_ joined
20:05 jadrian joined
20:08 <bollu> how do I use alex?
20:08 <bollu> https://pastebin.com/V86VRBzR
20:08 <bollu> I'm getting a "Encountered missing dependencies"
20:08 erikd joined