<    June 2018     >
Su Mo Tu We Th Fr Sa  
                1  2  
 3  4  5  6  7  8  9  
10 11 12 13 14 15 16  
17 18 19 20 21 _2_2 23  
24 25 26 27 28 29 30
00:02 erikd joined
00:05 tangmou joined
00:13 unyu joined
00:14 tomku joined
00:14 fizbin joined
00:16 son0p joined
00:17 DTZUZO joined
00:20 chat_ joined
00:24 Linter joined
00:25 Linter joined
00:26 youtmon joined
00:27 dexhunter joined
00:28 alexteves_ joined
00:29 Destol joined
00:31 spadesr joined
00:32 HalfEatenPie joined
00:33 duoi joined
00:34 <maerwald> haha, I got cyclomatic complexity in my editor :>
00:41 jedws joined
00:43 Big_G joined
00:47 XorSwap joined
00:49 patlv joined
00:49 <glguy> Xal: It's common to annotate your AST with the type of annotations and to use position information as the annotation you get on the AST you get from the parser
00:50 blender joined
00:52 tzemanovic joined
00:54 chat joined
00:58 beauby joined
01:02 SCHAPiE joined
01:03 vonfry joined
01:05 markus1199 joined
01:17 athan joined
01:17 jkachmar joined
01:19 patlv joined
01:19 arfy joined
01:20 ammazza joined
01:21 <arfy> hi, haskellites, is there a reason that a simple hello, world type program is around 7.6mb when compiled with ghc? static linking? and is there a way to reduce this? running under win x64
01:22 <Cale> Yeah, pretty much static linking. You could link the thing dynamically, but most people won't have the appropriate libraries, so mostly, don't worry about it.
01:22 <pdxleif> @hoogle Maybe a -> e -> Either e a
01:22 <lambdabot> Control.Error.Safe justErr :: e -> Maybe a -> Either e a
01:22 <lambdabot> Control.Error.Util note :: a -> Maybe b -> Either a b
01:22 <lambdabot> Data.Either.Extra maybeToEither :: a -> Maybe b -> Either a b
01:23 <arfy> Cale: alright! :) Was just curious more than anything
01:24 replay joined
01:24 scottschmidt joined
01:25 blender joined
01:26 cybai joined
01:28 oisdk joined
01:29 <pavonia> On older compilers that was less than a MB. What did happen to the RTS that it grew by a factor of >7?
01:29 <pdxleif> So one library (extra) is described as "Extra functions I use"; the other (Control.Error) apparently has two of the same function, just in different modules.
01:30 freeman42x]NixOS joined
01:31 freeman42x]NixOS joined
01:31 tsaka__ joined
01:33 patlv joined
01:37 scottschmidt joined
01:37 path[l] joined
01:38 oisdk joined
01:40 Guest89 joined
01:41 FreeBirdLjj joined
01:47 Destol joined
01:48 <hololeap> arfy: it's a combination of static linking and that the haskell runtime is pretty beefy
01:49 <hololeap> definitely not suitable for embedded programming, unfortunately
01:50 sagax joined
01:51 <alx741_> has anyone used ivory to write embedded code in an actual application? specially to run in a small microcontroller. The DSL seems great but a bit cumbersome for a whole application
01:56 patlv joined
01:57 <glguy> alx741_: The team that developed Ivory used it to develop an embedded autopilot: https://smaccmpilot.org/
01:59 erikd joined
02:00 <alx741_> glguy: Oh! that's amazing. Was leaning towards Rust for uC embedded, but if they managed to pull that off, maybe is worth a serious try
02:00 hucksy joined
02:01 dogweather joined
02:02 td123 joined
02:03 MoarSpaceFi joined
02:04 beauby joined
02:08 <shachaf> whoa, Conor McBride is giving a talk in SF on Monday?
02:08 <shachaf> How come no one tells me these things?
02:08 mkoenig_ joined
02:16 FreeBirdLjj joined
02:18 <jchia_> How can I trace the chain of modules that reexport (directly or indirectly) a function all the way to where it's originally exported? Can I do this in ghci?
02:18 <jchia_> '
02:18 alx741 joined
02:18 <jchia_> ':i' seems to only tells me where it's originally defined and where it's finally reexported
02:19 banc joined
02:20 eminhi joined
02:21 blender joined
02:28 shadowdaemon joined
02:32 spadesr joined
02:32 arfy left
02:34 lagothri1 joined
02:34 tauta joined
02:37 conal joined
02:38 acertain joined
02:38 stites joined
02:39 rprije joined
02:40 <stites> Hi all! I'm wondering if there is an academic paper on the advantages of purely-functional programming languages for concurrent and parallel requirements
02:41 <stites> Would anyone happen to know of one?
02:41 dogweather joined
02:43 theDon joined
02:43 rcdilorenzo left
02:43 <ammar2> stites: not a full paper on the topic, but the famous paper on concurrency, "Communicating Sequential Processes" has a tiny section and a further reference to pure functional languages
02:43 dxld joined
02:44 <ammar2> the paper referenced in that section is "The semantics of a simple language for parallel programming", and the language presented there is pure functional
02:45 conal joined
02:46 <ammar2> that last bit might be wrong but hopefully that should give you some good leads
02:46 <stites> Awesome! I'm taking a look now.
02:49 codesoup joined
02:49 <stites> Hmm... looks like CSP is saying that, as of 2004, "functional multiprocessing" (which I'm reading as "fp applied to multiprocessing" based on the intro) is a hopeful, but practically infeasible.
02:52 mac10688 joined
02:54 <stites> Oh! These are all about PLT applied to multiprocessing
02:56 jmcarthur joined
02:56 <stites> Okay, thanks @ammar2 -- this is making me realize that I just need to find citations for various modules in base
02:58 conal joined
02:59 scottschmidt joined
02:59 Guest89 joined
03:00 adkron_ joined
03:01 <stites> ...and it looks like all I have to do is look at SPJ's publication page, then scroll down: https://www.microsoft.com/en-us/research/people/simonpj/#!publications
03:02 conal_ joined
03:06 Destol joined
03:06 acertain joined
03:12 woodson joined
03:15 FreeBirdLjj joined
03:19 znack joined
03:22 dogweather joined
03:26 FreeBirdLjj joined
03:26 rprije joined
03:30 Sgeo joined
03:30 lassulus_ joined
03:31 xtreak joined
03:32 vonfry1 joined
03:33 cybai joined
03:34 FreeBirdLjj joined
03:42 Cthalupa joined
03:42 Azel joined
03:47 otto_s joined
03:48 FreeBirdLjj joined
03:48 carlomagno joined
03:53 dogweather joined
03:55 bill__ joined
03:57 FreeBirdLjj joined
04:00 kasra joined
04:04 blankhart joined
04:06 scottschmidt joined
04:07 Linter joined
04:09 starlord123 joined
04:12 emilypi joined
04:14 vonfry2 joined
04:15 Azel joined
04:15 FreeBirdLjj joined
04:16 reggie_ joined
04:17 fmixing joined
04:19 dogweather joined
04:20 scottschmidt joined
04:22 starlord123 joined
04:26 progfun joined
04:27 scottschmidt joined
04:32 Azel joined
04:32 spadesr joined
04:32 scottschmidt joined
04:33 xtreak joined
04:36 starlord123 joined
04:45 dogweather joined
04:45 progfun joined
04:48 scottschmidt joined
04:48 Destol joined
04:54 path[l] joined
04:55 FreeBirdLjj joined
04:55 beauby joined
04:56 language_agnosti joined
04:56 dogweather joined
04:56 blankhart joined
04:57 tsaka__ joined
04:58 olligobber joined
05:00 ImRatedX joined
05:00 rprije joined
05:01 ImRatedX left
05:01 codesoup joined
05:01 ImRatedX joined
05:02 progfun joined
05:02 replay joined
05:02 scottschmidt joined
05:03 ImRatedX joined
05:04 <dmwit> jchia_: I don't believe there's an existing tool for that. Also be aware that it may not be a chain but a full-blown graph.
05:11 Azel_ joined
05:17 darkJedi joined
05:19 skeuomorf joined
05:19 scottschmidt joined
05:20 rschm joined
05:24 woodson joined
05:26 <* hackage> potoki-core 2.1 - Low-level components of "potoki" http://hackage.haskell.org/package/potoki-core-2.1 (IrinaArtemeva)
05:32 codesoup joined
05:33 <darkJedi> hi! I was going through Monad laws to understand them. But I'm unable to understand Right identity. Can anyone explain it to me with an example?
05:33 <darkJedi> I'm referring https://wiki.haskell.org/Monad_laws
05:34 <cocreature> darkJedi: what exactly is confusing you?
05:34 <cocreature> > [1,2,3] >>= return
05:34 <lambdabot> [1,2,3]
05:35 keepLearning512 joined
05:36 <darkJedi> So, on getting the type of (>>=). I get (>>=) :: Monad m => m a -> (a -> m b) -> m b
05:36 <darkJedi> Is return a function over here ? That takes the value from inside the Monad and does some operation and wraps it back in a monad ?
05:37 <cocreature> :t return
05:37 <lambdabot> Monad m => a -> m a
05:37 <monochrom> Set a=b.
05:37 <cocreature> a better way to think of return is that it embeds a value in a monadic context
05:37 ImRatedX_ joined
05:37 <cocreature> > return 1 :: [Int]
05:37 <lambdabot> [1]
05:37 <cocreature> > return 1 :: Maybe Int
05:37 <lambdabot> Just 1
05:38 <darkJedi> oh! okay.
05:40 scottschmidt joined
05:41 <olligobber> > return 1 :: ZipList Int
05:41 <lambdabot> error:
05:41 <lambdabot> • No instance for (Monad ZipList) arising from a use of ‘return’
05:41 <lambdabot> • In the expression: return 1 :: ZipList Int
05:41 <olligobber> that's not what I expected
05:41 <cocreature> > pure 1 :: ZipList Int
05:41 <lambdabot> ZipList {getZipList = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1...
05:41 <olligobber> that's what I expected
05:41 <olligobber> why isn't that a monad?
05:41 <cocreature> try writing an instance :)
05:42 <darkJedi> And left identity ```return a >>= f```. In here ```return a``` will give me ```a wrapped in monad```. And f is a function that takes a monad, unwraps the value applies the operation, wraps it in a monadic context right!
05:43 <cocreature> not quite, f is of type (a -> m b) so it doesn’t “take a monad”
05:44 <darkJedi> oh! okay.
05:44 <cocreature> it might be helpful to think about >>= in terms of fmap and join. x >>= f is equivalent to join (fmap f x)
05:44 <cocreature> so you first apply f to all values in the structure and then you merge the resulting nested structure
05:51 conal joined
05:51 Linter joined
05:53 dogweather joined
05:56 emilypi joined
05:56 scottschmidt joined
05:56 borkr joined
06:01 athan joined
06:07 vlatkoB joined
06:07 dogweather joined
06:11 xtreak joined
06:12 Ariakenom joined
06:13 Nokurn joined
06:13 keepLearning512 joined
06:13 scottschmidt joined
06:15 athan_ joined
06:18 Nokurn joined
06:18 revprez_atlanta joined
06:18 Nokurn joined
06:19 RegEchse joined
06:21 dogweather joined
06:22 keepLearning512 joined
06:25 osa1 joined
06:25 fmixing joined
06:26 <pdxleif> What happened to EitherT? It was in version 4.5 of "either", but it's gone in version 5.0
06:26 <pdxleif> Should I use ExceptT instead?
06:26 jcarpenter2 joined
06:27 <pdxleif> Ah, I see: https://github.com/ekmett/either/commit/543f78bce4bcd8131318b912574d409f59ce6144
06:27 louispan joined
06:29 sha-2 joined
06:30 rschm joined
06:31 acidjnk joined
06:31 athan_ joined
06:33 emilypi joined
06:33 spadesr joined
06:34 FreeBirdLjj joined
06:34 tangmou joined
06:35 fmixing_ joined
06:39 pyx joined
06:39 Saulzar joined
06:40 <* hackage> buffer-builder 0.2.4.6 - Library for efficiently building up buffers, one piece at a time http://hackage.haskell.org/package/buffer-builder-0.2.4.6 (chadaustin)
06:40 vonfry_ joined
06:45 dramforever joined
06:45 SpinTensor joined
06:45 altjsus joined
06:46 daniel-s joined
06:49 <dramforever> Has anyone made, for demonstration purposes, a GHC Haskell program that uses as many syntactic features as possible?
06:50 <dramforever> I kinda want to try out the -ddump-parsed-ast and -ddump-tc-ast options but I don't want to read GHC source :(
06:50 <cocreature> why do you need to read the GHC source to try out a cli arg?
06:50 <cocreature> just, like, try it out?
06:51 blankhart joined
06:52 <dramforever> cocreature: that's a good question
06:52 simukis joined
06:53 vonfry joined
06:53 scottschmidt joined
06:54 obi_jan_kenobi__ joined
06:55 <dramforever> cocreature: Because the dump output looks like this: https://paste.ubuntu.com/p/Q9G6tYZYpR/
06:56 <cocreature> dramforever: do you have some underlying goal here? i.e. what information are you trying to get out of -ddump-parsed-ast?
06:56 <dramforever> My general direction is to write some tooling
06:56 <dramforever> like, we might be able to get local variable completion with this thing
06:57 <cocreature> it sounds like you might be interested in wz1000’s gsoc project
06:57 <cocreature> I don’t think -ddump-parsed-ast is really the way to go. you might as well use the GHC API at that point
06:58 <dramforever> And I don't want to write too much Haskell code (like, more than a ghci invocation)
06:58 <dramforever> Uh
06:58 takuan joined
06:58 <dramforever> Like dante: https://github.com/jyp/dante
06:59 <cocreature> -ddump-parsed-ast just dumps GHC’s internal representation so if that’s what you want, the GHC API is a better choice
06:59 <cocreature> dumping GHC’s internal representation as a string only to then try and parse it to extract information from it doesn’t sound like a good idea
07:01 <dramforever> The dump *does* look quite easy to parse, if only I knew what the { ... } things could be
07:01 ccomb joined
07:02 <cocreature> it’s probably easy to parse but the resulting AST is just the thing that you get from the GHC API
07:02 <cocreature> so you are only making your life harder by first serializing the AST to a string and then trying to parse it
07:02 vlatkoB1 joined
07:03 <dramforever> I think I'm trying to avoid Haskell in editor extension code, but now that I think about it, I can't really say I know why
07:03 amar joined
07:03 <dramforever> Couldn't hurt to try a bit, I suppose
07:04 louispan joined
07:04 <gonz_> dramforever: Which editor is this for?
07:04 <gonz_> Most editors are going the way of using language protocol clients
07:05 <cocreature> I can certainly see an argument for getting a simplified version of the AST instead of having to work with the GHC API (and that’s what the aforementioned gsoc project is trying to do) but -ddump-ast is literally GHC’s internal representation
07:05 rschm_ joined
07:05 <dramforever> 'using language protocol clients' duh
07:05 <dramforever> looks like I *am* going against everyone else on this
07:05 <dramforever> And guess what, it's for vscode
07:05 <dramforever> that's like, triple duh
07:06 blender joined
07:06 <gonz_> VS Code has the principal implementation of the language protocol client
07:07 vlatkoB1 left
07:07 <gonz_> I think that's a pretty good reason to just concentrate on language servers
07:07 <gonz_> But to each his own, I suppose
07:07 <gonz_> There is an excellent language server for Haskell called `haskell-ide-engine`.
07:07 <dramforever> There must be a reason for ghci to have things like :complete and :all-types
07:08 <dramforever> And -ddump-json isn't there for nothing
07:08 <dramforever> I hope
07:09 Scip joined
07:11 <cocreature> ghci is great because contrary to the GHC API it tends to have a fairly stable and robust interface. but once you step out of that interface (i.e. the few commands supported by ghci) I don’t think messing with -ddump flags and trying to parse the output is the way to go
07:11 <gonz_> For what it's worth, the main reason Emacs is falling behind nowadays in terms of tooling is because it hasn't embraced language servers early enough and it only has WIP status clients. It's not especially forward-thinking to make a non-language-server-based solution at the present time
07:11 <dramforever> :(
07:11 scottschmidt joined
07:12 <dramforever> I suppose you're right, cocreature and gonz_
07:12 <cocreature> dramforever: do you have some specific reason for why you are trying to avoid going down an lsp route?
07:12 <dramforever> I guess I was fed up with trying to have ghc-mod build at the time?
07:13 <dramforever> And I *do* think that if all I want is some, say, squiggles, then the ghci approach is going to work
07:13 <cocreature> I think you are conflating two things here: the way the backend for the server is written and the protocol it uses to communicate with the client
07:13 <dramforever> Oh
07:14 <gonz_> Interestingly enough `haskell-ide-engine` features the only known (to me) version of `ghc-mod` that runs on GHC 8.x, so you get `ghc-mod` for free
07:14 <cocreature> you could construct your language server as a wrapper around ghci
07:14 <dramforever> cocreature: sorry I misunderstood
07:14 <dramforever> I thought you were talking about my avoiding Haskell code
07:15 <dramforever> You know, you were talking about GHC API earlier...
07:16 <ammar2> well that was an alternative to dumping the AST as text :P
07:16 <dramforever> :P
07:16 <dramforever> And we switched from that to lsp a while back
07:16 <dramforever> I mean, switched topics, not backends
07:16 <cocreature> so I think there are several points to this: 1. unless you have a good reason to avoid it, lsp is probably a good protocol to communicate with the client. 2. relying on ghci for the backend is perfectly reasonable. 3. dumping the AST as text to avoid having to work with the GHC API is probably not reasonable
07:17 <dramforever> 1. 2. yes, 3 okay got that
07:17 fujiy joined
07:18 <dramforever> Yeah that was totally because I misunderstood 'using language servers'. I thought you were talking about haskell-ide-engine in particular
07:19 raichoo joined
07:19 <dramforever> That's cleared
07:20 <dramforever> I guess I still have time to go back and switch to a language server implementation, that's noted
07:20 <dramforever> Thank you again, gonz_ and cocreature
07:22 vonfry_ joined
07:22 scottschmidt joined
07:25 agander joined
07:26 Gurkenglas joined
07:30 connrs joined
07:32 akshayn joined
07:34 davr0s joined
07:34 sarna joined
07:34 lel joined
07:40 ozzymcduff joined
07:42 zero_byte joined
07:44 dexhunter joined
07:48 replay joined
07:50 lykrysh joined
07:51 dddddd joined
07:52 darkJedi joined
07:53 dogweather joined
07:59 scottschmidt joined
08:01 louispan joined
08:02 Sampuka joined
08:04 <zincy> say you players is a field comprising a list inside a record type called Game I want to get the first element of said list using lens. This is my failed attempt let playerWhoBet = newGame (^. players) . (^? ix 1)
08:05 <cocreature> zincy: you usually use lens by first composing the various optics and then using a single operator such as (^.) or (^?)
08:05 <cocreature> so try something like newGame ^? players . ix 1
08:06 <zincy> So I should think how can I compose optics in a way that fits my needs rather than using ^. multiple times
08:07 <cocreature> yep
08:07 <zincy> thanks
08:07 <cocreature> the fact that optics are composable is probably the main advantage of using lens
08:08 dexhunter joined
08:08 <zincy> So that worked
08:08 <zincy> :)
08:08 <zincy> ^? players . ix 1
08:08 <zincy> Is that just a composed lens ^
08:09 <zincy> Operators are just functions that take lenses as arguments
08:09 <cocreature> no ix gives you a Traversal not a lens
08:09 <zincy> Whats the difference
08:09 <cocreature> a lens always targets exactly one argument
08:09 <cocreature> a Traversal can target many or 0 elements
08:09 <cocreature> which is important for things like "ix" since there might not be a value at the index
08:09 <zincy> So is a Traversal an "optic"
08:10 <zincy> What alternative to ix would allow you to get the element(s) that satisfy a predicate?
08:10 <cocreature> yeah optic is the general term for the various things you’ll find in lens, e.g. Lens, Traversal, Prism, …
08:10 <cocreature> :t filtered
08:11 <lambdabot> (Applicative f, Choice p) => (a -> Bool) -> Optic' p f a a
08:12 <zincy> :)
08:12 suk joined
08:12 <zincy> I am beginning to see the expressiveness of lens code
08:13 <zincy> Using lens seems to reduce your LOC by a significant amount
08:14 <zincy> The only disadvantage is remembering all the squiggly operators :D
08:14 <dminuoso> zincy: Just be aware that the downside is, that it requires the reader to be familiar with lens.
08:14 <zincy> Yes very very true
08:14 <zincy> Although glguy said something which puzzled me yesterday
08:14 <dminuoso> Unlike many other libraries you can derive very little intuition from staring at types of optics if you are not familiar with lens already.
08:15 [exa] joined
08:15 <zincy> He said that someone new to haskell hit the ground running in a lensified code base
08:15 <cocreature> a lot of the operators also have non-operator versions
08:15 scottschmidt joined
08:15 <cocreature> e.g. view for (^.), over for (%~), …
08:15 <zincy> I cant get my head around how someone could do that
08:16 <dminuoso> zincy: Obligatory https://xkcd.com/1827/
08:16 <zincy> haha
08:17 <zincy> I guess he was an outlier :P
08:17 <zincy> or she
08:18 <cocreature> using lens is not that hard. the tricky part is finding stuff and dealing with errors and if you have someone that can help you there, it’s not too bad
08:18 <[exa]> "there are also non-operator versions" lol :D
08:19 <zincy> I guess it just has scary looking operators
08:19 amar joined
08:19 mreh joined
08:19 vonfry joined
08:20 <zincy> So what are your favourite libraries?
08:20 jibby joined
08:20 jibby_ joined
08:21 Linter joined
08:22 <dminuoso> acme-everything
08:24 <zincy> Does it have many dependencies?
08:24 <dminuoso> zincy: You tell me: http://hackage.haskell.org/package/acme-everything
08:24 <zincy> :P
08:24 amar joined
08:24 <zincy> haha
08:26 dodong joined
08:27 rschm joined
08:27 <zincy> Why did elm's design choices choose to treat everyone like children?
08:27 chaosmasttter joined
08:28 <zincy> Its like the blue pill for functional programming
08:29 scottschmidt joined
08:30 <dminuoso> zincy: In a lot of ways it's similar to Go, in that the author(s) have very firm beliefs in what the language should be, so they restrict it enough to force to into the habits they believe are good.
08:31 <zincy> What do you think of go
08:31 <dminuoso> Also both try to be as attractive as possible to mainstream (C or JavaScript respectively) developers, so they both try to avoid overwhelming people with abstractions.
08:31 <dminuoso> "Simplicity" they call it
08:32 <zincy> Imperative coding overwhelms the faculties of my brain related to working memory
08:33 kritzefitz joined
08:33 <zincy> Im not sure if I am alone there though
08:34 GodotMisogi joined
08:34 <cocreature> you are in a channel full of Haskell programmers, you will certainly find people here that agree that imperative code is often not the right way to approach a problem :)
08:34 <zincy> I love echo chambers
08:34 <dminuoso> I firmly believe that imperative programming is the definite approach to *some* solutions. :)
08:35 <dminuoso> *some* problems even :P
08:35 emilypi joined
08:35 <zincy> What kind?
08:37 scottschmidt joined
08:37 <dminuoso> zincy: Any area that requires tight control over generated code or memory is (at this stage) frequently better written in things like C, C++ or Rust. Say kernel development or certain kinds of embedded development.
08:40 zyla_ joined
08:41 <dminuoso> zincy: Cryptographic schemes might be problematic as well to implement right because it's very hard to control the generated code leaving you open to a huge well of potential side channels.
08:41 <dminuoso> Or things that require maximum performance
08:42 yuvali joined
08:43 <cocreature> interestingly, we seem to be seeing more and more cryptographic code that’s being written in high-level languages that allow for verification and then compiles to low-level code
08:43 <cocreature> e.g. chrome has crypto written in Coq iirc, firefox has crypto written in f#, …
08:43 <cocreature> eh f*
08:44 <ammar2> verification of crypto code or the actual implementation?
08:44 blender joined
08:44 <cocreature> depends on what you mean the actual implementation, afaik they automatically generate the code from the verified implementation
08:44 <cocreature> that compilation pipeline is probably not fully verified
08:44 <dminuoso> cocreature: The verification of the algorithm is one thing, but the papers Ive read that elaborate on side channel attacks because of cache timing attacks, peephole optimizations, code generation, out-of-order execution...
08:45 <dminuoso> Against implememtations that were, on the paper, correct.
08:45 <cocreature> dminuoso: right, iirc for the stuff in chrome, they claim that they are immune to things like timing attacks because they compile only to primitives that are resistant against those
08:46 <dminuoso> That sounds very interesting then.
08:47 <dminuoso> cocreature: Do you have a link/article/paper about this at hand or should I google myself?
08:47 <cocreature> you’ll have to search for it yourself, sry :/
08:47 dogweather joined
08:47 <dminuoso> No worries :)
08:47 <cocreature> adam chlipala was involved in the chrome stuff iirc, so that might be a helpful search term :)
08:48 <dminuoso> http://adam.chlipala.net/theses/rsloan.pdf
08:49 <dminuoso> That was helpful :)
08:50 davr0s joined
08:53 Cthalupa joined
08:54 pepa joined
08:55 <* hackage> store-core 0.4.4 - Fast and lightweight binary serialization http://hackage.haskell.org/package/store-core-0.4.4 (MichaelSloan)
08:56 scottschmidt joined
09:00 rbocquet left
09:05 bendo joined
09:05 taumuon joined
09:08 kritzefitz_ joined
09:08 pipa joined
09:09 pipahask joined
09:14 taumuon joined
09:14 nickolay_ joined
09:14 scottschmidt joined
09:14 amar_ joined
09:15 eliasr joined
09:16 blackandblue joined
09:16 pipahask left
09:18 pipahask joined
09:19 <jchia_> There's MonadIO, MonadBase IO (from lifted-base), and MonadUnliftIO (from unliftio-core), and different libraries use them. I just want to use the libraries to do IO and get things done. Do I really have to go and learn lifted-base and unliftio-core and understand how to use them? It's not just one but two things in addition to MonadIO. Is it really necesary?
09:20 sdothum joined
09:21 paraseba joined
09:21 saurabhnanda joined
09:21 <jchia_> I don't understand the roles of lifted-base and unliftio-core and how they are different
09:22 <cocreature> jchia_: MonadIO only works for things in a positive positions, i.e., things that return IO. MonadUnliftIO and MonadBaseControl allow you to also lift functions that take IO things as arguments
09:22 darkJedi joined
09:22 <cocreature> MonadUnliftIO and MonadBaseControl solve the same problem, you only need to use one of them
09:23 Boomerang joined
09:23 <cocreature> MonadUnliftIO is simpler and easier to reason about at the cost of restricting what you can write instances for (it only works for ReaderT like things)
09:23 <cocreature> MonadBaseControl is more general but it’s fairly complex to understand and a lot of the instances for non ReaderT like things are at least somewhat questionable
09:24 <cocreature> e.g. you can end up silently throwing away the result of a State action
09:24 <cocreature> so I would recommend that you stick to MonadIO when it works for your usecase and go for MonadUnliftIO when you have IO as an argument
09:25 <cocreature> monad-control is somewhat interesting but given the complexity and its problems I would try to avoid it
09:25 <jchia_> cocreature: Thanks. I suppose if the libraries I use sometimes use MonadUnliftIO and sometimes use MonadBaseControl, I'll have to learn them both and switch between them both in my code that uses different libraries. Or, maybe I'll avoid libraries that use MonadBaseControl.
09:26 <cocreature> unliftio is still fairly new but I kind of hope that it will replace the use of MonadBaseControl in a lot of libraries
09:29 philippD joined
09:29 scottschmidt joined
09:30 zyla_ joined
09:30 Azel joined
09:32 rprije joined
09:37 t7 joined
09:40 thc202 joined
09:40 dhil joined
09:41 catsup joined
09:42 catsup joined
09:42 fmixing joined
09:43 <jchia_> cocreature: What about MonadBase? Is it more similar to MonadIO or the other two?
09:43 <jchia_> lifted-base uses MonadBase IO
09:43 <cocreature> MonadBase IO should be equivalent to MonadIO
09:43 <cocreature> the difference is that you could have a different base monad
09:44 <jchia_> thanks
09:45 <cocreature> if you take a look at lifted-base you can also see how it uses MonadBase IO for the things that return IO and MonadBaseControl IO for things that take IO actions as their arguments
09:51 scottschmidt joined
09:51 logzet joined
09:55 pio_ joined
09:57 xkapastel joined
09:57 andreabedini joined
09:57 lethe joined
09:59 rzp joined
10:00 reactormonk joined
10:01 jeltsch joined
10:03 latk joined
10:05 <[exa]> hm, how complicated it would be to make a DSL that compiles to shell (bash)?
10:06 <[exa]> I'm kindof annoyed by all packaging systems except autotools, which uses m4 as the DSL
10:06 dogweather joined
10:07 <dminuoso> [exa]: You mean you want nix?
10:08 knupfer joined
10:09 <[exa]> nix is a distribution that includes many (repackaged) autotools-style packages, I want a way to create such packages
10:09 <[exa]> a configure-script compiler if you want
10:09 haskell_noob2 joined
10:11 scottschmidt joined
10:11 blender joined
10:12 vurtz joined
10:14 yuvali joined
10:16 <dminuoso> [exa]: You mean autoconf?
10:18 vurtz joined
10:18 tzemanovic joined
10:19 lethe joined
10:19 <[exa]> dminuoso: yes, with automake... Makefile-compiler-compiler to be cleaner :D
10:19 davr0s joined
10:20 <zincy> what is autoconf I remember it gets sad when I list extra packages that dont exist in my cabal file
10:20 louispan joined
10:21 <[exa]> it's completely unrelated to haskell/cabal, I was just thinking about rewriting that from a shellish DSL to haskell DSL
10:23 desperek joined
10:24 nahra joined
10:34 fendor joined
10:34 vurtz joined
10:36 emilypi joined
10:39 scottschmidt joined
10:39 Gurkenglas joined
10:40 tzemanovic joined
10:42 Ariakenom joined
10:47 pagnol joined
10:48 louispan joined
10:49 dodong joined
10:49 rschm joined
10:51 twanvl joined
10:51 deepfire` joined
10:51 Linter joined
10:55 saurabhnanda joined
10:55 brocoli joined
10:57 rprije joined
10:57 dogweather joined
10:59 pipahask joined
10:59 jibby_ joined
11:00 scottschmidt joined
11:00 wildlander joined
11:05 agander joined
11:06 Azel_ joined
11:07 epsilonhalbe joined
11:07 epsilonhalbe left
11:09 ammazza joined
11:09 <zincy> How do I update a field using other fields of the record type?
11:09 <zincy> placeBet value = (chips -~ value) . (bet +~ value) . (committed +~ value) . (playerState %~ (^. ) )
11:10 <zincy> The last lens should update playerState value depending on whether value is equal to the chips record field
11:13 <* hackage> dejafu 1.10.0.0 - A library for unit-testing concurrent programs. http://hackage.haskell.org/package/dejafu-1.10.0.0 (barrucadu)
11:14 jan25 joined
11:15 psychicist__ joined
11:15 <* hackage> hunit-dejafu 1.2.0.5, tasty-dejafu 1.2.0.6 (barrucadu): https://qbin.io/con-lovely-1044
11:17 <Gurkenglas> zincy, you could do (filtered (views chips (==0)) . playerState .~ "bankrupt")
11:18 <zincy> nice ... would it not add an extra N in worst case runtime complexity though?
11:18 <Gurkenglas> zincy, you could do (lensProduct chips playerState %~ \(c,p) -> (c,if c == 0 then "bankrupt" else p))
11:19 <Gurkenglas> zincy, why do you think it would?
11:20 <zincy> Because if you add a filtering operation you are adding an additional iteration through the list to the computation
11:20 <zincy> Is that right
11:20 jao joined
11:20 <Gurkenglas> > map (+1) $ filter odd $ map (+1) $ [1,2,3,4,5,6,undefined]
11:20 <lambdabot> [4,6,8*Exception: Prelude.undefined
11:21 <zincy> Also this takes a single player as an argument not a list placeBet value = (chips -~ value) . (bet +~ value) . (committed +~ value) . (playerState %~ (^. ) )
11:21 <zincy> but your answer is very helpful as it would allow me to do what I was trying
11:21 <Gurkenglas> In this case, filtered takes a single-element list and turns it into a zero-or-one-element list
11:22 <zincy> So would I then have to get the value out of the list
11:22 <zincy> there must be a simpler way :P
11:23 <zincy> From my understanding this solution would entail putting an element into a list and then taking it back out
11:23 <zincy> Maybe I misunderstood?
11:24 litb joined
11:24 <litb> hello folks
11:24 silver joined
11:24 <zincy> hi
11:24 <litb> i'm looking at some golfing answer and it has (sum.).take
11:24 <zincy> :t (sum.).take
11:24 <lambdabot> Num c => Int -> [c] -> c
11:24 <litb> apparently it means f x y means take 'x' elements from 'y' and sum it up
11:24 <litb> yeah, matches the type
11:25 <cocreature> litb: it’s equivalent to \x y -> sum (take x y)
11:25 <zincy> cocreature: Why are there two dots?
11:25 <cocreature> and apart from golfing, I definitely wouldn’t recommend that style :)
11:25 <zincy> :t (sum . take)
11:25 <lambdabot> (Num [a], Foldable ((->) [a])) => Int -> [a]
11:25 <dminuoso> :t ((.) . (.)) sum take
11:25 <lambdabot> Num c => Int -> [c] -> c
11:25 <cocreature> zincy: because otherwise you would end up with \x y -> sum (take x) y
11:26 <litb> the complete answer as zipWith((sum.).take)<*>scanr(:)[].tail.cycle
11:26 <cocreature> :t fmap fmap fmap sum take
11:26 <dminuoso> zincy: ^- this may make it a bit more obvious
11:26 <lambdabot> Num a => Int -> [a] -> a
11:26 <cocreature> if you are having trouble understanding how the double dots work, just inline the definition of (.)
11:27 <zincy> :t (.)
11:27 <lambdabot> (b -> c) -> (a -> b) -> a -> c
11:27 <zincy> :t (.).(.)
11:27 <lambdabot> (b -> c) -> (a1 -> a2 -> b) -> a1 -> a2 -> c
11:27 <zincy> :t (.).(.).(.)
11:27 <lambdabot> (b -> c) -> (a1 -> a2 -> a3 -> b) -> a1 -> a2 -> a3 -> c
11:27 <litb> ah now i understand.. "(sum.)" means that it expects a function. and the function will be the partially applied "take" that still expects the list
11:27 <litb> and the result is summed
11:28 <dminuoso> :t sum . zipWith take
11:28 <lambdabot> (Num [[a]], Foldable ((->) [[a]])) => [Int] -> [[a]]
11:28 <zincy> Oh so composing composition just adds an extra argument to the first function call
11:28 <cocreature> f . g = \x -> f (g x)
11:28 <dminuoso> zincy: It may be really helpful to think of it as `fmap fmap fmap`
11:28 <zincy> what has fmap got to do with (.)
11:29 <cocreature> dminuoso: I hope you’re kidding :)
11:29 <dminuoso> zincy: there is an `instance Functor ((->) a)
11:29 <dminuoso> cocreature: Actually not. :)
11:29 scottschmidt joined
11:29 <cocreature> then your mind seems to work rather differently than mine :)
11:30 Unhammer joined
11:30 <zincy> Variety of teaching styles is advantageous
11:30 athan joined
11:30 <zincy> :t fmap fmap fmap
11:30 <lambdabot> (Functor f2, Functor f1) => (a -> b) -> f1 (f2 a) -> f1 (f2 b)
11:30 <zincy> :t fmap fmap fmap fmap fmap
11:30 <lambdabot> Functor f => (a1 -> b) -> (a2 -> a1) -> f a2 -> f b
11:31 <litb> is "(sum . take)" even applicable to anything?
11:31 <litb> "sum" will try to interpret a function as a list
11:31 <dminuoso> :t sum
11:31 <lambdabot> (Num a, Foldable t) => t a -> a
11:31 <dminuoso> litb: Strictly speaking it will require a Foldable instance
11:31 <zincy> Yeah sum the first N elements of a list
11:32 <zincy> Gurkenglas: Still there?
11:32 <zincy> Concurrent discussions ftw
11:32 <zincy> How do I grok (.).(.)
11:33 <cocreature> zincy: substitute the definition of (.)
11:33 <zincy> :t (.)
11:33 <lambdabot> (b -> c) -> (a -> b) -> a -> c
11:33 t7 joined
11:34 <litb> i thought functor is something that can be mapped over, like a list
11:34 <dminuoso> zincy: (fmap . fmap) is the route that I followed to gain a better understanding. It's in the same department as `(zipWith . zipWith)` for example
11:34 <dminuoso> litb: You can map over functions too.
11:35 <zincy> :t fmap id
11:35 <lambdabot> Functor f => f b -> f b
11:36 drewbarbs joined
11:36 dddddd joined
11:37 <dminuoso> zincy: so for example: How do you map over the numbers in [[Int]]
11:37 <zincy> I am confused about the substitution ... (.) is a function of three arguments but the first arg to (.) takes only two - (b -> c) -> (a -> b) -> a -> c
11:37 <zincy> fmap fmap
11:38 <zincy> fmap fmap id [[1]]
11:38 <dminuoso> that wont type check
11:38 <zincy> :t fmap
11:38 <lambdabot> Functor f => (a -> b) -> f a -> f b
11:40 <dminuoso> zincy: You'd just write `fmap (fmap id) [[1]]` for example
11:40 <dminuoso> you can write that first part as `(fmap . fmap) id [[1]]`
11:40 <dminuoso> so if you wanted to map over the integers in [[[1]]] you could, using the same line of thought, use `(fmap . fmap . fmap) id [[[1]]]`
11:41 <cocreature> zincy: f . g = \x -> f (g x), so ((.) . (.)) f g = (\x -> (.) ((.) x)) f g, now let’s beta reduce so we get to (.) ((.) f) g, put (.) in infix form so we have ((.) f) . g, expand the definition again to get to \x -> (.) f (g x), put (.) in infix form so we get \x -> f . g x, expand the definition so we get \x -> \y -> f (g x y)
11:44 drewr joined
11:45 <dminuoso> zincy: So my intuition is that a function can be thought of as a container of sorts. `f :: Int -> String` is a huge list of strings, indexed by `Int`. using fmap (or respectively (.)) you can map over those strings.
11:45 hphuoc25 joined
11:45 <dminuoso> zincy: and then something like Int -> (Int -> String) is just "nested containers", just like [[Int]]
11:45 sz0 joined
11:45 scottschmidt joined
11:46 sarna joined
11:46 <zincy> whats going on here (.) ((.) x)) f g
11:46 <cocreature> what do you mean by “what’s going on here”
11:47 <dminuoso> zincy: That's the inverse of what I just said regarding `fmap (fmap id) = (fmap . fmap) id`
11:47 <zincy> Can you talk me through it
11:47 <cocreature> note that this term never appears in my expansion
11:47 brocoli joined
11:47 <cocreature> the closest is (\x -> (.) ((.) x)) f g
11:48 <zincy> ah ok
11:48 <cocreature> and the “talking you through”-part is what I was trying to do with the explanation given above :)
11:48 <dminuoso> cocreature: I think ertes taught me this "functions as containers" perspective when I learned about the Costate comonad - it was then when the (.) . (.) completely clicked.
11:49 <zincy> So its not just me that struggles with the dot trinity
11:50 <cocreature> I tend to just avoid the word “containers” for the most part. too much time has been wasted on debating whether certain things can be called “container” or not
11:50 <litb> docker?
11:50 <zincy> so the functions as containers perspective is akin to seeing the function as a list of possible elements of the codomain of a function
11:50 <dminuoso> zincy: Well *image* of a function
11:51 <zincy> what is the image of a function
11:54 <zincy> Oh googled it just what I said
11:55 <zincy> dminuoso: so is the nesting of (.) just adding containers of structure and increasing the image of the resulting function?
11:55 scottschmidt joined
11:55 <zincy> or not adding containers of structure .. rather just structure
11:56 <zincy> so to get around the fact that
11:56 <dminuoso> zincy: Let's pretend for the sake of argument we have some `type Array = ((->) Int)`
11:56 <zincy> :t (.)
11:56 <lambdabot> (b -> c) -> (a -> b) -> a -> c
11:56 <zincy> Takes a function of one argument
11:56 ammazza joined
11:56 <dminuoso> zincy: Array (Array String) is kind of like [[String]] right? (Let's require Int to positive only)
11:56 <zincy> we then compose (b -> c) inside the argument to the first (.)
11:56 <zincy> Yep
11:57 <zincy> :t (->)
11:57 <lambdabot> error: parse error on input ‘->’
11:58 cloudhead joined
12:01 <dminuoso> zincy: If a function can be thought of as a container (in which the contained type is observable in the codomain), then a function returning a function is just a nested contained.
12:01 <dminuoso> Array (Array String) ~ Int -> Int -> String
12:02 acarrico joined
12:02 emilypi joined
12:03 <zincy> dminuoso: wow
12:03 <zincy> That is such an elegant way of describing composition
12:03 <litb> :t fmap id id
12:03 <lambdabot> b -> b
12:03 <litb> nice!
12:04 <zincy> dminuoso: How did that intuition help you with costate comonad?
12:05 <dminuoso> zincy: So if `fmap x` lets you map over a container, and `(fmap . fmap)` lets you map over a nested container.. then we just need to observe the fact that `instance Functor ((->) a) where fmap = (.)` to see that ((.) . (.)) lets you adapt the result of the result of a function.
12:05 louispan joined
12:05 saurabhnanda joined
12:05 <zincy> cocreature: so x is a function in the term? - f g = (\x -> (.) ((.) x))
12:07 <zincy> dminuoso: so each time we compose a function we just nest the resulting functions image
12:07 lnostdal joined
12:07 <dminuoso> zincy: That's what currying means.
12:07 <dminuoso> A -> B -> C really just means A -> (B -> C)
12:08 <cocreature> zincy: yep
12:08 <zincy> so currying nests the resulting functions image
12:08 <dminuoso> zincy: Or wait I misunderstood that. What exactly do you mean by that?
12:08 karlguy joined
12:08 <zincy> The jump to currying confused me
12:09 <zincy> See this is the kind of stuff I find really interesting
12:09 <zincy> How do I get more of it :)
12:09 <dminuoso> zincy: No I misread what you said.
12:09 <dminuoso> 14:07 zincy | dminuoso: so each time we compose a function we just nest the resulting functions image
12:09 <dminuoso> function composition in the end is just function composition
12:10 kritzefitz joined
12:10 <dminuoso> zincy: based on the fact that for `((->) a)` we have a Functor instance I just offered an alternative intuition. But fundamentally it boils down to what cocreature is saying
12:11 cybai joined
12:12 brocoli joined
12:13 <litb> the functor thing looks a lot like monad >>=.
12:13 <litb> at least the fmap one
12:13 <zincy> All monads instances require a functor instance
12:14 <zincy> Not sure why though :/
12:14 <litb> ah but for >>= the function is required to return a monad instance, but for functor it's not
12:15 <zincy> :t (>>=)
12:15 <lambdabot> Monad m => m a -> (a -> m b) -> m b
12:15 <zincy> :t fmap
12:15 <lambdabot> Functor f => (a -> b) -> f a -> f b
12:15 <cocreature> :t (=<<) -- that one is even closer to fmap
12:15 <zincy> :t (<<=)
12:15 <lambdabot> Monad m => (a -> m b) -> m a -> m b
12:15 <lambdabot> error:
12:15 <lambdabot> • Variable not in scope: <<=
12:15 <lambdabot> • Perhaps you meant one of these:
12:15 <zincy> thats it
12:16 <litb> and for whatever reason, functor's fmap order of arguments is different from monad's >>=
12:16 <litb> ah i see
12:16 scottschmidt joined
12:16 <zincy> bind is a function whose implementation needs to lift the first argument
12:19 xtreak joined
12:21 sgflt joined
12:23 ericsagn1 joined
12:24 vurtz joined
12:27 patlv joined
12:27 sim590 joined
12:28 mszczygiel joined
12:32 blender joined
12:33 Linter joined
12:33 Gurkenglas joined
12:38 cybai joined
12:41 dexhunter joined
12:43 <maerwald> 'instance (MyClass (Maybe a)) => MyClass (Either a b)' reduces to 'instance MyClass (Either a b)', right?
12:43 <dysfun> i don't suppose anybody knows the purescriptism for converting a Maybe to an Either by providing a Left value?
12:45 amirpro joined
12:45 <hpc> maybe foo id?
12:46 <* hackage> emailparse 0.2.0.10 - An email parser that will parse everything http://hackage.haskell.org/package/emailparse-0.2.0.10 (mkawalec)
12:46 <dysfun> no, sadly it doesn't seem to have a maybe function
12:46 <dysfun> that's what i looked for first :/
12:47 language_agnosti joined
12:47 <dysfun> i think the trick might be this (since prj does the inverse), but i can't figure out how to use it https://pursuit.purescript.org/packages/purescript-either/4.0.0/docs/Data.Either.Inject
12:47 <dysfun> and the PS channel is dead at the best of times
12:48 wchresta joined
12:48 <dminuoso> maerwald: what do you mean by "reduces to"
12:48 <Taneb> dysfun, that doesn't look right, inj there corresponds to Left I think
12:49 <Taneb> dysfun, what about https://pursuit.purescript.org/packages/purescript-either/4.0.0/docs/Data.Either#v:note ?
12:49 <dysfun> oh wow, how'd i miss that?
12:49 <dysfun> thanks :)
12:50 <Taneb> Happy to help :)
12:50 <maerwald> dminuoso: the constraint cannot be applied anywhere
12:50 ski joined
12:51 davr0s joined
12:52 scottschmidt joined
12:52 tangmou joined
12:52 <litb> zincy, i think of (.) as "delay". instead of applying the first to the second argument immediately, it just waits or one further argument
12:53 <litb> then when saying ((a.).)b it will wait for two arguments. and for (((a.).).)b it will wait for three ones, and so on
12:53 <dminuoso> litb: You'll have a much easier time of you think of (.) as a kind of composition. That is in a way it acts like a generalized version of <>
12:53 tombusby joined
12:54 lumm joined
12:55 <dminuoso> maerwald: what does that even mean?
12:55 <maerwald> nvm
12:55 theelous3 joined
12:56 <maerwald> I'll have the answer by the time I have explained it :P
12:57 language_agnosti joined
12:57 FreeBirdLjj joined
12:58 mreh joined
12:59 brocoli joined
13:00 backes joined
13:00 yuvali joined
13:01 language_agnosti joined
13:01 <backes> hey, I don't understand why the second function is valid. Why can we use $ xs ? https://lpaste.net/1785124253738205184
13:02 <maerwald> dminuoso: the class has no functions, so the additional context constraint cannot be applied anywhere
13:02 <maerwald> I cannot come up with something where the compiler gives a different answer for either of those instance signatures
13:03 <maerwald> which is why they are reduced to the same thing
13:03 <dminuoso> backes: It's for the same reason that ($) works in the first place
13:03 <int-e> backes: a $ b c = a . b $ c is true by the definition of (.), and (.) is associative
13:03 <dminuoso> infixr 9 .
13:04 <dminuoso> infixr 0 $, $!
13:04 phenoble joined
13:04 scottschmidt joined
13:04 <litb> and is that not the same as a . b c ?
13:05 <dminuoso> backes: Then add the fact that function application (done with filter) has higher precedence than any operator
13:05 <dminuoso> litb: Nope
13:05 <litb> ah i see. b c is done first
13:05 <dminuoso> litb: Like I said: function application has higher precedence than any operator.
13:05 <litb> race condition
13:06 <backes> ah okay, thank you that makes sense :)
13:06 FreeBirdLjj joined
13:07 raingloom joined
13:08 <int-e> in full glory: a . b $ c d e = (a . b) $ ((c d) e) = ((a . b) . (c d)) $ e = (a . (b . (c d))) $ e = a . b . c d $ e
13:09 blender joined
13:13 Tops2 joined
13:13 dejanr joined
13:14 scottschmidt joined
13:14 language_agnosti joined
13:16 dodong joined
13:16 murtaught joined
13:20 remyhr joined
13:20 <zincy> I am gonna try again :)
13:20 <zincy> placeBet :: Int -> Player -> Player :: placeBet value = (chips -~ value) . (bet +~ value) . (committed +~ value) . (playerState %~ (^. ) )
13:21 <zincy> How do I set a value for playerState based on the logical condition of the value being equal to the chhips field
13:21 booglewoogle joined
13:23 thunderrd joined
13:23 pipahask joined
13:25 thunderrd joined
13:25 emilypi joined
13:26 nuncanada joined
13:27 <patlv> hi all, is it possible to have a literal in a data type, just like a #define in a struct in C?
13:27 <litb> "#define in a struct" ? what does that mean
13:27 scottschmidt joined
13:28 <dminuoso> patlv: myMagicalNumber = 7;
13:28 will`` joined
13:28 <litb> do you mean struct Foo { int data[SIZE]; } ?
13:29 <patlv> something like:
13:29 language_agnosti joined
13:30 <patlv> struct data { u_char whatever; #define CONST 0x0001};
13:31 <[exa]> do you know that there's no difference if you moved the #define out of the struct?
13:31 thejonny[m] joined
13:32 <[exa]> I guess you wanted to do something like this instead: struct data { static const TheConst = 123; };
13:33 MarcelineVQ joined
13:33 <[exa]> anyway, for the original question, if you turn on the C preprocessor using the language pragma, then the answer is yes, you can literally use #define anywhere inside the data statement in haskell.
13:34 <patlv> yes it was a bad example, I guess what I need is a literal in a data type
13:35 <[exa]> hmh
13:35 Solonarv joined
13:35 <[exa]> like data Int = 0 | 1 | 2 | ... ?
13:35 <[exa]> I can't see any other place for literals there, maybe except data kinds
13:36 Guest89 joined
13:37 <* ski> idly wonders what patlv is trying to achieve
13:37 <patlv> I have a data type like: data IPHeader = IPHeader { ver :: Word8, tos :: Word8, RF=0X001 }, the RF here is always 0x001
13:37 <cocreature> why is there an RF field if it’s constant?
13:38 <ski> perhaps you want to always set an `RF' to `0x001', when serializing a value of this data type ?
13:38 <ski> (an `RF' field)
13:38 <LiaoTao> Because it is likely automatically serialized somewhere
13:39 <patlv> yes, I use the Get monad to parse an array of ByteString into this data type, but I guess, I can just set the value myself
13:40 <ski> perhaps you can specify serialization of `IPHeader's, by converting them to a more general format, setting the `RF' field to `0x001', and serializing that
13:40 <patlv> ski: right
13:41 <ski> (or otherwise, perhaps manually specifying the serialization of `IPHeader's ..)
13:42 matsurago joined
13:43 alexteves joined
13:43 <patlv> yes, that's what i'm gonna do, thanks!
13:44 <* hackage> dejafu 1.10.1.0 - A library for unit-testing concurrent programs. http://hackage.haskell.org/package/dejafu-1.10.1.0 (barrucadu)
13:46 raingloom joined
13:47 language_agnosti joined
13:47 tianshu joined
13:50 Deide joined
13:51 forell joined
13:51 Linter joined
13:53 lumm joined
13:56 language_agnosti joined
13:57 alx741 joined
14:03 alexteves_ joined
14:03 FreeBirdLjj joined
14:04 blankhart joined
14:04 jmcarthur joined
14:05 Azel joined
14:06 remyhr joined
14:06 rkaippully joined
14:07 ozzymcduff joined
14:10 _bo joined
14:12 patlv joined
14:13 bbrodriguez joined
14:14 xcmw joined
14:14 <rkaippully> Hi, I am exploring type level programming in Haskell. Is it possible to use arbitrary functions in type family instances?
14:14 <rkaippully> Here is some pseudo-haskell that gives an idea of what I am aiming for: https://lpaste.net/7339569290288300032
14:15 <rkaippully> Can something like this be achieved with the current state of dependent type support?
14:18 halogenandtoast joined
14:19 <halogenandtoast> If I change my LTS for stack, does anyone know how to use the "relevant" stack template, basically want to use an older yesod-postgres template
14:19 xpycm joined
14:20 xcmw joined
14:20 youtmon joined
14:22 <rkaippully> halogenandtoast: You can use a URL or a local file path as a template name
14:22 hphuoc25 joined
14:23 <rkaippully> So a github URL to the old version should work
14:23 <halogenandtoast> okay I'll try that
14:23 nicknight joined
14:23 vukasink joined
14:26 cloudhead joined
14:27 <dminuoso> rkaippully: are you more interested about type programming like that in general, or do you want to have access to all haskell functions?
14:29 <rkaippully> I am specifically looking for String functions. So that I can derive types parameterized on them.
14:29 lnostdal joined
14:30 <halogenandtoast> rkaippully: thanks for the pointer
14:31 language_agnosti joined
14:32 agander joined
14:33 <dminuoso> rkaippully: The closest thing I can think of is going through '[Nat] instead of Symbol, and then writing your own families/typeclasses for that
14:33 simendsjo joined
14:34 language_agnosti joined
14:35 <dminuoso> rkaippully: Its possible TH might be an easier fit at this time *shrugs*
14:35 booglewoogle left
14:35 blender joined
14:39 <rkaippully> dminuoso: Thanks. Unfortunately the stuff I am working on are URIs. So Nat is not a good fit.
14:39 <rkaippully> You are right TH might be a better choice.
14:39 tangmou joined
14:40 <rkaippully> I have some other ideas as well, let me explore.
14:40 <dminuoso> rkaippully: What exactly is the use case here?
14:42 <rkaippully> I have a URI like this "/users/:userid". I am trying to represent that as a type - say `data URI (path :: Symbol)`
14:42 <rkaippully> Now, I am trying to derive the path parameters from it via a type family.
14:43 <dminuoso> rkaippully: You should check out servant.
14:43 <dminuoso> rkaippully: They do exactly that kind of thing but they glue things together with type operators.
14:43 tangmou joined
14:43 <rkaippully> Yes, I know. Servant solves it via the :> combinator
14:44 <rkaippully> I am trying to see if there is a less verbose choice.
14:44 <dminuoso> Ah I see
14:45 patlv joined
14:45 alexteves joined
14:45 <* hackage> gdp 0.0.0.1 - Reason about invariants and preconditions with ghosts of departed proofs. http://hackage.haskell.org/package/gdp-0.0.0.1 (mnoonan)
14:46 conal joined
14:46 fendor_ joined
14:47 <rkaippully> If I could use arbitrary string functions (or equivalent of that), I can split "/users/:userid" into its components and derive a `Param "userid"` type from it.
14:47 <dminuoso> rkaippully: In a more general setting servant types describe far more though, because they also describe the body, content types, verbs.
14:48 <dminuoso> rkaippully: But it would be interesting nevertheless. :)
14:50 <rkaippully> Yes that's true. I guess I
14:51 codesoup joined
14:51 <rkaippully> Yes that's true. I guess I'll stick to servant like combinators for now
14:51 <rkaippully> dminuoso: Thanks for your help.
14:52 malorie joined
14:53 altjsus joined
15:01 ozataman joined
15:02 urodna joined
15:04 quobo joined
15:07 rihards joined
15:07 WhatisRT joined
15:08 dan_f joined
15:09 Joestar79 joined
15:10 <Joestar79> hello everyone
15:11 <Joestar79> how do I print each intermediate step of a fold in Haskell?
15:11 <Joestar79> tried with Debug.trace, but can't figure out how to
15:14 tzemanovic joined
15:14 <Ariakenom> Joestar79: Did you put trace with your "combining" function?
15:14 <cocreature> Joestar79: can you show us the code that you used?
15:15 <hpc> :t scanl
15:15 <lambdabot> (b -> a -> b) -> b -> [a] -> [b]
15:15 <cocreature> there is also ghci’s debugger which might be relevant https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html#tracing-and-history
15:15 <hpc> > scanr (+) 0 [1, 2, 3, 4, 5]
15:15 <lambdabot> [15,14,12,9,5,0]
15:15 <hpc> er
15:15 <hpc> > scanl (+) 0 [1, 2, 3, 4, 5]
15:15 <lambdabot> [0,1,3,6,10,15]
15:16 <hpc> Joestar79: probably need to flip the list a bit?
15:16 mreh joined
15:16 plutoniix joined
15:17 danvet joined
15:17 errst joined
15:17 <Joestar79> here's the function: dec2int = foldl ((+) . (*10)) 0
15:18 <Joestar79> forgot the signature, sorry guys: dec2int :: [Int] -> Int
15:18 plutoniix joined
15:18 <hpc> > scanl ((+) . (*10)) 0 [1, 2, 3, 4, 5]
15:18 <lambdabot> [0,1,12,123,1234,12345]
15:19 <Joestar79> can't it be done using just trace and foldl?
15:19 <hpc> probably, however
15:19 <hpc> trace output is triggered by evaluation
15:20 <hpc> so you have to hang the output off of the correct thunk
15:20 <hpc> scanl has the advantage as well of putting every intermediate step into a haskell value
15:20 plutoniix joined
15:21 <hpc> you may also need to use foldl' to make sure it's even printed in the right order
15:21 codesoup joined
15:22 xtreak joined
15:23 <Joestar79> I really wanted to print the whole process, and show the steps of multiplication and addition
15:25 <cocreature> Joestar79: where have you tried inserting "trace"?
15:25 mreh_ joined
15:25 Ariakenom_ joined
15:26 __monty__ joined
15:30 <Joestar79> concreature: inside the function argument
15:30 <cocreature> Joestar79: you’ll have to be a bit more precise if you want us to spot the mistake (also you misspelled my nick :))
15:31 <cocreature> Joestar79: foldl' (\acc x -> traceShow acc (x + acc * 10)) 0 [1,2,3] works for me
15:31 xcmw joined
15:32 reactormonk joined
15:33 <Joestar79> cocreature: sorry about mispelling your nick.. had too much trust in my fingertips, but should've used copy&paste :D
15:33 <cocreature> get yourself an irc client that can tab-complete nicks :)
15:33 sqrt2 joined
15:33 <rotaerk> the creature that cons
15:33 <Joestar79> cocreature: thanks for writing that out I kept trying without using the right syntax. Now I can see my mistake
15:33 language_agnosti joined
15:34 language_agnosti joined
15:34 Gurkenglas joined
15:35 <Joestar79> can I trace/traceShow more than one variable at a time?
15:36 <cocreature> just traceShow a tuple
15:40 plugin joined
15:41 blender joined
15:42 <Joestar79> cocreature: thx man
15:42 dodong joined
15:43 kuribas joined
15:45 <cocreature> Joestar79: yw :)
15:45 mizu_no_oto_work joined
15:47 <dmwit> Also you can `traceShow x . traceShow y $ z`.
15:49 amirpro joined
15:49 tsoernes joined
15:50 patlv joined
15:50 litb joined
15:53 woodson joined
15:55 plugin joined
15:56 language_agnosti joined
15:56 Linter joined
15:58 xkapastel joined
15:58 FreeBirdLjj joined
16:00 dogweather joined
16:00 MissingNoIOI joined
16:01 Heffalump joined
16:04 __bo joined
16:04 t7 joined
16:04 <xcmw> I have a data types that is a Profunctor and is Arrowish. Does it exist in any library? It does not fit the arrow typeclass. Is there a type class like arrow that it does fit? https://lpaste.net/5986876066331885568
16:05 <xcmw> It is a mealy machine that does not always output a value
16:06 <xcmw> It would fit arrow if Pair was replaced with These
16:06 <maerwald> anyone good with mtl? https://lpaste.net/2402993816534515712
16:07 <maerwald> the same thing with MonadError works
16:07 plugin joined
16:08 dogweather joined
16:09 sbauman joined
16:09 djbeau joined
16:09 MalfaitRobin joined
16:09 MalfaitRobin joined
16:11 kasra joined
16:13 mizu_no_oto_work joined
16:14 <* geekosaur> wonders if this is because "s" is declared as being completely unknown
16:14 <maerwald> I tried with String too
16:14 <[exa]> maerwald: perhaps you somehow didn't import the instance for ReaderT?
16:14 simendsjo joined
16:15 <[exa]> although that would be pretty hard to do
16:16 <maerwald> uff
16:16 <maerwald> I have a local ReaderT defined xD
16:16 <maerwald> how stupid
16:18 <[exa]> :]
16:18 <* hackage> HNumeric 0.5.0.0 - Haskell Numeric Library with pure functionality, R & MATLAB Syntax. http://hackage.haskell.org/package/HNumeric-0.5.0.0 (edeftg)
16:19 dogweather joined
16:20 _bo joined
16:24 chess joined
16:27 dpyro joined
16:27 FreeBirdLjj joined
16:32 butterthebuddha joined
16:33 athan joined
16:33 Deide joined
16:37 <xcmw> I have a data types that is a Profunctor and is Arrowish. Does it exist in any library? It does not fit the arrow typeclass. Is there a typeclass like arrow that it does fit? https://lpaste.net/5986876066331885568
16:37 haskell_noob2 joined
16:38 danthemyth joined
16:39 haskell_noob2 joined
16:39 <cocreature> xcmw: why does it not fit Arrow? I think I’m missing something here
16:42 <xcmw> cocreature: Because combining `MealyMaybe a1 b1` with `MealyMaybe a2 b2` gives `MealyMaybe (These a1 a2) (These b1 b2)` instead of `MealyMaybe (Pair a1 a2) (Pair b1 b2)`
16:43 <cocreature> ah I see
16:44 xtreak joined
16:45 <cocreature> xcmw: you can probably still make a lawful Arrow instance that outputs nothing if either of the input arrows outputs nothing, right?
16:46 <cocreature> so the problem is not so much that you can’t implement Arrow but that you have an additional operation that’s not expressible by Arrow
16:46 <xcmw> cocreature: Yes but I do not see why that implementation would be useful
16:46 Linter joined
16:47 <cocreature> fair enough, anyway I haven’t seen a typeclass that captures your composition operator
16:49 FreeBirdLjj joined
16:50 agander joined
16:51 root joined
16:51 alex`` joined
16:53 <* hackage> relational-record 0.2.2.0 - Meta package of Relational Record http://hackage.haskell.org/package/relational-record-0.2.2.0 (KeiHibino)
16:53 dogweather joined
16:55 patlv joined
16:57 lykrysh joined
16:59 lambda-11235 joined
17:02 pio_ joined
17:06 <* hackage> IPv6Addr 1.0.4 - Library to deal with IPv6 address text representations. http://hackage.haskell.org/package/IPv6Addr-1.0.4 (MichelBoucey)
17:07 amirpro joined
17:10 oisdk joined
17:11 tsaka__ joined
17:14 ozzymcduff joined
17:14 keepLearning512 joined
17:14 River joined
17:14 oisdk joined
17:15 raingloom joined
17:18 <River> Hi everyone! I need a little help with a small function. I have a function defined like this: """obtainWordList fp = return . lines =<< readFile fp""", which has as signature """FilePath -> IO [String]""", and I would like to simplify it a little bit by removing the "fp" at the end of the definition (and of course from the arguments), but when I remove it I get """Expected type: FilePath -> IO [String], actual type: FilePath -> [Stri
17:22 <xcmw> River: obtainWordList = (lines `fmap`) . readFile
17:22 <cocreature> River: the problem is that (return . lines =<< readFile) fp is not the same as return . lines =<< readFile fp
17:22 ragnak24 joined
17:22 <xcmw> I generated that with pointfree.io
17:22 <xcmw> So I think it will work but I have not tested it
17:23 <cocreature> just "fmap lines . readFile" is more readable imho
17:23 <xcmw> Yes
17:24 Charn joined
17:24 pio_ joined
17:28 keepLearning512 joined
17:29 gienah joined
17:29 gienah joined
17:29 fujiy joined
17:31 <kuribas> pointfree isn't always better
17:31 <kuribas> often an argument makes things more readable
17:33 agander_ joined
17:33 <iron_houzi> Can someone please help me with me trying to use parser monads? I'm trying to follow: http://www.cs.nott.ac.uk/~pszgmh/monparsing.pdf, and on page 9 it says that one should change the Parser def from a type alias to a data type, but I have no clue as to how to do this. So far I have the following: https://github.com/ironhouzi/hstib/blob/tib_monad/src/Main.hs#L279-L288
17:34 <cocreature> iron_houzi: that looks like Parser is already a data type
17:34 <cocreature> ah are you asking about how you can fix the rest of the code now that you’ve changed it to a datatype?
17:35 <iron_houzi> cocreature: Above it you see the commented out type alias that used to work without the Monad
17:35 <River> great! concreature and xcmw, thanks a lot for the help
17:35 <iron_houzi> cocreature: Yeah
17:35 <River> have a nice day
17:35 <cocreature> iron_houzi: so if you substitute m = Parser in the type signature you see that result has to be of type "a -> Parser a"
17:36 alexteves joined
17:36 <cocreature> \inp -> [(v, inp)] is of type [Letter] -> [(a, [Letter])] so this will produce an error
17:36 amirpro joined
17:36 <cocreature> however, you have a function of type ([Letter] -> [(a, [Letter])] -> Parser a in your code. do you know which function that is?
17:37 <iron_houzi> From what I understand, the function ([Letter] -> [(a, [Letter])]) is the parser
17:37 emilypi joined
17:37 <iron_houzi> You can see in the document I'm trying to follow
17:37 youtmon joined
17:38 <cocreature> what I am asking for is a function "f :: ([Letter] -> [(a, [Letter])] -> Parser a". once you have found what "f" is you can fix your code by changing the definition of result to "result v = f (\inp -> [(v, inp)])"
17:39 <iron_houzi> It tries to teach parser monads in a way where the Parser is first defined without using Monads, then switch to Monads to teach the reader how the Monad works .. but the switch isn't 100% described in terms of implementation unfortunately
17:40 <iron_houzi> s/It/The document/
17:40 <iron_houzi> cocreature: I'll try to let your comment marinate a bit ..
17:41 <iron_houzi> cocreature: Thanks for you help
17:41 <iron_houzi> cocreature: To me it's just weird that the type alias didn't need this function you're talking about..
17:42 <iron_houzi> Why is that suddenly needed?
17:42 <cocreature> iron_houzi: a type alias doesn’t create a new type. it just creates an “alias” i.e. a new name for an existing type
17:42 xcmw joined
17:43 <cocreature> a "data" declaration creates a newtype so you’ll have to do some plumbing to create and consume values of this new type
17:43 <* hackage> relational-query 0.11.2.0 - Typeful, Modular, Relational, algebraic query engine http://hackage.haskell.org/package/relational-query-0.11.2.0 (KeiHibino)
17:44 blankhart joined
17:45 <iron_houzi> OK, I get that String is a type alias for [Char] ... and how `Parser a` is a type alias for `[Letter] -> [(a, [Letter])` .. but this doesn't translate to defining a data type..
17:46 <cocreature> a data type is a completely separate type. you can _only_ construct values of that type by using the constructors defined in the data declaration and you consume values of that new type by pattern matching on the constructors
17:46 <cocreature> if you define "type X = Int" then you can use any value "x :: Int" as a value "x :: X"
17:47 <cocreature> if you define "data X = MakeX Int" then you need to use the MakeX constructor
17:48 earendel joined
17:49 tzemanovic joined
17:50 bendo joined
17:52 reactormonk joined
17:52 SenasOzys joined
17:53 amirpro joined
17:54 BenHertz513 joined
17:55 aksz joined
17:55 earendel joined
17:57 <iron_houzi> cocreature: You asked me if I knew what function I had with the type ([Letter] -> [(a, [Letter])] -> Parser a), isn't this the function `result`? which used to be a function, but now I'm trying to convert to an instance ..
17:59 <iron_houzi> cocreature: Here's the initial version without the Monad and data type: https://github.com/ironhouzi/hstib/blob/typing/src/Main.hs
18:02 <cocreature> iron_houzi: no, I mean a function that works for your new Parser type, not for the type synonym
18:02 mreh_ joined
18:03 <cocreature> iron_houzi: hint: the name of the function starts with a capital letter :)
18:04 <iron_houzi> cocreature: I don't understand. I am utterly confused and you seem to have an answer you don't want to share with me..
18:05 <cocreature> iron_houzi: I don’t want to ruin the fun and the joy of figuring out the answer yourself :) if you want me to just tell you the answer I can do so but ime that’s significantly less helpful than figuring things out yourself (with some hints)
18:05 darjeeling_ joined
18:06 <iron_houzi> cocreature: Dude! I've been trying for days before asking this question here .. I would *love* to just get the answer and figure out the understanding from there.. the eureka moments will come anyways
18:07 <cocreature> iron_houzi: alright, "result v = Parser (\inp -> [(v, inp)])" should work
18:07 acertain joined
18:08 ecmuller joined
18:08 chaosmasttter joined
18:09 <iron_houzi> cocreature: Thank you *so* much! To me it seems like I left out the data type constructor in the result definition
18:10 sarna joined
18:10 <cocreature> iron_houzi: if you run ":t Parser" in ghci you’ll see that it has exactly the type "([Letter] -> [(a, [Letter])] -> Parser a" that I’ve told you to look for
18:10 <cocreature> iron_houzi: to avoid confusion it might also make sense to rename the constructor so that the type and the constructor don’t have the same name
18:11 <cocreature> e.g. "data Parser a = MkParser …"
18:11 ZeuPiark joined
18:11 Vulfe joined
18:12 oisdk joined
18:12 hallowed joined
18:12 <iron_houzi> cocreature: Thanks! I'll have a new chance to work this understanding into implementing the instance for `bind`
18:13 aarvar joined
18:13 oisdk joined
18:14 pipahask joined
18:15 replay joined
18:16 oisdk joined
18:17 tomphp joined
18:18 <ZeuPiark> hello
18:20 dddddd joined
18:22 cybai joined
18:22 jix joined
18:25 fmixing joined
18:26 fmixing joined
18:29 agander_ joined
18:32 cloudhead joined
18:33 Estracult joined
18:33 pzp joined
18:34 <iron_houzi> Why does `:t concat` return Foldable t => t [a] -> [a], when it should be [[a]] -> [a] ?
18:34 <geekosaur> because it's been generalized
18:34 <geekosaur> % :t concat @[]
18:35 <yahb> geekosaur: [[a]] -> [a]
18:35 <hpc> iron_houzi: it's a recent change
18:35 <hpc> (relatively speaking)
18:35 <iron_houzi> Wow, correctness can be so confusing to a beginner :)
18:35 <iron_houzi> geekosaur: Thank you
18:36 <geekosaur> basically, instead of being specific to lists, it can now be used on anything which is "list-like" in some fashion, expressed by the "Foldable" constraint
18:36 <geekosaur> (Foldable is actually more general than just things that look like lists, though.)
18:36 dodong joined
18:38 <srk> cooking a network-status library https://lpaste.net/5408154408884109312
18:40 dogweather joined
18:42 zdenal joined
18:42 alex`` joined
18:44 malorie joined
18:45 davr0s joined
18:48 patlv joined
18:50 Jackneilll joined
18:53 blender joined
18:53 UnChallengeD joined
18:53 mentayolo joined
18:54 dogweather joined
18:57 albertus1 joined
19:00 chaosmasttter joined
19:02 verement joined
19:02 ccomb joined
19:04 enterprisey joined
19:05 bbrodriguez joined
19:09 Gurkenglas joined
19:10 zdenal joined
19:13 danso joined
19:13 SenasOzys joined
19:14 desperek joined
19:17 <* hackage> safe-buffer-monad 0.1.0 - A monadic buffer resilient to exceptions http://hackage.haskell.org/package/safe-buffer-monad-0.1.0 (dcastro)
19:19 Scip joined
19:19 valentinbuza joined
19:19 Estracult joined
19:20 <Estracult> Hey
19:21 keepLearning512 joined
19:21 kapil___ joined
19:22 conal joined
19:24 <Estracult> Is anyone online?
19:25 <glguy> There are always people around, there are over 1700 users idling right now
19:25 <cocreature> Estracult: just ask your question :)
19:26 osa1 joined
19:27 Heffalump left
19:27 gawen joined
19:28 vurtz joined
19:29 paidnode joined
19:30 conal_ joined
19:32 dogweather joined
19:32 tromp joined
19:34 davr0s joined
19:35 xkapastel joined
19:36 dibblego joined
19:36 <mrm> Well, I'm not online.
19:37 conal joined
19:38 malorie joined
19:41 alexteves_ joined
19:42 Jello_Raptor__ joined
19:42 woodson joined
19:42 <Jello_Raptor__> Im thinking of making a higher order lattice/partial-order typeclass in the style of Ord1 or Traversable1 but I vaguely remember that there's alternate design patterns that let you express that `Foo1 f = forall a. (Foo a) implies (Foo (f a))` construct.
19:43 <Jello_Raptor__> Some of my interfaces require a `Foo1 f` constraint because my backend instantiates f with a whole bunch of different parameters that should be hidden from the user.
19:43 alexteves_ joined
19:45 <dmwit> You may be thinking of this library:
19:45 <dmwit> ?hackage constraints
19:45 <lambdabot> http://hackage.haskell.org/package/constraints
19:45 amar joined
19:46 <dmwit> Personally I prefer the *1 pattern, when that's sufficient. Fewer fancy extensions.
19:47 blender joined
19:48 rflec028 joined
19:48 pagnol joined
19:48 alx741 joined
19:51 Ariakenom joined
19:51 keepLearning512 joined
19:52 beauby joined
19:52 rflec028 joined
19:53 ozzymcduff joined
19:55 zdenal joined
19:55 halogenandtoast joined
19:56 Capattack77 joined
19:57 xcmw joined
19:58 blender joined
20:00 <rihards> hey, i'm a bit confused by typeclasses, like Functor, which can appear as :: Functor f => f a -> ... in type signatures. what's the thing in the typeclass definition that sets apart Functor, Applicative, Monad and others from, say, Num and Eq?
20:00 <infinisil> rihards: Check :k in ghci of each of those
20:00 <infinisil> That's the kind
20:00 <rihards> that is, why is it that i can write :: Functor f => f a -> ... and not Num n => n a -> ...
20:00 mreh_ joined
20:01 quobo joined
20:02 <rihards> oh, i'll have some reading to do. thanks
20:02 dogweather joined
20:02 <cocreature> % :k Num
20:02 <yahb> cocreature: Num :: * -> Constraint
20:02 <cocreature> % :k Functor
20:02 <yahb> cocreature: Functor :: (* -> *) -> Constraint
20:02 <infinisil> rihards: Oh and https://stackoverflow.com/questions/27095011/what-exactly-is-the-kind-in-haskell
20:03 oisdk joined
20:04 danso joined
20:05 <maerwald> any good hlint linter rule sets?
20:05 <* dmwit> sticks his tongue into his cheek
20:05 <dmwit> I use the empty set every time I program.
20:09 patlv joined
20:09 <rihards> it's weird that kinds have never come up (at least for me) when going through writings explaining functors and applicatives and such. i guess this has been hampering my ability to understand type signatures involving them for a while now
20:10 Cthalupa joined
20:10 <c_wraith> rihards: in some sense, they're an entirely emergent property, and not part of the Haskell spec.
20:11 oisdk joined
20:11 __bo joined
20:11 <c_wraith> rihards: I think that's why a lot of resources neglect them
20:13 <glguy> The Haskell Report defines kinds, which part were you thinking was outside the spec?
20:13 <maerwald> that would be a pretty significant GHCism
20:14 <c_wraith> Is that something added for 2010?
20:14 <glguy> No, kinds were described in 98, too
20:14 <glguy> There just isn't a syntax for writing them in your code, but they are covered in the report
20:15 <__monty__> Also, before datakinds, kinds didn't really matter to 99% of cases, so why bother treating them?
20:15 <c_wraith> maerwald: well, even if I was correct (which it seems I wasn't), it's still an emergent property of the type system.
20:16 <glguy> __monty__: No, kinds stil matter lots without data kinds
20:16 valentinbuza joined
20:16 jmcarthur joined
20:16 <__monty__> glguy: But there was only 2 and even now I don't see # cropping up anywhere. It's all about *.
20:16 <glguy> It's about * and kinds formed with ->
20:16 <c_wraith> __monty__: no, there's also (->)
20:17 <__monty__> Ah, right.
20:17 <__monty__> My bad.
20:17 <c_wraith> Java only has *. :)
20:18 _bo joined
20:18 seizo joined
20:18 <int-e> ah the good old times where kinds were easy: *, #, (#), ? and ??
20:19 <c_wraith> technically, that whole mess still exists in ghc, it's just hidden behind an extension now
20:19 <c_wraith> And it's also a lot more principled now.
20:21 SirRoy joined
20:22 <Xal> I'm having a bit of hard time writing a polymorphic Stream instance for megaparsec: https://lpaste.net/7678566871368466432
20:22 <mniip> int-e, yeah but now there's * :: *
20:22 <Xal> I want to be able to wrap around a regular Stream and tag some information on it, but I can't quite figure out how to get it to typecheck
20:23 <mniip> or more specifically TYPE :: TypeRep -> TYPE LiftedRep
20:24 athan joined
20:24 fmixing joined
20:25 <int-e> mniip: yes, horrible :P
20:25 <mniip> the funny thing about * :: * is that when you look at it you only see * :: *
20:25 <mniip> but there's also the fact that * :: *
20:26 <c_wraith> Xal: do you have ScopedTypeVariables enabled?
20:26 <mniip> that means that '*' is itself a type!
20:26 <mniip> % :k Maybe *
20:26 <yahb> mniip: Maybe * :: *
20:27 SirRoy left
20:27 <c_wraith> Xal: without ScopedTypeVariables, the s on line 7 is a *different* s than on line 4
20:27 <mniip> which, hmm, to think of it
20:27 <c_wraith> Xal: and that's what the compiler is complaining about
20:27 Cthalupa joined
20:28 <glguy> mniip: Just Int :: Maybe *
20:28 <glguy> Just Just :: Maybe (a -> Maybe a)
20:29 <c_wraith> Xal: or maybe you just want to pass prx instead of creating a new proxy? (I can't tell, I'm not looking at the megaparsec docs)
20:29 <Xal> c_wraith: that's the error with it enabled
20:29 <Xal> I need to pass it a new proxy for the stream it wraps around
20:29 acertain joined
20:30 <c_wraith> Xal: oh, should you be using one of the type families there? (Proxy :: Proxy (Token s)), maybe?
20:30 sqrt2 joined
20:31 <mniip> glguy, Just Int is not a term though
20:31 <__monty__> int-e: Are those haskell report kinds or are they ghc specific? I can't find the kind definitions in the haskell report.
20:31 <c_wraith> Xal: that one appears it would make the compiler happy, but I'm not sure it would work correctly
20:31 alx741 joined
20:33 edmundnoble_ joined
20:33 <int-e> __monty__: that's all ghc. # is for unboxed values, (#) is for unboxed tuples, and ? and ?? are ad-hoc combinations of these just for (->) :: ? -> ?? -> * (so ? is * or #; ?? is * or # or (#)). It's of little significance.
20:34 <glguy> mniip: Data.Maybe.isNothing (Nothing :: Maybe *) --- True
20:35 byte512 joined
20:35 <int-e> __monty__: the ? and ?? used to creep into the occasional type error, so it was useful to know about them once upon a time.
20:35 <__monty__> int-e: Ah, thanks. So the only haskell report kinds are * and combinations with ->?
20:35 <int-e> __monty__: yes
20:37 <geekosaur> hm. does h2010 even have types, aside from a background concept?
20:37 <geekosaur> er, kinds
20:37 <glguy> Yes
20:38 <Xal> c_wraith: while it pains me to do this, I think I'm just going to monomorphize it for now to get it working
20:39 <Xal> I'll come back later to figure out how to do it right
20:39 danthemyth joined
20:41 ozataman joined
20:42 merijn joined
20:42 lykrysh joined
20:42 WhatisRT joined
20:42 <Xal> c_wraith: it's an even stranger error when I try to implement it without the proxy: https://lpaste.net/3543512151375216640
20:42 <Xal> it's expecting a Token (SStream s) but getting a Token s
20:42 brocoli joined
20:42 <Xal> which should be the same thing due to the line `type Token (SStream s) = Token s`
20:43 <glguy> Xal: SStream s doesn't appear to equal s
20:44 <glguy> (and since it doesn't, the types don't match
20:46 <Xal> while s /= SStream s, Token s should equal Token (SStream s), no?
20:47 cloudhead joined
20:47 <glguy> You stopped reading too soon
20:47 <glguy> it's the second component of the pair that doesn't match
20:47 logzet joined
20:48 pwestling joined
20:49 <mreh> could I implement backtracking with STT []?
20:49 <mreh> (and restoring my state)
20:49 <Xal> glguy: this is what happens when you stare at ghc error message for too long, thank you!
20:51 patlv joined
20:52 zar joined
20:53 <jbetz> Is there any overlap between problems solved by dependent types and row polymorphism? I've been reading about purescript and all its row type magic and while yes, it seems useful, I wonder if there are better solutions to the record problem, and if records *themselves* are the problem. E.g., if there are better data structures that would enable Haskell programming to not rely on records so heavily.
20:53 <maerwald> haven't they given up on row types recently?
20:55 <suppi> nope. just on granulated Eff
20:55 <maerwald> ah right
20:55 <suppi> which is still available as a library i think?
20:56 <jbetz> maerwald: they dropped the row type in the Eff monax, but otherwise no. row type programming is all the rage in purescript.
20:57 pwestling_ joined
20:59 <jbetz> suppi: yeah, the ecosystem is still migrating to the new rowless Effect monad
21:00 <maerwald> is that better?
21:00 codesoup joined
21:03 sheyll joined
21:07 remyhr joined
21:08 <suppi> it's basically IO I think?
21:08 <jbetz> Pretty much
21:08 <suppi> i think they just didn't feel they get much value out of granulated Eff and it was too much of a hassle
21:09 <jbetz> And yes it's better, but not really a good instance to judge row types by
21:10 altjsus joined
21:13 Zipheir` joined
21:14 <jbetz> If that's what you meant
21:15 codesoup joined
21:15 <jbetz> I'm really just curious what the possiblity space is, and where row types fit into it, and what the big picture problem actually IS
21:17 <merijn> jbetz: I would say rowtypes are the answer to "I want ducktyping, but, you know, statically"
21:18 remyhr joined
21:18 <merijn> jbetz: So they capture a design space that is commonly tackled with either dynamic types or inheritance, while avoiding the downsides/flaws in those
21:18 <dminuoso> merijn: Isn't that subtyping?
21:18 <merijn> dminuoso: Yes, no, maybe.
21:18 <dminuoso> (Especially structural subtyping)
21:19 <merijn> Depends on your definition of subtyping ;)
21:19 <merijn> But yeah, rowtypes were invented to be "structural subtyping, except not sucky"
21:20 <Eduard_Munteanu> Doesn't Typescript have something like that as well?
21:21 oisdk_ joined
21:22 <Eduard_Munteanu> It maps reasonably well to JS.
21:23 youtmon joined
21:25 remyhr_ joined
21:25 <xcmw> Is there some generalization of Strong and Choice that allows you to pass an arbitrary bifunctor (* -> * -> *)?
21:26 <dminuoso> xcmw: What do you mean by "pass"
21:27 <xcmw> I have a data type that is strong with respect to These.
21:28 <* hackage> numhask-test 0.1.0.0 - Laws and tests for numhask http://hackage.haskell.org/package/numhask-test-0.1.0.0 (tonyday567)
21:28 remyhr joined
21:28 pwestling joined
21:28 <xcmw> dminuoso: I mean take a bifunctor and a profunctor as an argument and make sure that the profunctor is strong with respect to the bifunctor
21:29 <xcmw> I don't fully understand what I am doing
21:30 cybai joined
21:35 m0rphism joined
21:37 pwestlin_ joined
21:37 emilypi joined
21:39 tzemanovic joined
21:40 <jbetz> merijn: static duck typing, nice :)
21:41 errst joined
21:41 <joncfoo> I'm using RIO along with Yesod and noticed that RIO's logging functions end up blocking the whole program. Anyone run into something similar before?
21:42 <jbetz> That clarifies a lot, and explains why it doesn't feel like Haskell yet doesn't feel wrong either. Just slightly off.
21:42 diwo joined
21:44 Lears joined
21:45 codesoup joined
21:47 Vulfe joined
21:47 Vulfe joined
21:48 dodong joined
21:50 kvda joined
21:51 lykrysh joined
21:52 <jbetz> dminuoso: https://brianmckenna.org/blog/row_polymorphism_isnt_subtyping <-- this makes a good case for row polymorphism /= subtyping
21:53 beauby joined
21:53 scottschmidt joined
21:53 Guest89 joined
21:53 haskell_noob2 joined
21:54 camsbury joined
21:57 hphuoc25 joined
22:02 conal joined
22:09 haskell_noob2 joined
22:11 conal joined
22:16 codesoup joined
22:17 Mrd1 joined
22:18 dogweather joined
22:18 <Mrd1> Y
22:19 <Mrd1> hey where else?hey where else
22:20 ego joined
22:21 beauby joined
22:22 <phadej> xcmw: can't you express These-strenght as a composition of Strong/Choice classes?
22:23 <xcmw> phadej: Maybe
22:23 <phadej> These a b ~ Either a (Just a, b)
22:23 patlv joined
22:24 <phadej> s/Just/Maybe/
22:24 Mrd1 joined
22:24 <xcmw> I will try it
22:24 <dminuoso> Is there some good resource to understand MonadBaseControl and how to use it *correctly*?
22:24 <phadej> use as define instance, or use instances?
22:25 <phadej> use /existing/ instances
22:25 <Mrd1> Yeah..
22:25 fmixing joined
22:25 <dminuoso> phadej: define instances
22:26 <phadej> I just copy&paste the existing instances
22:26 <Mrd1> Hahah
22:26 <phadej> (I mean, if i have something looking like reader, i just copy Reader instance and change the names)
22:26 <glguy> Mrd1: Did you have any questions about Haskell?
22:27 <Mrd1> Emmm
22:27 Khisanth joined
22:27 <Mrd1> Nothing
22:27 pavonia joined
22:28 <glguy> Mrd1: OK, this channel is for discussing Haskell. You're welcome to come and chat if you end up having Haskell questions.
22:29 <Mrd1> Glguy: I just browsed
22:30 zariuq joined
22:30 <Mrd1> Glguy: chanel may be useful here
22:32 tzemanovic joined
22:33 <Mrd1> what is haskell?
22:33 dan_f joined
22:33 <kvda> Mr. Haskell
22:33 <kvda> This is a fan club
22:33 hamishmack joined
22:34 <Mrd1> Ohhh
22:34 <glguy> Mrd1: You can start with a page like https://wiki.haskell.org/Introduction and then bring back your questions about what you read
22:34 <kvda> Mrd1 https://en.wikipedia.org/wiki/Haskell_Curry
22:35 <Mrd1> Ok thank
22:35 <maerwald> he can just look at the topic
22:35 <xcmw> Haskell is a programming language
22:36 <Mrd1> Is it true
22:36 <xcmw> Is what true?
22:36 dogweather joined
22:36 <Mrd1> Haskell is aprogramming
22:36 <xcmw> Yes Haskell is a programming language
22:36 <maerwald> please read the channel topic
22:37 <Mrd1> what it looks like
22:38 <xcmw> Go to https://www.haskell.org and do the try it thing
22:38 <Mrd1> I like programming language and I want to be programmer.....
22:38 <maerwald> I want to be a rockstar
22:39 <lambdabot> I want to be a firetruck.
22:39 <rotaerk> you go be that, then, lambdabot
22:40 <maerwald> rotaerk: he cannot walk, has no IO! :>
22:40 <rotaerk> heh
22:40 danthemyth joined
22:41 codyrutscher joined
22:41 <Mrd1> Codyrutscher: wellcome
22:41 conal joined
22:41 <codyrutscher> can i ask a question
22:42 <Mrd1> Sure
22:42 <codyrutscher> i wasn't recently rootkitted
22:42 <codyrutscher> very shitty
22:42 <rotaerk> I wasn't either
22:42 <glguy> codyrutscher: This channel is for talking about Haskell specifically
22:42 <codyrutscher> got it
22:43 akhileshs joined
22:43 <maerwald> does haskell have rootkits? :>
22:44 <glguy> You could probably publish if you made one and overcame getting the RTS inside
22:44 hphuoc25 joined
22:44 rprije joined
22:44 oisdk joined
22:45 <glguy> Just speculating, though. I don't know that much about the implementation challenges involved :)
22:45 fmixing joined
22:45 <maerwald> next question would be: how do I become a rootkit programmer xD
22:47 codesoup joined
22:47 Mrd1 left
22:47 <maerwald> you probably need monads for that, I guess
22:48 armyriad joined
22:49 dogweather joined
22:50 Sgeo_ joined
22:54 rprije joined
22:58 russruss joined
23:00 pranz2 joined
23:01 worch joined
23:01 worch joined
23:02 johnvonneumann joined
23:02 Sgeo joined
23:03 jfredett joined
23:05 patlv joined
23:05 logicmoo joined
23:06 fmixing joined
23:06 danso joined
23:06 dogweather joined
23:08 taumuon joined
23:10 Scip_ joined
23:10 conal joined
23:12 conal joined
23:12 xcmw joined
23:14 fizbin joined
23:17 aarvar joined
23:19 akhileshs_ joined
23:20 plugin joined
23:20 Guest50841 joined
23:21 russruss left
23:22 Guest50841 left
23:22 nathanic joined
23:23 Sgeo_ joined
23:24 silver_ joined
23:26 fmixing joined
23:28 replay joined
23:28 <* hackage> numhask-histogram 0.1.3.0, numhask-range 0.2.3.1 (tonyday567): https://qbin.io/sink-park-mxbz
23:32 dogweather joined
23:34 xcmw joined
23:34 dented42 joined
23:38 akhileshs joined
23:38 bbrodriguez joined
23:39 jackdk joined
23:39 slackman joined
23:40 kjak joined
23:42 patlv joined
23:46 fmixing joined
23:47 <* hackage> aeson-filthy 0.1.2 - Several newtypes and combinators for dealing with less-than-cleanly JSON input. http://hackage.haskell.org/package/aeson-filthy-0.1.2 (AlecHeller)
23:47 bbrodriguez joined
23:47 codesoup joined
23:49 rprije joined
23:50 pipahask joined
23:50 bbrodriguez joined
23:52 killtheliterate left
23:52 <infinisil> Hey, is there something nice and tight for `\x -> do { f x; g; }`?
23:53 <jackdk> `\x -> f x *> g`?
23:53 <jackdk> `(*>)` from Control.Applicative
23:53 <infinisil> Without the lambda I'm hoping
23:54 <xcmw> (*> g) . f
23:54 <glguy> infinisil: It would seem pretty silly to give that a special name
23:55 <infinisil> xcmw: Oh nice!
23:55 <xcmw> pointfree.io generated that
23:55 <infinisil> Ah right
23:55 <infinisil> @pl \x -> f x *> g
23:55 <lambdabot> (*> g) . f
23:55 halogenandtoast joined
23:55 <glguy> Stuff you have to use ?pl to get generally isn't suitable for putting into actual source files
23:56 <infinisil> Eh, I think this isn't too bad
23:56 tzemanovic joined
23:56 <hpc> :t \x -> do { f x; g; }
23:56 <lambdabot> (FromExpr (m a), FromExpr (m b), Show t, Monad m) => t -> m b
23:58 Vulfe joined
23:58 dogweather joined
23:59 Vulfe joined
23:59 bbrodriguez joined