<    April 2017    >
Su Mo Tu We Th Fr Sa  
 2  3  4  5  6  7  8  
 9 10 11 12 13 14 15  
16 17 18 19 20 21 22  
23 24 25 26 27 28 29  
00:00 angelos joined
00:03 tikhon joined
00:05 <tikhon> I'm curious about how people approach logging. Do you ever log things from pure functions?
00:06 <jle`> usually only for debugging purposes
00:07 <jle`> mjhoy: a lot of people prefer to use IO's exception system to handle IO exceptions
00:08 <jle`> as opposed to Either
00:08 <jle`> there are a lot of neat tools built into GHC to make it a smooth process
00:08 <mjhoy> jle`: hmm. is there an easy way to convert to using Either?
00:08 <jle`> yes
00:09 <jle`> using try
00:09 fremenWalking joined
00:09 <jle`> try :: Exception e => IO a -> IO (Either e a)
00:09 <mjhoy> ah. thanks!
00:09 <jle`> so try (Network.Wreq.get "foo") :: IO (Either HttpException (Response BSL.ByteString))
00:10 johnw_ joined
00:10 <jle`> mjhoy: but, a lot of times you don't want the Either excplicitly, and just want to handle the exception right there
00:10 splanch joined
00:10 <jle`> for that you can use 'catch' or 'handle', or any of the other nice combinators in the Control.Exception module :)
00:11 <mjhoy> jle`: hmm. I'm requesting an xml document and then parsing it. I would have thought it'd just be easier to use Either for failure at any point
00:12 <jle`> using the exceptions system integrates with a lot of other parts of haskell IO nicely
00:12 <jle`> but you can always "convert to Either" using try if you actually wanted an Either
00:14 <mjhoy> thanks. i should probably try both to really understand it.
00:16 centril joined
00:16 Laney joined
00:17 mw joined
00:24 sellout- joined
00:25 Terry_ joined
00:26 cosmodanger joined
00:28 Noldorin joined
00:28 skeuomorf joined
00:29 m0rphism joined
00:30 Kundry_Wag joined
00:31 cmsmcq_ joined
00:31 nut joined
00:37 vaibhavsagar joined
00:37 andyhuzhill joined
00:38 nmnunu joined
00:41 m0rphism1 joined
00:48 nmnunu left
00:49 eacameron joined
00:51 prophile joined
00:51 pera joined
00:51 tikhon left
00:52 lambda-11235 joined
00:52 hybrid joined
00:52 benl23 joined
00:54 <Sornaensis> is there a way to pass C-- code to ghc
00:54 <c_wraith> Sornaensis: look for documentation on writing your own primops
00:54 <c_wraith> Sornaensis: it's a recent addition to GHC, but it exists
00:55 oisdk joined
00:57 AdolphusGustavus joined
01:00 takle joined
01:02 conal joined
01:06 meba joined
01:07 <Sornaensis> c_wraith: I looked around but what I am trying to do I guess is use ghc to compile c-- directly
01:07 Supersonic112_ joined
01:08 <geekosaur> afaik the only way to *run* cmm is for it to be a primop
01:08 ljc joined
01:09 benl23 joined
01:12 splanch joined
01:13 takle joined
01:15 conal joined
01:16 <Sornaensis> geekosaur: instead of haskell I want to pass in cmm
01:16 <Sornaensis> is this possible
01:16 <geekosaur> not so far as I know
01:16 Fairy joined
01:18 <Cale> There was a C-- compiler which got split off from GHC's development a long time ago, but they've diverged.
01:20 Jesin joined
01:21 <Sornaensis> Cale: is it still actively developed?
01:21 <lyxia> heheheh (return () :: MaybeT (... (MaybeT (MaybeT Identity))...) ()) has complexity O(2^(number of MaybeT))
01:21 <Sornaensis> x___X
01:22 <Cale> Sornaensis: I have no idea
01:23 <Cale> My guess would be no
01:26 skeuomorf joined
01:30 Kundry_Wag joined
01:32 splanch joined
01:35 shesek joined
01:38 systadmin joined
01:38 bjz joined
01:40 louispan joined
01:40 nomicflux joined
01:41 Apocalisp joined
01:41 eacameron joined
01:41 fizbin joined
01:45 takle joined
01:46 wrengr joined
01:47 tromp joined
01:47 mkoenig joined
01:48 <alx741> hello everyone, I runned into a problem: I need basically to do this "function n = g 3 (g 2 (g 1 n))" where 'g' is a function, but I need to do that for a list if 'Int' (so I'ts general and i don't have to hardcode those numbers there). Any help apreciated it
01:49 <alx741> I think it answer should be obvios, but at these point I just can't work it out
01:49 louispan_ joined
01:51 atec joined
01:51 <dolio> This sounds like a homework question.
01:51 Rainb joined
01:53 <Welkin> lol
01:53 ebsen joined
01:53 <Welkin> alx741: that is just a right fold
01:53 <atec> Hey guys, I'm having some trouble using Slack's API with Network.HTTP.Conduit
01:54 <alx741> it's not, it's just I ended up in a sutiation in with that as a fold does not work
01:54 <atec> I was lead there because I need HTTPS
01:54 <alx741> Welkin: Yes, I know, I just notice i didn't expres the actual problem there
01:54 <atec> But it still says I'm not authed
01:55 <atec> Does anyone know if there is anything I have to do to prepare the request? Or is simpleHttp on the URL enough?
01:57 <alx741> the problem is, that if I do "function p = foldr g p p", every aplication of 'g' needs to use the new changed p rather than the old one
01:58 burtons joined
01:58 <alx741> I'm having trouble even expressing the issue
01:58 <dolio> The 'changed' p is created by applying g.
01:58 <alx741> dolio: yes, exactly
01:58 <dolio> Although you wouldn't be using p twice.
01:59 takle joined
02:00 jayshua joined
02:00 _sras_ joined
02:00 <alx741> g applies some transformations on p, but these trasnformations needs to be available for the next round of transformations, but of course, the second 'p' there, stays always the same, so i have no clue how to proceed
02:00 jsgrant-_ joined
02:00 <atec> Guis. Pls halp
02:00 hucksy joined
02:00 <Welkin> alx741: just write a recursive function them
02:00 <Welkin> then*
02:00 <Welkin> it's not hard
02:03 <alx741> Welkin: right, didn't try aproaching that way, thanks a lot!
02:03 mda1 joined
02:04 <_sras_> Is there a Type class for Number like things, a money value, that can have operations + - / *, but not other methods in the Num instance?
02:05 conal joined
02:05 <Welkin> just Num
02:05 <Welkin> you can write your own typeclass though
02:10 <tobiasBora> Hi
02:10 <tobiasBora> I don't understand something with the exceptions...
02:11 mrowe joined
02:12 <tobiasBora> Hum...
02:12 fakenerd joined
02:12 <tobiasBora> Is the eroor " recv: resource vanished (Connection reset by peer)" a synchronous or asynchronous error?
02:13 eazar001 joined
02:13 <geekosaur> synchronous, you only find out the remote went away when you try to do something with the Handle
02:14 <tobiasBora> Because I'm using Control.Exception.Safe (note the Safe part) to catch all the errors that goes out of my downloading function:
02:15 takle joined
02:15 <tobiasBora> tryAgain = (myfunction xxx) `catch` (\_ -> tryAgain)
02:15 <geekosaur> uh
02:16 <tobiasBora> And most of the errors are indeed catched, but after a few hours I got an error "recv: resource vanished (Connection reset by peer)" the killed all my threads (I'm using the async lib to deal with threads)
02:16 <geekosaur> that error is not recoverable...
02:16 <_sras_> Welkin: But It doesn't make sense to have a "fromInteger" for money..
02:17 systemfault joined
02:17 <tobiasBora> geekosaur: Really? So it means that whatever I do, if I've a "recv: resource vanished" error, my client will die???
02:17 <geekosaur> it means retrying like you do won;t help
02:17 <geekosaur> the remote is not going to un-close its end of the connection
02:18 <geekosaur> (in fact it can't)
02:18 <geekosaur> you'll just get an endless stream of that exception over and over, and you may be discovering some place where exceptions 'leak'
02:18 ebzzry joined
02:18 <tobiasBora> I don't follow what you say...
02:19 exferenceBot joined
02:19 <geekosaur> "Connection reset by peer"
02:19 <geekosaur> the other side of the network connection *is gone*
02:19 <tobiasBora> geekosaur: Yes, but if I recreate the connection?
02:19 <geekosaur> you can retry all you want, you'll just get that again and again and again
02:19 <geekosaur> then it's a new connection, not the one you are working with
02:19 <geekosaur> that connection is dead
02:19 <tobiasBora> yes sure
02:19 <tobiasBora> I don't mind
02:20 <tobiasBora> actually when I try again, I even change the proxy
02:20 <tobiasBora> so here "myfunction" contains everything
02:20 <geekosaur> I also wonder what happens if you do an exception handler inside an exception handler; that's a nice corner case if they end up nesting deeply
02:20 <tobiasBora> : the request creation, the sending, the receiving, the parsing...
02:21 doomlord joined
02:22 Swizec joined
02:22 <geekosaur> so I am looking at the safe-exceptions package, and while this is technically 'synchronous' it's handled as asynchronous
02:22 mazeinmaze_ joined
02:22 <geekosaur> because retrying is assumed not to work, because it thinks you will retry with the same connection
02:23 <geekosaur> also, arguably you are doing ti wrong; you should be using bracket around the network connection; that's the only way this exception can be handled even partially synchronously
02:23 <geekosaur> otherwise you can leak sockets
02:23 minn joined
02:23 hexagoxel joined
02:24 <geekosaur> hm, looking coser, I guiess it does handle as synchronous. but still, you want bracket or you can leak the socket
02:25 <geekosaur> because throwing the exception will bypass any code that cleans up after the socket. that's what bracket is for
02:25 <tobiasBora> What do you mean by leak the socket?
02:25 <tobiasBora> ok
02:25 <geekosaur> it never gets closed
02:26 <tobiasBora> But I don't understand how you use brackets to avoid this problem
02:26 <geekosaur> Control.Exception.Safe.bracket
02:26 <tobiasBora> And is it really important if the socket is not closed ?
02:26 <tobiasBora> oh bracket the function
02:26 <geekosaur> yes, because they consume OS file handles and you will run out
02:26 <tobiasBora> ok
02:27 ebsen joined
02:27 <tobiasBora> But let's imagine I use bracket
02:27 julianleviston joined
02:27 <geekosaur> and it won't necessarily close stuff that went out of scope via an exception --- that's specifically why the dsafe-exceptions README talks about resource allocation, the normal allocation stuff doesn't behave nicely in the presence of exceptions
02:28 <geekosaur> it *will* eventually get cleaned up... but it may be a long time
02:30 <tobiasBora> but wait, I'm using "httpLbs requestWithProxy (manager sharedData)" to connect
02:30 <julianleviston> I’ve been trying to build a bunch of prisms around Haskell.Language.Exts… the Literal type presents no problem at all, but I’m having trouble with the Exp type, in particular multiparamater Sum elements such as InfixApp. How would one build a prism from that?
02:30 <tobiasBora> so I don't have any way to close it properly no?
02:30 sword865 joined
02:31 <julianleviston> This is how I build prism for Char, for example: _Char = Lens.prism Char (\s -> case s of (Char i) -> Right i ; _ -> Left s)
02:31 <geekosaur> tobiasBora, then hope the library is doing it and rethrowing... but it'll likely be throwing a normal exception and it may be handled as async
02:31 Kundry_Wag joined
02:32 Luna521 joined
02:32 <tobiasBora> geekosaur: So you mean that the "recv: resource vanished (Connection reset by peer)" error can be both sent async or sync?
02:32 <_sras_> How can I model Monetary values in Haskell so that I can do something like, mempty :: Money USD = 0 USD?
02:32 <geekosaur> which might also be a problem; safe-exceptions README warns against mixing it with regular exceptions, but most of the libraries you would use throw regular exceptions. I don't know if it handles those as anything other than async, since it wasn't thrown with its functions
02:33 <geekosaur> so it would have to assume async
02:33 Goplat joined
02:35 <julianleviston> _sras_: Sorry I don’t quite understand your question. Could you rephrase a bit with some more info?
02:35 takle joined
02:36 <Luna521> haskell is hard -_-!
02:36 <mounty> _sras_: you mean you want to model monetary values using Monoid?
02:37 <mounty> Luna521: maybe so but the rewards are great.
02:37 systadmin joined
02:38 <Luna521> yes itis very great ,i like haskell
02:39 <tobiasBora> geekosaur: Haskells exceptions are way to complicated ^^ What do you call "regular exceptions"? Is it sync exceptions? If yes you mean that safe-exception "async" catch do not work nicely with the sync errors?
02:39 <julianleviston> mounty: I get the feeling s/he wants to be able to do mconcat (ie <>) on Money a where a is a currency
02:39 <_sras_> julianleviston: mounty I was trying to use something like "data Money = Money Scientific Currency" where Currency = USD | INR
02:40 <julianleviston> _sras_: sure, can you give a simple expression that you would like to be able to evaluate using this, and your expected result?
02:40 <_sras_> julianleviston: mounty But now I find myself unable to do a fold to sum money values in an array
02:40 <geekosaur> reguklar exceptions = Control.Exception
02:40 uglyfigurine joined
02:41 <Squarism> theres no channel that lets multiple threads write to it (wo duping it) ?
02:42 <tobiasBora> geekosaur: Ah ok... But since it's the libraries that uses Control.Exception, I can't do anything for that right? So Control.Exception.Safe is useless for me?
02:42 <glguy> julianleviston: you can make a Prism' Exp (Field1,Field2)
02:42 <geekosaur> that is how I read the README, but you'd have to ask Snoyman or study the source to be certain :/
02:42 <julianleviston> _sras_: I wonder if mconcat (Money v1 c1) (Money v2 c2) = Money (convertMoney v1 c1 USD) (convertMoney v2 c2 USD) ?
02:43 <* geekosaur> basically thinks synchronous exceptions shouldn't be exceptions, notwithstanding the paean to exceptions earlier in here. we already have Either
02:43 <julianleviston> glguy: there are three fields in InfixApp …
02:43 <glguy> julianleviston: ok?
02:43 <julianleviston> glguy: I’d like to be able to use over on it
02:43 <_sras_> julianleviston: I don't want conversions to happen, and only want to allow operations between values in same currency.
02:44 <julianleviston> _sras_: oh ok… that sounds like some kind of value based constraint?
02:44 <glguy> julianleviston: and no that's probably not going to work for mappend, it's important that mempty is an identity element for mappend
02:44 <julianleviston> glguy: it wouldn’t work at all
02:45 <tobiasBora> geekosaur: Ok. So now, if I don't use anymore the safe exception library, and if I do a big catch, such that "UserInterrupt" is not cached, shall it work?
02:45 <julianleviston> glguy: ^ the mappend thing
02:45 <geekosaur> but exception-lovers think hacks like safe-exceptions solve the problems, when you have to ask "so what really happens if some library throws a Control.Exception exception instead of a "safe" exception?:"
02:45 <_sras_> julianleviston: Yes. i guess..
02:46 <tobiasBora> geekosaur: Yeah, at the beginning I thought that safe-exception was only a small overhead on top of regular exception, not a complete rewritting
02:47 <geekosaur> I don't know if it is or not. from what I read, I would have to go study the source to see whether it's actually safe or does what it leads me to except right up until the big warning not to mix it with Control.Exception exceptions
02:47 <geekosaur> which, uh, pretty much everything uses :/
02:47 burtons joined
02:49 <tobiasBora> geekosaur: Yes, and actually I never throw exceptions by myself...
02:49 <tobiasBora> it's always the library
02:50 raycoll joined
02:51 <tobiasBora> The nice thing is that Ctr-C is not catched by the new catch, but I have that the recv exception will be cached this time...
02:51 <tobiasBora> The problem is that it's very difficult to test, because it happened maybe once every 15h...
02:52 louispan joined
02:54 <tobiasBora> So I hope it will be enough, thank you geekosaur!
02:55 <julianleviston> glguy: what would a Prism’ Exp (Field1, Field2) do? I’m not sure I understand what Field-N are for, other than to help with tuples?
02:56 <glguy> julianleviston: gives you a place to put the fields of the constructor you're making the prism for
02:57 <julianleviston> glguy: not sure I follow, sorry… :( This is the constructor I’m trying to write a prism for: InfixApp :: Exp -> QOp -> Exp -> Exp
02:57 <julianleviston> glguy: I just want to focus on the first Exp
02:57 <julianleviston> glguy: it’s the haskell syntax representing an infix operator application
02:57 <glguy> a prism doesn't focus on a single field
02:58 <julianleviston> glguy: oh… what does it focus on?
02:58 <glguy> it focuses on all the fields
02:58 <julianleviston> ah… it focusses on a single item of a sum type
02:59 <julianleviston> So I want a lens.
02:59 <julianleviston> duh :)
02:59 <julianleviston> you rock :) thanks :)
02:59 <julianleviston> a lens within a prism.
02:59 iputra joined
03:00 <julianleviston> glguy: ok, so I’d do a Prism to (Field1, Field2, Field3), and even make a type for it, and then I could make a lens for each field within that. Yay :)
03:00 <glguy> yeah
03:01 zalun1 joined
03:04 takle joined
03:04 MP2E joined
03:05 darjeeling_ joined
03:07 vtomole joined
03:12 raduom joined
03:12 Argue_ joined
03:13 takle joined
03:14 Luna521 joined
03:15 iputra left
03:15 eklavya joined
03:17 Luna521 joined
03:17 np356 joined
03:20 <julianleviston> glguy: can I tip you somehow?
03:21 <julianleviston> I now have data InfixAppExp = InfixAppExp (Exp, QOp, Exp) and _InfixAppExp :: Lens.Prism' Exp InfixAppExp which is great.
03:23 gaze__ joined
03:24 gaze__ left
03:26 nomicflux joined
03:31 felixsch__ joined
03:32 preyalone joined
03:32 gaze joined
03:38 MarioBranco joined
03:38 gaze__ joined
03:43 mda1 joined
03:44 mbuf joined
03:46 splanch joined
03:47 MarioBranco joined
03:48 BalterNotz joined
03:50 mac10688 joined
03:50 BalterNotz joined
03:53 Luna521 joined
03:54 <julianleviston> glguy: well thanks, anyway.
03:55 frankpf joined
03:56 {emptyset} joined
04:00 Luna521 joined
04:00 WhiskyRyan joined
04:01 bjz joined
04:05 louispan joined
04:07 meba joined
04:07 enitiz joined
04:13 fakenerd joined
04:14 descender joined
04:16 benl23 joined
04:21 sleffy joined
04:22 Xanather joined
04:22 feynhat joined
04:24 tripped joined
04:25 JoelMcCracken joined
04:26 mizu_no_oto joined
04:29 Swizec joined
04:30 uglyfigurine joined
04:32 chu joined
04:32 eklavya joined
04:33 HarveyPwca joined
04:38 benl23 joined
04:40 BartAdv joined
04:41 fakenerd joined
04:41 Gurkenglas joined
04:41 takle joined
04:43 systadmin joined
04:43 mda1 joined
04:43 <jle`> can i get ghc to infer what kind a given type variable is
04:45 <oelewapperke> jle`: you could be a bit more specific with this question. But yes.
04:47 <jle`> i have foo :: f a -> Bar a, for example, and i want to infer what the kind of 'f' is
04:47 <jle`> in this example i can do it in my head; if a :: k, then f :: k -> Type
04:47 <jle`> but can i ask ghc
04:48 <glguy> Yes, there's a flag
04:48 <jle`> er, i mean, if Bar :: K -> Type, then i can guess that a :: K, and f :: K -> Type
04:48 <glguy> -fprint-explicit-kinds
04:48 <jle`> hm thanks
04:48 <jle`> and then I :t it
04:48 <jle`> brilliant
04:48 <jle`> thanks :)
04:49 zoran119 joined
04:49 <jayshua> Is the only difference between type and newtype that type makes a non-type-system-enforced type and newtype makes a type-system-enforced... "new type"?
04:50 aarvar joined
04:50 <jle`> type is just a lexical alias, more or less
04:50 <jle`> newtype makes an actual new type
04:50 <glguy> newtype introduces a new, distinct type. type merely creates an alias
04:50 <jle`> newtype is closer in nature to 'data' than type is
04:50 <zoran119> i built an executable using 'stack build', and am trying to run the executable from '.stack-work/install/x86_64-linux-ncurses6/lts-8.6/8.0.2/bin/' on another machine
04:51 <zoran119> i'm getting ' libgmp.so.10: cannot open shared object file: No such file or directory'
04:51 <zoran119> i'm thinking that just copying that executable from the .stack-work directory is a bad idea
04:52 <zoran119> can anyone confirm my suspicion? and help me get the executable in the correct way
04:52 castlelore joined
04:52 castlelore joined
04:53 <dolio> zoran119: The problem is most likely that GMP isn't installed on the new machine.
04:53 Xanather_ joined
04:54 <dolio> Copying the exe could be dicey if you dynamically linked. GMP is one of the things that's always dynamically linked.
04:55 takle joined
04:55 <dolio> Oh, alternately, it might be installed, but not the right version.
04:55 andreass joined
04:56 <zoran119> dolio, interesting
04:56 <zoran119> dolio, i was intending to build a http rest service using scotty, and then just copy this executable and run it in docker
04:56 <zoran119> dolio, sounds like a bad idea?
04:56 HarveyPwca joined
04:57 <dolio> Well, you can set most stuff to link statically (not sure what the default is with all tools these days).
04:57 <dolio> But GMP will never be linked statically, I think.
04:57 <dolio> It's not a Haskell library.
04:59 robertkennedy joined
04:59 <zoran119> dolio, would you know what ubuntu package installs GMP?
04:59 <dolio> There's some way to not use GMP, but I'm not sure what happens then linking wise.
04:59 falafel joined
05:00 <dolio> No, but it'd probably either be 'gmp' or 'libgmp' or something along those lines.
05:00 mitchty joined
05:03 splanch joined
05:04 hybrid joined
05:05 frankpf joined
05:06 cpup joined
05:06 mmachenry joined
05:08 <ludat> zoran119, https://www.fpcomplete.com/blog/2016/10/static-compilation-with-stack maybe this could help
05:09 obadz joined
05:10 osa1_ joined
05:12 osa1 joined
05:14 louispan joined
05:19 AndiK joined
05:22 splanch joined
05:22 meandi_2 joined
05:24 Reshi joined
05:25 Luna521 joined
05:26 splanch_ joined
05:27 msko joined
05:28 splanch joined
05:28 HarveyPwca joined
05:29 takle joined
05:29 HarveyPwca joined
05:30 uglyfigurine joined
05:30 hybrid joined
05:30 brynedwards joined
05:34 takuan joined
05:37 Argue__ joined
05:38 afnizarnur joined
05:42 splanch joined
05:42 HarveyPwca joined
05:43 jmcarthur joined
05:44 splanch_ joined
05:48 <jle`> anyone know where the proof that the monad instance of list obeys the monad laws can be found online
05:53 louispan joined
05:56 fakenerd joined
05:57 danvet joined
05:58 takle joined
05:58 baldrick joined
06:02 connrs joined
06:07 AX3L joined
06:07 mrowe joined
06:08 meba joined
06:08 connrs joined
06:10 zzzq joined
06:11 deepfire joined
06:11 HarveyPwca joined
06:11 zzzq joined
06:12 zzzq joined
06:20 sujeet joined
06:21 zoran119 joined
06:24 Lokathor joined
06:25 simukis_ joined
06:28 sujeet joined
06:29 tromp joined
06:30 takle joined
06:31 dawehner joined
06:32 zzzq joined
06:33 castlelore joined
06:33 wrengr joined
06:35 osa1_ joined
06:36 edsko joined
06:36 fractalsea joined
06:38 hurkan joined
06:39 sujeet joined
06:43 athan joined
06:43 takle joined
06:44 Sose joined
06:47 MoALTz joined
06:47 sujeet joined
06:48 enitiz joined
06:49 guest8126 joined
06:52 castlelore joined
06:52 mda1 joined
06:54 systadmin joined
06:57 teggi joined
07:01 zariuq joined
07:01 eklavya joined
07:02 eklavya_ joined
07:03 ainchk joined
07:03 afnizarnur joined
07:03 insitu joined
07:03 bjz joined
07:04 acoder joined
07:05 ubsan_ joined
07:06 andyhuzhill1 joined
07:06 ner0x652 joined
07:09 zariuq joined
07:09 [[[[[ExTRa]]]]] joined
07:10 xaimus joined
07:10 [[[[[ExTRa]]]]] left
07:11 iomonad joined
07:12 wright joined
07:13 Zialus joined
07:15 stearnsi joined
07:16 zariuq joined
07:17 mmn80 joined
07:17 zariuq joined
07:18 sypwex joined
07:18 obadz joined
07:22 boombanana joined
07:23 zargoertzel joined
07:23 Ferdirand joined
07:26 KarboniteKream joined
07:26 oish joined
07:32 eklavya joined
07:32 takle joined
07:34 raichoo joined
07:34 mohsen_ joined
07:35 coot joined
07:40 eklavya_ joined
07:43 c137 joined
07:43 Kreest__ joined
07:44 <c137> Hello, I'm trying to configure haskell-mode in Emacs. Please help me with this part "Invoke: make EMACS=/path/to/your/emacs". Does it mean directory to my emacs init.el or what?
07:45 jchia_1 joined
07:49 edvorg joined
07:54 plutoniix joined
07:56 robotroll joined
07:57 splanch_ joined
07:58 fred-fri joined
07:58 marr joined
07:59 Itkovian joined
07:59 splanch__ joined
08:00 oish joined
08:00 hackebeilchen joined
08:07 orbifx joined
08:07 KarboniteKream joined
08:08 <fred-fri> https://www.hackerrank.com/challenges/diagonal-difference Wrote a quick and dirty Java solution https://pastebin.com/1EtaRW1D but struggling to solve it in Haskell. I'd be interested to see any solution anyone might come up with. (asked this earlier but was disconnected)
08:08 meba joined
08:09 alexelcu joined
08:09 lep-delete joined
08:10 takle joined
08:10 splanch joined
08:11 splanch_ joined
08:12 <fred-fri> jle`, ping
08:13 <jle`> what have you tried?
08:14 splanch__ joined
08:15 <fred-fri> after parsing the input into an array of arrays, ive made a terrible explicitly recursive algo that accepts a value so far and the current iteration
08:15 <jle`> you mean a list of lists, right?
08:15 <fred-fri> yes
08:15 <jle`> > zipWith (!!) [[1,2,3],[4,5,6],[7,8,9]] [0..]
08:15 <lambdabot> [1,5,9]
08:15 <jle`> > sum $ zipWith (!!) [[1,2,3],[4,5,6],[7,8,9]] [0..]
08:15 <fred-fri> im still stuck in imperative programming mindset
08:15 <lambdabot> 15
08:16 splanch joined
08:16 <jle`> that's one of the diagonals
08:16 <jle`> for the other you can just map reverse
08:16 <fred-fri> christ that easy huh
08:16 <jle`> > sum $ zipWith (!!) (map reverse [[1,2,3],[4,5,6],[7,8,9]]) [0..]
08:16 <lambdabot> 15
08:16 <jle`> did you expect it to be hard? :p
08:17 <jle`> it's hard in imperative-land at least, for sure.
08:17 <fred-fri> well my java solution wasnt hard necessarily it just took time
08:18 <jle`> > map (map read . words) . lines $ "1 2 3\n4 5 6\n7 8 9"
08:18 <lambdabot> [[*Exception: Prelude.read: no parse
08:18 <jle`> > map (map read . words) . lines $ "1 2 3\n4 5 6\n7 8 9" :: [[Int]]
08:18 <lambdabot> [[1,2,3],[4,5,6],[7,8,9]]
08:19 <fred-fri> > sum $ zipWith (!!) [[11,2,4],[4,5,6],[10,8,-12]] [0..]
08:19 <lambdabot> 4
08:20 <jle`> do you see how zipWith (!!) blah [0..] gets the diagonals?
08:20 <fred-fri> > sum $ zipWith (!!) (map reverse) [[11,2,4],[4,5,6],[10,8,-12]] [0..]
08:20 <jle`> s/diagonals/diagonal
08:20 <lambdabot> error:
08:20 <lambdabot> • Couldn't match expected type ‘[Integer] -> [a]’
08:20 <lambdabot> with actual type ‘[c0]’
08:20 <jle`> watch your parentheses
08:21 <fred-fri> yeah, the magic is the [0..] i guess? thats what makes it take the next one to the right
08:21 takle joined
08:21 <jle`> [0..]
08:21 <jle`> > sum $ zipWith (!!) [[1,2,3],[4,5,6],[7,8,9]] [0,1,2]
08:21 <lambdabot> 15
08:21 <jle`> [0..] is just [0,1,2] there
08:22 Jin_ joined
08:22 <jle`> so zipWith (!!) [xs,ys,zs] [0,1,2] = [xs !! 0, ys !! 1, zs !! 2]
08:22 <fred-fri> > sum $ zipWith (!!) (map reverse [[11,2,4],[4,5,6],[10,8,-12]]) [0..]
08:22 <lambdabot> 19
08:22 <fred-fri> mind blown
08:22 <fred-fri> haskell is ridiculously powerful
08:23 MarcelineVQ joined
08:23 balor joined
08:23 <jle`> > map reverse [[11,2,4],[4,5,6],[10,8,-12]]
08:23 <lambdabot> [[4,2,11],[6,5,4],[-12,8,10]]
08:26 systadmin joined
08:27 Jin__ joined
08:29 zariuq joined
08:30 thc202 joined
08:30 zargoertzel joined
08:35 Croniamental joined
08:37 tdfirth joined
08:38 Argue joined
08:39 systadmin joined
08:42 systadmin joined
08:46 e_svedang joined
08:46 fizruk joined
08:47 anuxivm joined
08:52 locallycompact joined
08:53 splanch joined
08:54 vydd joined
08:54 vydd joined
08:56 splanch_ joined
08:57 verement joined
08:57 splanch__ joined
08:57 robotroll joined
09:00 Aruro joined
09:01 Aruro joined
09:02 verement joined
09:02 session joined
09:04 oberstein joined
09:05 Gabemo joined
09:06 fractalsea joined
09:07 zcourts joined
09:08 doomlord joined
09:09 ebzzry joined
09:10 jgertm joined
09:12 Jackneill joined
09:12 fotonzade joined
09:12 inad922 joined
09:14 Jackneill joined
09:16 ClaudiusMaximus joined
09:18 jchia_1 joined
09:21 eklavya joined
09:22 free_beard joined
09:23 takle joined
09:23 tdfirth joined
09:24 fred-fri joined
09:25 Kreest_ joined
09:25 egis joined
09:25 t0by joined
09:26 louispan joined
09:27 twanvl joined
09:31 tromp joined
09:32 Icewing joined
09:32 Lord_of_Life joined
09:33 initiumdoeslinux joined
09:34 balor joined
09:35 baldrick joined
09:36 fizruk joined
09:36 thunderrd__ joined
09:40 Lord_of_Life joined
09:42 zdenal joined
09:42 heebo joined
09:43 Younder joined
09:44 takle joined
09:51 fakenerd joined
09:51 yellowj joined
09:53 tomboy64 joined
09:56 doomlord joined
09:58 silver joined
09:59 Wizek joined
10:00 alanb99 joined
10:00 Wizek_ joined
10:03 bennofs joined
10:03 bennofs joined
10:03 insitu joined
10:04 <doomlord> how is GPU programming in haskell,
10:05 takle joined
10:06 epsilonhalbe joined
10:08 kenperkins joined
10:08 epsilonhalbe left
10:09 cyborg-one joined
10:09 meba joined
10:13 heebo joined
10:16 Levex joined
10:16 Itkovian joined
10:18 netheranthem joined
10:18 eacameron joined
10:20 coot joined
10:21 Prutheus joined
10:23 JuanMiguel joined
10:24 zariuq joined
10:26 wildlander joined
10:27 zargoertzel joined
10:28 fuzzy-id joined
10:31 zariuq joined
10:34 rjg_ joined
10:34 prophile joined
10:42 bbcue joined
10:44 mikaunix joined
10:50 balor joined
10:50 skeuomorf joined
10:55 kritzcreek_ joined
10:55 _sg joined
11:00 boombanana joined
11:01 dmiles joined
11:01 doomlord joined
11:02 kuribas joined
11:02 jbracker joined
11:04 oisdk joined
11:08 balor joined
11:11 ziocroc joined
11:12 edsko joined
11:12 moongazer joined
11:14 zeroed joined
11:15 ericsagnes joined
11:17 RegEchse joined
11:20 anton_ joined
11:20 coot joined
11:22 splanch joined
11:23 splanch_ joined
11:25 splanch__ joined
11:29 splanch joined
11:30 redfish64 joined
11:30 arpl joined
11:31 <redfish64> Hey, I'm looking at: http://stackoverflow.com/questions/19774564/what-does-it-mean-to-compose-two-functors and it shows a syntax I've never seen before, namely "data Compose f g x = Compose (f (g x))"
11:31 tromp joined
11:32 <redfish64> I'm trying to understand the right hand side. I would look it up, but I can't figure out the right terms to search google on
11:32 <session> it's a definition of a datatyp
11:32 <session> e
11:32 <redfish64> Yes, but what does (f (g x)) mean
11:32 <redfish64> How does it restrict it?
11:33 alanb99 left
11:33 <redfish64> I tried a simpler version "data C f x = C (f x)
11:33 <redfish64> "
11:33 <redfish64> and I noticed that it accepts "C 1"
11:33 <redfish64> but not "C 'c'"
11:33 <session> C 1 would be a complicated thing to explain
11:33 <session> @let data C f x = C (f x)
11:33 <lambdabot> Defined.
11:33 <session> :t C "foo"
11:33 <lambdabot> C [] Char
11:33 <session> f ~ []
11:33 <session> x ~ Char
11:33 <session> f x ~ [Char]
11:35 <jle`> redfish64: when you define data Maybe a = Nothing | Just a, what d you think that does?
11:35 ozgura joined
11:35 nick_h joined
11:35 <jle`> redfish64: if i did 'Maybe Int', it'd be same as data MaybeInt = Nothing | Just Int
11:35 <redfish64> jle`: It creates a plethera of types
11:35 <jle`> redfish64: if i did 'Maybe Bool' it'd be the same as 'data MaybeBool = Nothing | Just Bool'
11:35 <jle`> exactly
11:35 <jle`> same thing for 'data Compose f g x = Compose (f (g x))'
11:36 LordBugs joined
11:36 <jle`> if i had `Compose Maybe IO Int`, that's the same as if i had written Compose (Maybe (IO Int))
11:36 <jle`> data MaybeIO a = ComposeMaybeIO (Maybe (IO a))
11:36 t7 joined
11:37 <jle`> data ListMaybe a = ComposeListMaybe [Maybe a]
11:37 <redfish64> Ok, so it's pattern matching on the type of the right hand side
11:37 <redfish64> ?
11:37 <jle`> data IOList a = ComposeIOList (IO [a])
11:37 <jle`> data Compose f g a = Compose (f (g a))
11:37 <jle`> no pattern matching is really going on
11:37 numee joined
11:37 <jle`> what you're doing is *parameterizing* a type
11:38 <jle`> so the Compose type is *parameterized* by f, g, and a
11:38 <jle`> and whatever you pick for f, g, and a, gives you that type
11:38 <jle`> so if i pick f as IO and g as Maybe and c as Int, then Compose contains an IO (Maybe Int)
11:38 <jle`> same for 'data Maybe a = Nothing | Just a'
11:38 <jle`> i'm *parameterizing* a type, on 'a'
11:39 <jle`> if i pick a to be Bool, the Just contains a Bool
11:39 <jle`> if i pick a to be an Int, then Just contains an Int
11:39 <redfish64> Ok, that makes sense
11:41 <Myrl-saki> Quick question about classical logic.
11:41 <Myrl-saki> Can you go
11:41 <Myrl-saki> `A -o B. A. Therefore A.`
11:41 ner0x652 joined
11:41 <Myrl-saki> s/classical/linear/
11:41 <Myrl-saki> Or is the only valid conclusion `B`?
11:41 <redfish64> like so "x :: Compose Maybe Maybe Int ;x = Compose (Just (Just 5))"
11:41 <session> Myrl-saki, you definitely can
11:41 <redfish64> thx
11:42 <session> @djinn (a -> b) -> a -> a
11:42 <lambdabot> f _ a = a
11:42 <Myrl-saki> session: This is linear logic though, not classical!
11:42 <session> ah
11:42 <Myrl-saki> session: Though. Using djinn as proof is pretty clever.
11:42 bbear joined
11:43 <session> that's more complicated
11:43 <bbear> hello
11:43 <Myrl-saki> session: Indeed.
11:43 <bbear> I find myself having trouble with working with the 'Maybe' Constructor
11:43 <bbear> Once you start working with it, it seems you have to carry on this kind of error handling all the way through.
11:44 <session> Myrl-saki, you're destroying (a -> b)
11:44 <session> I think that's not allowed
11:44 <bbear> for example I have a function that returns a 'Maybe Int' and I want to index a list with it, how would I do that ?
11:44 <Myrl-saki> session: Yep. That's what I'm also thinking.
11:44 <Myrl-saki> session: a -o b isn't used.
11:44 <session> now, I don't have a formal definition with me so
11:45 <Myrl-saki> session: That's pretty interesting though, if you think about it.
11:45 <Myrl-saki> session: That means that for any given list of types, there should only be one conclusion.
11:46 <Myrl-saki> session: Or maybe you can do some ambiguity magic?
11:47 Prutheus joined
11:48 KarboniteKream joined
11:48 <jle`> bbear: you can use fmap :)
11:48 <jle`> i wrote a blog post about this style, actually
11:48 <jle`> bbear: https://blog.jle.im/entry/inside-my-world-ode-to-functor-and-monad.html
11:49 <jle`> i address this exact situation
11:49 <Hafydd> I thought that was going to be about ordinary differential equations, at first.
11:49 <jle`> but basically, if you have an (Int -> a) function and a Maybe Int, you can use fmap to turn it into a Maybe Int -> Maybe a
11:49 eacameron joined
11:50 <jle`> > fmap ("hello" !!) (Just 2)
11:50 <lambdabot> Just 'l'
11:50 <session> Myrl-saki, is polymorphism allowed
11:50 <jle`> Hafydd: those come in part 2
11:50 <Myrl-saki> session: Hmmm.
11:50 fakenerd joined
11:50 <session> A. B. (a -> b -> b).
11:52 <Myrl-saki> session: Okay. I need some explanation.
11:52 bjz joined
11:52 <Myrl-saki> session: What happens to A and B?
11:52 <session> x:A. y:B. f:(a -> b -> b)
11:52 <session> f x y : B
11:52 <session> f y x : A
11:54 <bennofs> Does intero have a function to lookup the haddocks for symbol under point?
11:54 <bbear> jle`: thanks
11:54 <bbear> i'm reading the article right now
11:54 <Myrl-saki> session: I see.
11:55 balor joined
11:55 geekosaur joined
11:55 <Myrl-saki> session: Wadler's papers did say something about monomorphism.
11:55 baldrick joined
11:55 <session> as in antipolymoprhism
11:55 <session> or as in monic morphisms?
11:55 <Myrl-saki> session: I have no idea. :P
11:56 Mysterious_Light joined
11:58 <Myrl-saki> session: https://pdfs.semanticscholar.org/4106/dd3be01f1283f80a8260420138d6ee874753.pdf
11:58 <Myrl-saki> session: Page 3.
11:58 Icewing_ joined
11:59 jayjam124 joined
12:02 pavonia joined
12:04 <bennofs> Is there some standard "inverted either" type? I want to find the first Right, but if there is no Right, get all the messages of the Lefts
12:04 malice joined
12:04 <malice> Hi!
12:05 <malice> I have a string that I want to output. However, I want to make it concise and amazing.
12:06 <malice> e.g. I know I could use putStrLn, but I'd like it to be more clever
12:06 <malice> However, my Haskell knowledge is limited... Do you have any suggestions?
12:07 <srhb> malice: putStr "foo\n" is one character shorter!
12:07 eacameron joined
12:08 splanch joined
12:09 <Myrl-saki> bennofs: Use First?
12:09 <srhb> malice: (Well, two, but now you need the newline!)
12:09 <Myrl-saki> bennofs: Oh wait.
12:09 <Myrl-saki> bennofs: Yeah.
12:10 splanch_ joined
12:10 <Myrl-saki> @hoogle
12:10 <lambdabot> package base
12:10 <lambdabot> package bytestring
12:10 <lambdabot> package containers
12:10 meba joined
12:10 <Myrl-saki> @hoogle :: Either a b -> (a -> c) -> (b -> c) -> c
12:10 <lambdabot> Prelude either :: (a -> c) -> (b -> c) -> Either a b -> c
12:10 <lambdabot> Data.Either either :: (a -> c) -> (b -> c) -> Either a b -> c
12:10 <lambdabot> Data.Strict.Either either :: (a -> c) -> (b -> c) -> Either a b -> c
12:10 <Myrl-saki> Wait. Did I just say use First for Either?
12:11 <malice> srhb: but it's not clever
12:11 splanch__ joined
12:11 <malice> I mean, it's obvious and simple. I want something more creative
12:12 <malice> I'm not golfing :)
12:12 splanch joined
12:13 <srhb> malice: I think anything but using putStrLn to output a string on a line is _less clever_ :-P
12:13 <srhb> malice: Perhaps you're looking for silly or funny instead.
12:13 <bbear> hard
12:14 splanc___ joined
12:14 sepp2k joined
12:14 <MarcelineVQ> bennofs: https://hackage.haskell.org/package/validation-0.5.4/docs/Data-Validation.html#t:AccValidation possibly
12:14 <malice> srhb:well, that's what I meant
12:15 <malice> I want to be playful with the code
12:15 <malice> That's what I meant by clever :)
12:17 jchia_ joined
12:17 <srhb> malice: OK! :) Sorry, I don't think I have any good suggestions. You could try outputting each character and then sequencing the IO actions. That's a bit more complicated at least.
12:18 nut joined
12:18 lep-delete left
12:19 ublubu joined
12:19 <malice> I have some idea, I'll see how it works. If anyone else has suggestions, feel free to tell me!
12:19 <malice> Thaks, srhb!
12:19 sdothum joined
12:19 oish joined
12:19 eacameron joined
12:20 moth joined
12:20 alexelcu joined
12:21 oish_ joined
12:24 jchia_ joined
12:24 beanbagula joined
12:24 nut joined
12:26 sablib joined
12:28 bergmark joined
12:32 deepfire joined
12:32 osa1 joined
12:32 HoierM joined
12:33 tromp joined
12:33 HoierM joined
12:34 Claudius1aximus joined
12:37 tomboy64 joined
12:38 lerax joined
12:39 Ronnin joined
12:42 Ronnin left
12:42 <tobiasBora> Hello! I'm getting crazy... I put a `catch` that should stop ALL exceptions, and 1h30 of execution, my program crashs because of exception! Here the exception I got this time: Error_Packet "partial packet: expecting 4096 bytes, got: 2884"
12:43 Ferdirand joined
12:44 LeCamarade joined
12:45 <lyxia> show some code :)
12:48 bab joined
12:48 fakenerd joined
12:49 <bennofs> tobiasBora: can you show the code where you expect to catch the exception?
12:49 <tobiasBora> lyxia: bennofs : Here is the whole function that do most of the work: https://pastebin.com/EXnebvdf
12:50 stux|RC-only joined
12:50 <bennofs> tobiasBora: you only catch exceptions of type HttpException there
12:50 <tobiasBora> bennofs: Why? At the end I've " _ -> do
12:50 eacameron joined
12:50 <tobiasBora> "
12:51 <bennofs> tobiasBora: because exception catching is based on type
12:51 Gurkenglas joined
12:51 <bennofs> tobiasBora: and e is infered to be the the type that the HttpExceptionRequest constructor belongs to
12:51 <bennofs> tobiasBora: if you write someFun `catch` \(e :: IOError) -> ... you will only catch IO errors
12:52 <bennofs> (as an example)
12:52 <tobiasBora> bennofs: So one catch can be used only one kind of exception? I though that their where one type Exception and that others exceptions would rely on it...
12:52 <bennofs> tobiasBora: since in this case, you do case e of HttpExceptionRequest ..., GHC infers that e :: HttpException, thus the catch only catches HttpExceptions
12:53 <tobiasBora> Hum I see... So how is it possible to do a catch that catches everything?
12:53 xkapastel joined
12:53 <bennofs> tobiasBora: you can use SomeException, a type which can wrap any exception and can be used to catch any exception
12:54 <bennofs> tobiasBora: note though, that's often not what you want, as some exceptions shouldn't be caught (like HeapOverflow etc)
12:55 <bennofs> tobiasBora: see https://www.schoolofhaskell.com/user/snoyberg/general-haskell/exceptions/catching-all-exceptions
12:56 sphinxo joined
12:57 magneticduck joined
12:57 sdx23 joined
12:58 jgertm joined
13:01 cobreadmonster joined
13:05 tomboy64 joined
13:11 meba joined
13:14 systadmin joined
13:14 Ferdirand joined
13:17 Kundry_Wag joined
13:20 contiver joined
13:24 sepp2k joined
13:25 zariuq joined
13:27 pavonia joined
13:30 JuanMiguel joined
13:30 l4m8d4 joined
13:30 eacameron joined
13:31 <l4m8d4> Hello there, I am a haskell noob wanting to know if there is a haskell library for manipulating terms like (term)^n, where term is some polynomial
13:34 <Myrl-saki> l4m8d4: Yeah.
13:34 <l4m8d4> Like, for example, multiplying it out to get a polynomial again, and then simplify that
13:34 <l4m8d4> Myrl-saki: Might I hear your suggestion? ;)
13:34 zargoertzel joined
13:35 <Myrl-saki> l4m8d4: Hmm
13:35 tromp joined
13:35 <Myrl-saki> l4m8d4: This seems one. https://hackage.haskell.org/package/polynomial
13:36 <Myrl-saki> l4m8d4: `(Num a, Eq a) => Num (Poly a)`
13:36 BartAdv joined
13:36 eklavya joined
13:38 ljhms joined
13:40 ragepandemic joined
13:41 muesli4 joined
13:41 <l4m8d4> Myrl-saki: Thank you, that should do the trick. Just saw it can calculate polynomial^n
13:43 rcat joined
13:47 zcourts joined
13:47 jao joined
13:47 zeroed joined
13:47 zeroed joined
13:50 MindlessDrone joined
13:50 dddddd joined
13:53 eklavya joined
13:54 mjhoy joined
13:54 balor joined
13:56 suppi joined
13:57 suppi joined
13:57 darkSeid_ joined
13:57 <tobiasBora> bennofs: Hum... I'm trying to follow what the second link said, but I'm not sure to understand how to check if my "SomeException" is an "HttpMessage"
13:58 <tobiasBora> *HttpExceptionRequest
13:58 <tobiasBora> I tried something like:
13:58 <tobiasBora> case toException ex of
13:58 <tobiasBora> HttpExceptionRequest
13:58 <tobiasBora> but without surprise it's not working
13:58 <bennofs> tobiasBora: you need to use fromException
13:59 _sg joined
13:59 <bennofs> tobiasBora: fromException :: SomeException -> Maybe e
13:59 <bennofs> tobiasBora: pass in SomeException, get Maybe HttpException
14:00 <tobiasBora> bennofs: Oh I see. And if it's not an HttpException, it will be "Nothing" right?
14:00 jayshua joined
14:00 <bennofs> tobiasBora: yes
14:00 eklavya_ joined
14:01 Kundry_Wag joined
14:02 np356 joined
14:02 orbifx joined
14:03 <tobiasBora> bennofs: Ok great thank you. I ended up with this code, can you confirm it sounds correct please? https://pastebin.com/26R1Djpz
14:05 doomlord joined
14:08 <bennofs> tobiasBora: does look correct to me
14:09 bergmark left
14:10 ljhms joined
14:10 detrumi joined
14:10 tromp joined
14:11 <tobiasBora> bennofs: Ok great, thank you very much for your help. Hope this time everything will work!
14:11 <ggVGc> sure
14:18 stearnsi left
14:18 Ferdirand joined
14:20 sphinxo joined
14:20 babu` joined
14:20 mekeor joined
14:21 wtetzner joined
14:23 minn joined
14:24 itachi joined
14:27 dfeuer joined
14:28 ljhms joined
14:29 mmachenry joined
14:29 Gurkenglas joined
14:29 oish joined
14:29 zcourts joined
14:31 nick_h joined
14:32 conal joined
14:32 mda1 joined
14:33 <Myrl-saki> ggVGc: ggccg
14:33 <Myrl-saki> ggVGc: ggcg*
14:33 <Myrl-saki> ggVGc: ggcG
14:34 <MarcelineVQ> ggVGc: ggccggc
14:35 <ggVGc> uhm
14:37 boombanana joined
14:37 <session> and then he whips out a pdf A4-sized article on why he's ggVGc and not ggdG
14:37 enitiz joined
14:38 <ggVGc> nope, it wasn't about that this time"!
14:38 <ggVGc> actually, wonder if I still have the page up
14:38 <ggVGc> seems so
14:39 WhiskyRyan joined
14:39 gillesmajor joined
14:39 gillesmajor left
14:39 reactormonk[m] joined
14:41 takuan joined
14:42 oisdk joined
14:46 carlomagno joined
14:47 oberstein joined
14:47 e14 joined
14:48 zeroed joined
14:48 zeroed joined
14:48 splanch joined
14:50 alexelcu joined
14:51 enitiz joined
14:51 numee joined
14:56 osa1 joined
14:56 osa1 joined
14:56 anuxivm left
15:01 meta-coder joined
15:02 fizbin joined
15:04 stef204 joined
15:05 nomicflux joined
15:05 Mon_Ouie joined
15:06 ljhms joined
15:07 itachi joined
15:08 <itachi> when we say a function can be consider as a value with "context"? what does context mean?
15:09 Deide joined
15:09 KarboniteKream joined
15:10 balor joined
15:10 eklavya joined
15:12 selthas joined
15:14 connrs joined
15:15 [[[[[ExTRa]]]]] joined
15:15 itachi_ joined
15:16 baldrick joined
15:17 <hpc> itachi_: it basically just means the result of the function depends on the parameters
15:17 fizruk joined
15:17 <hpc> it's nothing too profound, basically just one of hundreds of rephrasings of "first class functions are pretty nice"
15:18 <hpc> which they are
15:18 <itachi_> so if a function take a Int parameter the int value is its context?
15:18 oberstein joined
15:18 jayshua joined
15:19 doomlord joined
15:20 jmcarthur joined
15:21 azahi joined
15:22 agjacome joined
15:22 ebzzry joined
15:23 freeside joined
15:23 insitu joined
15:23 yellowj joined
15:23 osa1 joined
15:23 osa1 joined
15:23 electrostat joined
15:24 pera joined
15:25 freeside joined
15:25 oberstein joined
15:28 alx741 joined
15:29 WhiskyRyan joined
15:30 eacameron joined
15:30 conal joined
15:38 connrs joined
15:38 mmachenry joined
15:39 thimoteus joined
15:39 narendraj9 joined
15:40 ozgura joined
15:42 JuanMiguel joined
15:45 xall joined
15:47 Lord_of_Life joined
15:48 e0d1n joined
15:48 oberstein joined
15:50 anton__ joined
15:50 splanch joined
15:50 orbifx joined
15:51 insitu joined
15:54 Detrumi joined
15:55 WhiskyRyan joined
15:55 trism joined
15:55 dawehner joined
15:55 <monochrom> hpc: I think when the wording is "a value with context" it is working towards a functor, applicative, monad story.
15:56 msko joined
15:57 urodna joined
15:58 mmn80 joined
15:58 enitiz joined
16:00 Levex joined
16:03 sepp2k joined
16:04 KarboniteKream joined
16:05 theelous3 joined
16:07 enitiz joined
16:07 LnL joined
16:07 Lord_of_Life joined
16:07 yigitozkavci joined
16:08 <yigitozkavci> Hi guys, I have a generic method and looked up on Hoogle and found nothing like it. I wonder if there is a better way of doing it. Can we post code in here?
16:09 balor joined
16:09 kritzcreek_ joined
16:10 Lord_of_Life joined
16:10 <glguy> You can post code to http://lpaste.net
16:12 jgertm joined
16:13 nomicflux joined
16:15 kappter joined
16:15 e_svedang joined
16:16 connrs joined
16:17 <jayshua> Say I have a record `Info a = Info {infoList :: [a]}`. How would I constrain `a` to a type class? It looks like data type contexts were removed for good reasons. Is there an alternative?
16:18 coot joined
16:19 mmachenry joined
16:19 oberstein joined
16:21 Nikotiini joined
16:22 <implementation> jayshua: you can write constraints into the type signatures of the functions dealing with Info. And in the best case, you only add it to those functions that really require `a' to meet that constraint.
16:24 conal joined
16:24 Sose joined
16:25 sleffy joined
16:25 <implementation> for example, the function isInfoListEmpty would not require that constraint, so it shouldn't have it (that's exactly why data type contexts were removed), but the function doSomeComplexInfo (that you had in mind when designing the type) does
16:26 <jayshua> So if I write a function that does require the constraint, the type system will prevent calling it with a value of Info that doesn't satisfy?
16:26 LnL joined
16:26 phyrex1an joined
16:26 <freeside> try it! see what happens!
16:28 oisdk joined
16:29 meandi joined
16:30 xall joined
16:32 Rainb joined
16:33 zeroed joined
16:34 <jayshua> Ok, I think I understand now. Thanks implementation
16:34 Mysterious_Light joined
16:34 Sonolin joined
16:35 sleffy joined
16:37 Micamo joined
16:42 ziocroc joined
16:43 eklavya joined
16:45 BarryGettman[m] joined
16:45 avn joined
16:46 eazar001 joined
16:48 mac10688 joined
16:50 ptek joined
16:50 WhiskyRyan joined
16:50 fizruk joined
16:51 BarryGettman[m] left
16:53 moth joined
16:53 ebzzry joined
17:01 eacameron joined
17:02 e14 joined
17:02 <bbear> hey buddys
17:03 <bbear> say I have a function that does f [a]->[a] which actually performs an operation on the last element of a and append that modified value at the end of the list.
17:03 <bbear> for example f :: [Int]->[Int]
17:03 <bbear> f foo = foo ++ [1+(last foo)]
17:04 <bbear> how would I do to iterate this thing a given number of times ?
17:05 zeroed joined
17:05 <freeside> unfoldr?
17:06 basdb joined
17:06 <bbear> yes maybe
17:06 <bbear> :t unfoldr
17:06 <lambdabot> (b -> Maybe (a, b)) -> b -> [a]
17:06 systemfault joined
17:06 <freeside> what you eventually want is a State monad, i think
17:06 <bbear> mmh yes maybe
17:07 <bbear> I am just trying to get the grasp of Haskell, I cannot say I am really proficient with Haskell.
17:07 <tomjaguarpawaway> Someone mentioned me, but now I don't know who :)
17:08 eacameron joined
17:09 gienah joined
17:10 <rotaerk> <nh2> tomjaguarpawaway: I don't understand what the point of ProductProfunctor is. Reading the docs, it seems like it is simply a data type that is both Applicative and Profunctor. Then, why is there need for an extra class for it, why would using `(Applicative (p a), Profunctor p) => ... p ...` not be enough?
17:10 <rotaerk> is the last mention of you in my history :P
17:11 eacamero_ joined
17:11 _ashbreeze_ joined
17:12 coot_ joined
17:13 marcopullo joined
17:13 sk35_bot_mil joined
17:13 <freeside> bbear: it is traditional to cons to the head of the list rather than append to the tail
17:13 <freeside> so, use : instead of ++
17:15 argent0 joined
17:15 <Cale> It's not just traditional
17:15 <Cale> x:xs is constant time
17:15 <bbear> yes I know
17:15 <Cale> xs ++ [x] takes O(length xs) time
17:16 <bbear> but I would prefer to use unfoldr
17:16 <bbear> getPath = unfoldr (\foo -> if (snd foo)==Nothing then Nothing else Just (foo, benderNextState foo) )
17:16 <bbear> I don't know if unfoldr has teh same limitation though.
17:17 supaket joined
17:18 np356 joined
17:18 <sk35_bot_mil> Are Lists in haskell single linked lists ? And if so then last and init more expensive than head and tail? (Apropros ++ and : )
17:18 <ski> @type isNothing
17:18 <lambdabot> Maybe a -> Bool
17:18 <Cale> Yes
17:19 <Cale> @src last
17:19 <lambdabot> last [x] = x
17:19 <lambdabot> last (_:xs) = last xs
17:19 <lambdabot> last [] = error "Prelude.last: empty list"
17:19 <Cale> You can see here that last is recursive, and has to walk down the entire list
17:19 <Cale> @src init
17:19 <lambdabot> init [x] = []
17:19 <lambdabot> init (x:xs) = x : init xs
17:19 <lambdabot> init [] = error "Prelude.init: empty list"
17:19 <Cale> similarly here
17:19 <Cale> @src tail
17:19 <lambdabot> tail (_:xs) = xs
17:19 <lambdabot> tail [] = error "Prelude.tail: empty list"
17:20 <Cale> @src (++)
17:20 <lambdabot> [] ++ ys = ys
17:20 <lambdabot> (x:xs) ++ ys = x : (xs ++ ys)
17:20 <lambdabot> -- OR
17:20 <lambdabot> xs ++ ys = foldr (:) ys xs
17:20 xall joined
17:20 conal joined
17:20 <Cale> Here you can see why xs ++ ys would take O(length xs) time
17:20 <sk35_bot_mil> Yep
17:21 <sk35_bot_mil> Thx
17:21 <Cale> A common way to avoid this problem if you're writing a program which would otherwise concatenate a lot of lists
17:21 zeroed joined
17:21 <Cale> is to replace the list type [a] with the function type [a] -> [a], with the idea being that you're going to construct a function which adds elements to the beginning of another list it's given
17:21 <Cale> [] becomes id
17:21 <Cale> [x] becomes (x:)
17:22 <Cale> and, importantly, (++) becomes (.)
17:22 <Cale> Since function composition is constant time, this can improve the asymptotic performance of programs
17:22 coltfred joined
17:23 eschnett joined
17:23 <Cale> You can then apply the resulting function to an empty list at the end to recover the ordinary list result.
17:23 <Cale> For example, suppose we had data Tree a = Tip | Branch (Tree a) a (Tree a)
17:23 perrier-jouet joined
17:23 <Cale> and we wanted to write an in-order traversal of that
17:24 <Cale> We might naively start with
17:24 <Cale> inorder :: Tree a -> [a]
17:24 <Cale> inorder Tip = []
17:24 coot joined
17:24 <Cale> inorder (Branch l x r) = inorder l ++ [x] ++ inorder r
17:25 <Cale> But in the worst case of a left leaning tree, this will take quadratic time
17:25 <Cale> So, we can apply that trick:
17:25 <Cale> inorder' :: Tree a -> [a] -> [a]
17:25 <Cale> inorder' Tip = id
17:25 <Cale> inorder' (Branch l x r) = inorder' l . (x:) . inorder' r
17:25 <Cale> and then to recover the final result, we can apply the function we built to an empty list:
17:26 <Cale> inorder t = inorder' t []
17:26 <Cale> and that's now linear time in the size of the tree
17:28 balor joined
17:29 monochrom joined
17:29 prophile joined
17:31 stef204 joined
17:34 <sk35_bot_mil> Thats nice.
17:37 <sk35_bot_mil> I am pretty new to haskell so I dont know if it is somehow possible to have a looping data constructor. Like Enum but if you rum succ on the last constructor you get the first ?
17:38 Wizek__ joined
17:38 beerdrop joined
17:39 <freeside> https://wiki.haskell.org/Tying_the_Knot
17:39 jluttine joined
17:39 <Cale> sk35_bot_mil: Oh, the behaviour of Enum just depends on how the instance is written -- usually people expect that you'll use the derived instance, but if you want, you can write your own.
17:40 ExpHP joined
17:40 <ExpHP> @djinn (Applicative f)=> (f Bool -> f b -> c) -> (f (Maybe b) -> c)
17:40 <lambdabot> Error: Class not found: Applicative
17:40 <ExpHP> @djinn (Monad f)=> (f Bool -> f b -> c) -> (f (Maybe b) -> c)
17:40 <lambdabot> -- f cannot be realized.
17:40 <ExpHP> :O
17:41 prophile joined
17:41 <sk35_bot_mil> Yes I thought so and my next thought was maybe someone else already did that and I just dont know it yet
17:41 insitu joined
17:41 exferenceBot joined
17:41 <ExpHP> @djinn ((a -> Bool) -> (a -> b) -> c) -> (a -> Maybe b) -> c
17:41 <lambdabot> -- f cannot be realized.
17:42 <ExpHP> uhm
17:42 <freeside> http://stackoverflow.com/questions/5684049/is-there-some-way-to-define-an-enum-in-haskell-that-wraps-around
17:43 balor joined
17:44 <hpc> ExpHP: that's correct
17:44 <hpc> you can't produce an (a -> b) to pass to that first function
17:44 <hpc> so you can't get c
17:44 <ExpHP> oh rats
17:45 tomboy64 joined
17:45 <sk35_bot_mil> freeside: thx
17:46 <freeside> urwlcm
17:46 Itkovian joined
17:47 mstruebing joined
17:48 <bbear> how can I display my list one element per line ?
17:48 <freeside> unlines
17:49 <freeside> > putStr $ unlines $ show <$> [1..3]
17:49 <lambdabot> <IO ()>
17:49 <ExpHP> bbear: you can do mapM_ print [1,2,3,4]
17:50 johnw_ joined
17:50 <ExpHP> bbear: which is the same as print 1 >> print 2 >> print 3 >> print 4 (er, mostly the same)
17:50 ozgura joined
17:50 centril joined
17:50 <ExpHP> :t mapM_
17:50 <bbear> ok
17:50 <lambdabot> (Monad m, Foldable t) => (a -> m b) -> t a -> m ()
17:51 Adeon_ joined
17:52 bbloom joined
17:52 bxc joined
17:53 LordDeath joined
17:53 pdgwien joined
17:53 raycoll joined
17:53 LeNsTR joined
17:53 <bbloom> if I under `read "x"` in to ghci, I get out an Exception with "no parse" - I was surprised by that, vs getting an ambiguous instance resolution. how do i know what code is actually running here?
17:53 eacameron joined
17:53 <bbloom> s/under/enter
17:54 <Cale> bbloom: try read "()"
17:54 <geekosaur> bbloom, see the ExtendedDefaultRules ghc extension
17:55 <Cale> https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html#type-defaulting-in-ghci
17:55 anry joined
17:55 <bbloom> Cale: that's odd, since :t tells me that the type is `Read a => a` - is there a way to tell me that it will actually be unit?
17:56 <bbloom> geekosaur: thanks. looking
17:56 froztbyte joined
17:56 froztbyte joined
17:56 comboy joined
17:56 fotonzade joined
17:57 Itkovian joined
17:57 <Cale> bbloom: Have a look at the link I posted
17:57 noctux joined
17:57 <bbloom> Cale: thanks. reading that now
17:58 <Cale> bbloom: Basically, ghci tries harder than usual to default any ambiguous types, because it's easier in isolation to write expressions whose type is ambiguous
17:59 <bbloom> ok - gotcha. thanks folks
17:59 x1n4u joined
17:59 naudiz joined
17:59 eacameron joined
17:59 malt3 joined
17:59 sdothum joined
18:00 Baughn joined
18:01 kaol joined
18:01 KarboniteKream joined
18:02 nopf joined
18:03 mkoenig joined
18:03 mojjo joined
18:05 tomboy64 joined
18:06 eacameron joined
18:06 jmiven joined
18:07 <jle`> is there a nice way to use explicit type annotations with operators?
18:07 <jle`> *type applications
18:07 Unhammer joined
18:07 <freeside> huh?
18:08 <jle`> instead of (+) @Int 3 4
18:08 <jle`> can i use (+) in operator form
18:08 <jle`> and still the type application?
18:08 ninja_in_neopren joined
18:08 <jle`> `3 + @Int 4` doesn't quite work
18:08 <bbear> break point s in Haskell ? Is that possible ?
18:09 arun_t joined
18:09 <freeside> https://ghc.haskell.org/trac/ghc/ticket/12363
18:09 leothrix joined
18:10 <arun_t> any one from India particularly from delhi/ncr in haskell community?
18:10 <jle`> freeside: oh thanks. they use the same example that i used, haha
18:11 <jle`> i suppose + is the universal first example of an operator
18:11 <freeside> bbear: https://wiki.haskell.org/Debugging#Dynamic_breakpoints_in_GHCi
18:12 nak left
18:12 ertesx joined
18:13 hybrid joined
18:16 stoopkid joined
18:17 Croniamental joined
18:17 augur joined
18:19 ph88^ joined
18:24 cpup joined
18:25 serendependy joined
18:25 connrs joined
18:28 <t7> do you guys write haskell with 80 char cols?
18:29 <freeside> i use 40 char cols. it breeds discipline.
18:30 <t7> should i stop using 1/2/3 letter variable names?
18:30 <freeside> only after your first 1000th variable declaration.
18:31 <t7> do you mean 26^3 ?
18:31 <freeside> :)
18:31 meoblast001 joined
18:31 <freeside> 33696
18:32 <freeside> 26*36*36, then
18:32 <ExpHP> don't forget ', _, capitals...
18:32 <freeside> ... unicode ...
18:33 dan_f joined
18:35 <t7> @hoogle Maybe a -> Either a b
18:35 <lambdabot> Data.Either.Combinators leftToMaybe :: Either a b -> Maybe a
18:35 <lambdabot> Agda.Utils.Either maybeLeft :: Either a b -> Maybe a
18:35 <lambdabot> Music.Theory.Either fromLeft :: Either a b -> Maybe a
18:36 <ExpHP> :t either id undefined
18:36 <lambdabot> Either c b -> c
18:36 <ExpHP> :t either Just (error "eitherToMaybe")
18:36 <lambdabot> Either a b -> Maybe a
18:37 meoblast001 joined
18:37 <ExpHP> :t either Just (const Nothing) -- me dumdum
18:37 merijn joined
18:37 <lambdabot> Either a b -> Maybe a
18:37 <t7> @hoogle Maybe a -> Either a ()
18:37 <lambdabot> Agda.Utils.Either maybeToEither :: Maybe a -> Either () a
18:37 <lambdabot> Foreign.Ruby.Helpers runscript :: String -> IO (Either String ())
18:37 <lambdabot> System.Console.Readline setStartupHook :: Maybe (IO ()) -> IO ()
18:37 ludat joined
18:38 johnw_ joined
18:39 ChaiTRex joined
18:39 np356 joined
18:40 <twanvl> ?type preview _Left
18:40 <lambdabot> MonadReader (Either b c) m => m (Maybe b)
18:40 ckubrak joined
18:40 takle joined
18:41 jao joined
18:41 <ckubrak> Hi guys, how can I do a line break in a show instane?
18:41 <t7> lenses...
18:41 <t7> macro hell
18:41 eacameron joined
18:42 <ckubrak> instance*
18:42 <t7> \n ?
18:42 <twanvl> show (MyThing x y) = show x ++ "\n" ++ show y
18:43 <geekosaur> but in general if you are using Show for anything but debugging (where it should output somrthing that is valid Haskell source), you're doing it wrong
18:43 itachi joined
18:43 <geekosaur> there are prettyprinting libraries out there for formatted output
18:43 <ckubrak> twanvl: I get the \n printed instead
18:43 iomonad joined
18:44 <geekosaur> also remember that ghci calls show by default; use putStrLn to see what it really has
18:44 iomonad joined
18:45 <geekosaur> > "foo\nbar" -- uses Show
18:45 <lambdabot> "foo\nbar"
18:45 <geekosaur> > text "foo\nbar" -- in ghci use putStrLn (bot won't do that)
18:45 <lambdabot> foo
18:45 <lambdabot> bar
18:45 splanch joined
18:46 gugah joined
18:47 vektorweg1 joined
18:47 <ckubrak> geekosaur: *Main> show "A\nB" gets me "\"A\\nB\""
18:47 <merijn> Dear jesus, will the endless bikeshedding about FTP ever end?! >.<
18:48 <glguy> ckubrak: That's what it's supposed to do
18:48 <c_wraith> ckubrak: try putStrLn
18:48 <monochrom> Wait, there is still bikeshedding about FTP?
18:48 <geekosaur> yes, because nowe you have your explicit show plus the one ghci did, so it does show (show ...)
18:48 <geekosaur> which is why I said use putStrLn
18:48 <c_wraith> monochrom: complaints about Foldable instances again.
18:48 mada joined
18:48 <monochrom> Ah, not AMP. Nevermind.
18:49 koala_man joined
18:49 teqwve joined
18:49 teqwve left
18:49 <c_wraith> Though I really like ezyang's suggestion of a couple of pragmas that will cause warnings when some instance methods are called without being explicitly chosen.
18:49 koala_man joined
18:49 <merijn> monochrom: If people were still bikeshedding AMP I would personally fly to their houses and beat sense into them
18:49 <monochrom> Actually it was not so much bikeshedding as two derivers in GHC doing different things.
18:49 eacameron joined
18:49 freeside joined
18:50 <monochrom> And edwardk raised a good question. How do you even specify derivations?
18:50 falafel joined
18:50 <geekosaur> isn't 8.2 supposed to fix that?
18:50 <glguy> the current dragged out discussion isn't so much about the color of the bikeshed as the purpose of the bike
18:50 <geekosaur> deriving strategies
18:50 <ckubrak> glguy: c_wraith I have a board (let's say a chess board) and I'd like to visualize it as a board for easier reading
18:51 <glguy> ckubrak: that's not what show is for
18:51 <geekosaur> [01 18:43:16] <geekosaur> but in general if you are using Show for anything but debugging (where it should output somrthing that is valid Haskell source), you're doing it wrong
18:52 <geekosaur> and even more specifically it should match what the Read instance understands
18:52 <glguy> ckubrak: you need to define a function :: Board -> String. and then combine that with putStr
18:53 t7 joined
18:54 eacameron joined
18:54 <ckubrak> glguy: Why is it Board -> String and not Board -> IO if putStr is String -> IO
18:54 <bbear> how to read n lines from the input with EOL char stripped ?
18:55 takle joined
18:55 np356 joined
18:55 <c_wraith> bbear: EOL isn't a character.
18:56 <glguy> ckubrak: The String -> IO () part is already done
18:56 <Sornaensis> > print
18:56 <lambdabot> <() -> IO ()>
18:56 <glguy> ckubrak: Your job is Board -> String
18:56 <c_wraith> bbear: still, try using getLine and replicateM
18:56 <Sornaensis> :t '\EOF'
18:56 <lambdabot> error:
18:56 <lambdabot> lexical error in string/character literal at character 'E'
18:56 <ckubrak> Ok thanks
18:56 <c_wraith> Sornaensis: it was EOL, not EOF
18:56 <Sornaensis> yes I know
18:56 <glguy> bbear: replicateM n getLine
18:57 Itkovian joined
18:57 Swizec joined
18:57 TheQYD joined
18:57 <TheQYD> does anyone know what "->" is supposed to read like?
18:57 <merijn> Oh! I forgot today is SIGBOVIK proceedings are published :)
18:57 <c_wraith> TheQYD: I usually read it as "to"
18:58 <glguy> > '\LF'
18:58 <lambdabot> '\n'
18:58 <Sornaensis> > '\CR'
18:58 <lambdabot> '\r'
18:59 <TheQYD> @c_wraith so "a -> b" is read as "a to b"?
18:59 <lambdabot> Unknown command, try @list
18:59 <c_wraith> TheQYD: yeah. If I want to be more verbose "a function from a to b"
18:59 <glguy> > '\^J'
18:59 <lambdabot> '\n'
18:59 <c_wraith> TheQYD: which often just gets shortened to "a to b"
19:00 <bbear> how to print the whole content of a list ?
19:00 <bbear> line(by line)
19:00 <TheQYD> lol, how do you ping someone in here?
19:00 <c_wraith> TheQYD: just put their name at the start of the line
19:00 <glguy> TheQYD, you just use their name.
19:00 <bbear> how do I get intelligent ?
19:01 <TheQYD> <c_wraith> like this?
19:01 <TheQYD> lol, i guess not
19:01 <c_wraith> bbear: if you want to print each list on its own line, mapM_ print
19:01 <bbear> mapM_ print myList
19:01 <bbear> ok
19:01 <bbear> thanks
19:01 Swizec joined
19:01 eacameron joined
19:02 <c_wraith> err, each list *entry* on its own line.
19:03 <TheQYD> either way, thanks :)
19:04 skeuomorf joined
19:07 <TheQYD> I have a second question
19:08 <TheQYD> It's in the chapter "Where?!" in the learn you a haskell book
19:08 Itkovian joined
19:08 praduca joined
19:09 beerdrop joined
19:09 <TheQYD> In the last example, they have a statement "(f:_) = firstname" and I don't know what that means or what it's supposed to do
19:10 <c_wraith> TheQYD: is that the whole line?
19:10 Aruro joined
19:10 hellofunk joined
19:10 <c_wraith> > let (f:_) = "hello" in f
19:11 <lambdabot> 'h'
19:11 <geekosaur> keep in mind that any binding is a pattern match. the pattern there extracts the first character of firstname
19:11 <c_wraith> > let (f:_) = [False, True] in f
19:11 <lambdabot> False
19:11 Jesin joined
19:11 <geekosaur> (presuming firstname :: String)
19:11 <TheQYD> actually, the code is here: https://pastebin.com/VgrJz4fs
19:11 markus1189 joined
19:12 <geekosaur> yes, those are local bindings in a where clause
19:12 <geekosaur> and as I said, any binding is actually a pattern match; the degenerate case is one that always matches and binds the whole expression (where f = ...)
19:13 chaosmasttter joined
19:13 <TheQYD> so how does it pluck the first initial, exactly?
19:13 <c_wraith> TheQYD: are you familiar with how String is represented in Haskell?
19:14 <TheQYD> yeah
19:14 <geekosaur> "Hello" is the same as 'H':'e':'l':'l':'o':[]
19:14 zzzq joined
19:14 <geekosaur> so you pattern match on the first : and take the thing on the left, which is the first character
19:14 <TheQYD> oooohhhhhhhhh i get it !!
19:14 <geekosaur> the _ is a wildcard that doesn't bind anything, and receives the tail ("ello" or 'e':'l':'l':'o':[])
19:15 <TheQYD> that's also in python !! thank you !!
19:17 <ski> > let f:_ = [True,False] in f
19:17 <lambdabot> True
19:17 freeside joined
19:17 ChaiTRex joined
19:17 Salih joined
19:18 ph88^ joined
19:19 vitalij joined
19:19 cyborg-one joined
19:20 takle joined
19:22 ragepandemic joined
19:25 skeuomorf joined
19:25 skeuomorf joined
19:26 Itkovian joined
19:26 boombanana joined
19:26 Welkin joined
19:26 zzzq joined
19:27 takle joined
19:29 ziocroc joined
19:29 tripped joined
19:30 eacameron joined
19:32 cbaatz joined
19:33 raichoo joined
19:34 ckubrak joined
19:35 w1ndfalc0n joined
19:35 zeroed joined
19:35 zeroed joined
19:36 marcopullo joined
19:38 vtomole joined
19:38 chaosmasttter joined
19:38 alexelcu joined
19:39 Levex joined
19:39 zero_byte joined
19:40 sophiag joined
19:40 Guest71 joined
19:41 takle joined
19:41 <sophiag> hi! can anyone point me to how to derive Show instances for existentials?
19:42 vektorweg1 joined
19:43 <c_wraith> It seems unlikely that you can derive a Show instance for most existentials.
19:43 <c_wraith> How do you convert a value of an unknown type to a String?
19:45 makkron joined
19:47 <sophiag> c_wraith: well, not the correct terminology really. ghc is telling me i can "use a standalone deriving declaration instead," but i'm not sure what that means
19:47 e14 joined
19:47 <c_wraith> sophiag: what's your data declaration?
19:47 staafl joined
19:48 <alexelcu> Newbie question: Is there any way in ghci or in Emacs/Intero or some other extension to get the docs of a function or type, like what you can get from hackage? :info is only giving me the signature, which is useful, but I often find myself going to the web browser to search in hackage.
19:48 codesoup joined
19:48 <sophiag> c_wraith: there are three i'm dealing with, but here's an example: "data LambdaT = forall a. LambdaType (a -> Bool)"
19:49 <sophiag> i'm also confused because one isn't an existential...unless i'm confused, which is very possible
19:49 <freeside> alexelcu: i've been wondering that too. sadly, a typical ghc install doesn't actually include the .hs source code to haskell.
19:49 <c_wraith> sophiag: ok, there's just no way to derive Show for that at all. Not only is it existential, it contains a function.
19:49 <sophiag> ah ok. in that case i should probably just abandon the idea
19:50 <sophiag> i only wanted Show to test it in ghci
19:50 takle joined
19:50 <ski> the other two ?
19:50 <c_wraith> sophiag: you know you can write an instance manually, right? It just can't do anything with the function.
19:50 <Aruro> alexelcu: there is local docs for new versions of cabal, every package u install installs local docs
19:50 oisdk joined
19:51 <sophiag> c_wraith: i know i can, but i'm asking _how_ to. as stated, i'd just like to check functions that use these constructors are working correctly
19:51 <sophiag> do i just write a function that prints that type?
19:51 <ski> you can't even do that here
19:51 <c_wraith> sophiag: well, basically everything you can do with that is roughly equivalent to instance Show LambdaT where show = "LambdaT <>"
19:51 <ski> `a' is an unknown/hidden/opaque type
19:52 <Aruro> alexelcu: .cabal/share/doc/i.../
19:52 <c_wraith> sophiag: as an aside, that type is basically useless. You can't call the function it contains after unpacking it.
19:52 <ski> if you had `data LambdaT = forall a. Typeable a => LambdaType (a -> Bool)', then you could print the type at least ..
19:52 <sophiag> ski: oh, that helps
19:53 eacameron joined
19:53 <sophiag> c_wraith: i was under the impression i could use it as long as i have a way to match the type what i'm applying it to...which i do
19:54 <c_wraith> sophiag: well, no. With that definition, you don't.
19:54 <alexelcu> Aruro: I'm using stack, don't have a .cabal directory
19:54 <c_wraith> sophiag: if you used the variant with a Typeable constraint, then you'd have some way of doing something with it.
19:54 <Aruro> alexelcu: stack has docs too, look inside .stack
19:54 simukis_ joined
19:54 <ski> something like `instance Show LambdaT where showsPrec p (LambdaT f) = showParen (p > 10) $ showString "LambdaT " . showParen True (showString "_ :: " . shows (typeOf f))'
19:55 <sophiag> wait, so i'm fine making all these Typeable. but that doesn't seem to be enough on its own to add a Show instance
19:55 <geekosaur> Typeable is not sufficient
19:56 <sophiag> ok...so what's the real answer
19:56 <ski> sophiag : if you have `isUpper :: Char -> Bool', then wrap it into `LambdaType isUpper :: LambdaT', and then match than on `LambdaType f', then `f :: a -> Bool' for an *unknown* type `a'. there is no way to recover which type `a' is in this case. unless you add the `Typeable a' constraint to the existential .. or do other stuff
19:57 ozgura joined
19:57 <geekosaur> and even then, the compiler iwll not automatically generate code that uses typeOf for you
19:57 <geekosaur> to recover something like Show
19:57 <ski> sophiag : did you try the instance i suggested ?
19:58 Swizec joined
19:58 <sophiag> ski: i did not because geekosaur came on and said using Typeable wasn't sufficient
19:58 <Aruro> sophiag: haskell can not show types of functions, what do u expect :)
19:58 <Aruro> no show instances for functions
19:58 <geekosaur> you'd be surprised
19:58 <sophiag> Aruro: i expect if i apply a function to arguments of the correct type then it will work...
19:58 <ski> sophiag : it's sufficient for showing the type of the function. it's not sufficient for recovering *which* function is in there
19:58 Swizec joined
19:59 <sophiag> ski: ok. that's not the question i asked
19:59 <Aruro> sophiag: general answer haskell good at making types, not good at all at inspecting them.
19:59 <sophiag> and obviously i know Typeable does that
19:59 Swizec joined
19:59 <geekosaur> Aruro, in fact if you have a monomorphic function it is possible to make a non-trivial Show instance. with type-indexed Typeable that's supposed to show up soon (maybe even 8.2) that might be expandable to polymorphic functions
20:00 <sophiag> Aruro: general answer to what question?
20:00 <ski> "do i just write a function that prints that type?" suggested to me that even getting the type of it shown would help
20:00 <geekosaur> (the trivial instance being instance Show (a -> b) where shows _ = "<function>", which you can find in Text.Show.Functions :)
20:00 Swizec joined
20:00 <sophiag> ski: did i write that quote?
20:00 <raduom> sophiag why not use something like: data LambdaT = forall a. Typeable a => ... ?
20:00 <ski> yes
20:01 <raduom> sophiag why not use something like: data LambdaT = forall a. Show a => ... ?
20:01 <ski> raduom : would not help at all
20:01 <ski> it's a function in there
20:01 Swizec joined
20:01 <raduom> ah. got it.
20:01 <ski> being able to show values that could be passed as inputs to it doesn't really help with showing the function
20:01 <ski> (especially not if you have no idea which type that input type is)
20:01 <sophiag> ok, as the person who asked this question i'd like to politely state that this discussion has quickly become unhelpful
20:02 <Aruro> sophiag: u got answer, not possible
20:02 louispan joined
20:02 <ski> sophiag : ty for telling us. sorry, it seems that what you want isn't possible
20:03 <sophiag> Aruro: i got several answers...half saying it was possible band then clarifying that i had to change the meaning of "it"
20:03 <ski> (it still not being fully clear to me what it is you want, you not having provided much context. XY problem and all that)
20:04 <MarcelineVQ> my x y sense is tingling, what are you trying to do? beyond showing a function, what are you trying to learn from showing it?
20:04 <MarcelineVQ> oop hehe
20:04 <sophiag> MarcelineVQ: already said that
20:04 <Aruro> he wante to derive show instances for existencials, if i remember
20:04 <Aruro> d*
20:05 <ski> yes, but for which purpose ?
20:05 ptek[m] joined
20:05 <Aruro> he did not say
20:05 <sophiag> purpose already stated
20:05 <sophiag> also, regarding types, probably safe to infer that someone with one of the most common female names in the world is not "he"
20:05 <MarcelineVQ> sophiag: what you said made me think you should be trying to examine what results from applying a function, knowing more about your goal would clarify whether that's a good idea or not
20:06 KarboniteKream joined
20:06 skeuomorf joined
20:06 ChaiTRex joined
20:06 <Aruro> sophiag: dont be offended in some of the most cool cultures on earth, in their language there is no she or he.
20:06 <sophiag> Aruro: then speak in that language
20:07 insitu joined
20:07 <Aruro> sophio is male name in some parts of the world, btw
20:07 <glguy> It looks like this discussion has diverged from being about Haskell and is now about the discussion
20:07 <MarcelineVQ> 4 lines about it is surely enough :> Could you restate your current goal sophiag? Not for this specific problem, but what you're using it for?
20:07 <sophiag> Auroro: so is "bob." both are names that are not mine...
20:07 <ski> unfortunately "i'd just like to check functions that use these constructors are working correctly" and "a way to match the type what i'm applying it to" aren't that clear to us. seeing more actual code might help. trying to explain more of the picture might help
20:07 <bjs> sophiag: can you give an example of one of your LambdaT's and what (show it) should return?
20:08 <Aruro> sophiag: s/he/she/ above :)
20:11 ChaiTRex joined
20:11 sophiag left
20:12 <Aruro> > head [[]]
20:12 <lambdabot> []
20:12 Itkovian joined
20:13 <Aruro> sounds like a valid 1st april haskell expression
20:13 rgucluer joined
20:13 <bjs> Aruro: hmm?
20:14 <MarcelineVQ> There's better things to get mad about, like the randomness of people choosing Control vs Data namespaces
20:14 plutoniix joined
20:14 rgucluer left
20:14 <Aruro> yes^ there was discussion about lense a month ago :)
20:14 <Aruro> Control.Lense
20:14 freeside joined
20:15 Levex joined
20:16 hybrid joined
20:17 <Aruro> > tail [[]]
20:17 <lambdabot> []
20:17 <Sornaensis> > tail []
20:17 <lambdabot> *Exception: Prelude.tail: empty list
20:18 <Aruro> :t tail [[]]
20:18 <lambdabot> [[t]]
20:18 orphean joined
20:19 eacameron joined
20:23 newbie84 joined
20:24 <lolisa> Hi, I'm doing a DSL in haskell, all is quite well, however I'm new to Haskell (although done other FP lang before), so can anyone look at my code and give some suggestion?
20:25 <raduom> lolisa it could help if you post it on lpaste, or some other similar paste bin.
20:26 <lolisa> Sry, forgot it: https://github.com/ThoughtWorksInc/DeepDarkFantasy/tree/master/lib
20:26 <raduom> does anyone know how i might be able to trigger scotty to shutdown from something like an external thread?
20:27 aarvar joined
20:28 mekeor joined
20:28 Lord_of_Life joined
20:29 kau joined
20:29 kirillow joined
20:29 oisdk joined
20:30 yellowj joined
20:31 <kirillow> what I have is a list of numbers from 1 to 6 `[1,4,5,4,3,6]`, what i need is a list with the numbers of occurances indexed at positions 0 to 5 `[1,0,1,2,1,1]` - can somebody shove me into some direction? im completely clueless at this point
20:31 CurryWurst joined
20:32 Lord_of_Life joined
20:32 Lord_of_Life joined
20:32 <raduom> kirillow you could fold the list over a 6 elements vector.
20:33 <freeside> reminds me of https://twitter.com/baeshaj/status/847254344277794816 lol
20:33 <lolisa> if you dont need eifficency, sort and group
20:35 zeroed joined
20:35 _ashbreeze_ joined
20:36 ryba joined
20:36 Welkin joined
20:36 eacameron joined
20:37 <bbear> http://vpaste.net/tmfY7 what is wrong ?
20:37 <Welkin> vpaste? o.o
20:37 marcopullo joined
20:38 <bbear> BenderLib.hs:127:11: error: Not in scope: data constructor ‘SValue’
20:38 <Welkin> that is some weird lokoing haskell...
20:38 <Welkin> almost looks like a java programmer wrote it
20:38 Rainb joined
20:38 <Welkin> why aren't you using case expression/pattern matching?
20:38 agjacome joined
20:39 <Welkin> it wil be much easier to read
20:39 <Welkin> will*
20:39 cdg joined
20:39 <bbear> that's a typical else if use case
20:39 <geekosaur> bbear, what specifically is wrong is that uppercase initial letter is always a constructor
20:39 <geekosaur> you cannot define a binding SValue
20:40 fizbin joined
20:40 <kirillow> thanks!
20:41 <ryba> hi, could anyone recommend me some online/downloadable learning material for category theory, type theory and lambda calculus?
20:42 <ryba> im not really used to mathy stuff, so something with more verbose explanations would be appreciated
20:42 eacameron joined
20:42 <Welkin> This book is great https://www.goodreads.com/book/show/1511125.Conceptual_Mathematics
20:43 <Welkin> it was written to be used either in a high school class, or a first-year college course
20:43 <Aruro> ryba: why do u think u need it?
20:43 <Welkin> it's an introduction to category theory
20:44 <ryba> Aruro: to learn stuff that haskell is based on
20:44 <Aruro> what about just learning haskell?
20:44 <Welkin> for type systems, "Types and Programming Languages" by Benjamin Pierce
20:45 <ryba> Aruro: kind of done, at least i get most important parts
20:46 <ryba> Aruro: now i want to understand those more exotic parts :)
20:46 <Aruro> :) haskell is not CT, because monad is not a monad
20:46 skeuomorf2 joined
20:46 <ryba> Aruro: than what is monad if it is not a monad?
20:47 skeuomorf2 joined
20:47 <freeside> alongside those books, any good video recommendations?
20:47 <Welkin> freeside: there is a course by Wadler that is an intro to functional programming with haskell
20:47 <Welkin> but that is really basic
20:47 migge joined
20:48 <Aruro> ryba: CT is overrated thats what im saying, trying to save u time.
20:48 e14 joined
20:49 <ryba> Aruro: i have plenty of time. Either this or farming in Dark Souls, or other equally stupid entertainment
20:49 splanch joined
20:49 <Welkin> ryba: are you a first-year grad student?
20:49 <Welkin> lol
20:49 <Aruro> ryba: what about devoting time to study history of science and math?
20:50 <dolio> Why are you trying to discourage someone from learning something interesting?
20:50 <Aruro> it will make u look with a good eye and perspective on that THING they call CT
20:50 <ryba> Welkin: nope, actually finishing masters, but i didn't have alot of math while studying
20:50 <ryba> Welkin: actually i regret ditching algebra now
20:51 <ryba> Welkin: anyway, i have more hardware oriented studies
20:51 <Welkin> yeah, mine was like that too
20:51 <ryba> Aruro: so why are you trying to convince me not to learn CT?
20:51 youmu joined
20:51 <Aruro> ryba: do u have solid math background?
20:52 <exio4> category theory is interesting and fun
20:52 splanch_ joined
20:52 <ryba> Aruro: no, but i want to have
20:52 <Welkin> you don't need a "solid math background", whatever that means
20:52 <Welkin> I already linked a category theory book written by one of the inventors of the subject
20:52 <Welkin> and it is meant for high school students
20:52 <Welkin> o.o
20:52 <Welkin> or college freshmen
20:53 <Aruro> Welkin: :) so u say solid math background is not needed?
20:53 <Welkin> no, because you need to start somewhere
20:53 <Aruro> nothing is needed u say?
20:53 <Aruro> not even algebra and group theory?
20:53 <Welkin> ...
20:54 <Welkin> no
20:54 <exio4> you don't need to have a high level of mathematical maturity to start, you need to be open to developed it though
20:54 <Welkin> and this isn't going anywhere Aruro
20:54 <ertes> Aruro: to learn CT you need to be able to use logical reasoning… it's a pretty self-contained topic fortunately
20:54 <Welkin> you may as well quit while you are behind
20:54 <exio4> Aruro: I learnt the basics of CT before learning about groups, it helped me learn about group theory later though
20:54 <exio4> s/developed/develop/
20:55 <ertes> Aruro: and at least an intuitive understanding regarding sets (or types)
20:55 eacameron joined
20:55 CurryWurst joined
20:55 <exio4> which are pretty much high school math topics
20:55 <ryba> i can handle sets, i didn't ditch those classes :)
20:55 <monochrom> Bear in mind people vary wildly on this.
20:56 <ryba> anyway, CT check, Type check, anything good on lambda?
20:56 <monochrom> And I don't mean their opinion. I mean how well they cope.
20:56 zzzq joined
20:57 <monochrom> There are people who can learn an abstraction for sustainedly a year without needing one single example.
20:57 <monochrom> And there are people who can't.
20:57 MP2E joined
20:57 <ertes> well, one unfortunate thing about CT is that most interesting categories are *massive* (like the category of sets), and to get into some more advanced territory it helps if your brain doesn't mind things that were morphisms just a minute ago becoming the objects of a different category
20:58 <ertes> at least that's what i found most mind-bending… but the core is pretty simple
20:59 sea_wulf joined
20:59 <ryba> ertes: the more mindfuck the better i take it :P
20:59 <monochrom> I went through that hurdle a long time ago when learning merely set theory.
20:59 hive-mind joined
20:59 <monochrom> Basically I didn't get the memo early about how {{1}} /= {1}, so to speak.
21:00 <ertes> the indicator that you have learned logic and category theory well is when you object to my choice of words (*the* category of sets) =)
21:00 <monochrom> But once told, I saw that they could declare that one set (with its own elements) could play the role of a mere element in another set. From that point on, I expect everything to be possible. :)
21:01 <ertes> everything? as in…
21:01 <ertes> > undefined -- ? =)
21:01 <lambdabot> *Exception: Prelude.undefined
21:01 <monochrom> Oh, it's just an expectation.
21:02 <dolio> monochrom: None of the good set theories let you do that. :þ
21:02 aib joined
21:02 <ryba> i did learn a bit of CT, up to some point (somewhere around cartesian closed categories, before functors), but my source was badly written, so i couldn't get past a certain point
21:02 <monochrom> But more specifically, every change or roles.
21:02 <monochrom> s/or/of/
21:03 <ertes> ryba: i learned CT by implementing it in agda and proving stuff within it
21:04 <ertes> but it's a lot of work, and not necessarily fun work
21:04 eacameron joined
21:04 <ryba> ertes: not sure if im interested in agda. im interested mainly in haskell because it's more general purpose
21:05 <ertes> ryba: implemented for theorem proving, not programming
21:06 <freeside> kirillow: your problem is described by the `hist` example from https://hackage.haskell.org/package/array-
21:06 <ryba> ertes: yup, so it's not really stuff for me
21:07 alexelcu joined
21:08 <Aruro> ryba: now im not sure what is better CT or DarkSouls
21:08 <Aruro> hard choice
21:08 <ertes> as a non-mathematician i would never have been confident about my constructions and proofs without a proof assistant… it wasn't a particularly smooth experience, but a useful one… today i probably wouldn't use agda though
21:09 <freeside> what would you use?
21:09 <ryba> ertes: i'll think about it once i need it
21:10 eacameron joined
21:11 <Aruro> ertes: if u used agda to back up your thoughts u are probably rather decent mathematician.
21:11 <ryba> ertes: besides, won't haskell be sufficient for this once it gets dependent types?
21:11 <ertes> freeside: good question… i'd like something that is more interactive and less explicit about universes… i'd like to see an implementation of HOL in haskell, because i really don't want to learn SML
21:11 <ertes> or ocaml for that matter
21:12 <ryba> ertes: expand(HOL), expand(SML)
21:12 <Welkin> is haskell really getting dependent types like idris has?
21:12 cmsmcq_ joined
21:12 <dolio> Haskell with dependent types will probably be questionably suitable for a proof system.
21:12 <freeside> mmm. i'm trying to figure out how these strands fit together. i gather a defining event that created a fork in the road was two different solutions to Russell's paradox.
21:12 louispan joined
21:12 <dolio> Since it is not really geared toward being a consistent logic.
21:12 doomlord joined
21:13 <ertes> ryba: probably not, even with dependent types you would need to be comfortable with fast and loose reasoning, but more practically haskell isn't much of a proof *assistant*
21:13 <freeside> dependent types are coming to haskell: https://typesandkinds.wordpress.com/2016/07/24/dependent-types-in-haskell-progress-report/
21:13 <ryba> Welkin: i saw some discussion on reddit that it may not because it's core isnt sufficient for that or something like it (and a lot of other stuff i didnt understand)
21:13 doomlord joined
21:14 eacameron joined
21:14 <ryba> what do you mean by fast and loose reasoning?
21:14 doomlord joined
21:14 <ertes> ryba: i don't think haskell is going to be a consistent logic any time soon, so using 'undefined' you could prove anything you want
21:15 <ertes> fast and loose reasoning means: "i promise i'll be careful not to exploit that" =)
21:15 doomlord joined
21:16 doomlord joined
21:16 <ryba> ertes: and what's wrong with being carefull not to use that? if you want to prove something you use that, if you want to make simple program that may fail with undefined, you use that
21:16 <ryba> that's general purpose, the more purposes you can fulfill the better
21:17 <Welkin> ertes: unsafePerformIO
21:17 <ertes> ryba: not for theorem proving
21:17 <ertes> ryba: if you can prove anything, you can prove absurd statements
21:18 <ryba> ertes: and you can prove that you are not exploiting undefined in your proof by grepping your proof for undefined :)
21:18 <dolio> No, you can't.
21:18 <ertes> ryba: no, you can't
21:18 <ryba> ?
21:18 eacameron joined
21:18 splanch joined
21:18 <dolio> 'undefined' isn't the only way to write a bad proof.
21:18 <ertes> > let x = x in x :: Void -- here is a proof of "false" without using 'undefined'
21:19 <lambdabot> mueval-core: Time limit exceeded
21:19 <dolio> With `* :: *`, the logic is already inconsistent.
21:19 <ryba> is any subset of haskell consistent?
21:19 <ertes> ryba: yes
21:20 meba joined
21:20 skeuomorf joined
21:20 Big_G joined
21:20 <hpc> you can get, if not consistent, really damn close
21:20 <freeside> http://deepspec.org/research/Haskell/
21:20 <hpc> just with termination and {-# LANGUAGE Safe #-}
21:21 <ertes> ryba: uh, well, not quite
21:21 <ertes> ryba: the (* :: *) thing still ruins it
21:21 <dolio> There are also other holes in GHC, I think. Like impredicativity is inconsistent with injectivity of type constructors.
21:21 <ryba> im not really sure what * :: * means
21:21 <geekosaur> impredicability is going away though
21:21 <ertes> ryba: * ("type") is an element of *
21:22 <dolio> geekosaur: No. The GHC extension with 'impredicative' in the name is going away.
21:22 <dolio> But GHC's type system is still impredicative.
21:22 <ryba> and what's impredicability?
21:23 eacameron joined
21:24 <monochrom> That you are allowed "Maybe (forall a. a -> a)
21:24 CurryWurst joined
21:25 <dolio> That's what the GHC extension is.
21:25 <monochrom> In general, to instantiate a type variable by a bloody forall type.
21:26 <Welkin> RankNTypes?
21:26 <hpc> RankNTypes lets you put nested forall terms on the left side of (->)
21:26 <monochrom> No, RankNTypes doesn't cut it.
21:26 <hpc> ImpredicativeTypes extends that to arbitrary type constructors
21:28 <dolio> Impredicativity in general has to do with defining something in terms of some big collection of things that includes the thing you're defining.
21:28 <dolio> A sort of suspiciously self-referential definition.
21:28 albertus1 joined
21:29 <ryba> dolio: that's the explanation i like :)
21:29 <dolio> Although what counts as suspicious depends on who you're talking to.
21:29 Jacob__ joined
21:29 oish joined
21:29 <Jacob__> hi
21:29 <Jacob__> Hello everone
21:30 <dolio> Anyhow, GHC is impredicative when you turn on PolymorphicComponents.
21:30 <dolio> Because you can define a type T that contains something with type 'forall a. U[a]' in it, where a may be instantiated with T.
21:31 riff joined
21:31 <dolio> And I think that is the only sort of impredicativity you need to be inconsistent with injectivity of type constructors.
21:32 <dolio> The GHC extension is just a more accessible form of impredicativity that makes type checking very difficult.
21:32 <ryba> dolio: what is the use of impredicative types?
21:32 <riff> Anyone here have any experience with the cereal library? I'm hoping there might be a way to serialize an IORef. End goal is to use haskell-mpi, but the code I'm working with is littered with iorefs :(
21:33 <lyxia> Get and Putter not being MonadIO, I highly doubt that is possible.
21:33 <monochrom> Would you love a list of polymorphic functions like [(+), (-)] :: [forall a. Num a => a -> a -> a]? :)
21:33 <dolio> ryba: I don't understand your question.
21:34 <dolio> Are you asking why you'd want them?
21:34 <ryba> dolio: yes
21:34 <dolio> Oh, well, monochrom's example is one reason.
21:35 <ryba> looks usefull-ish
21:35 aib joined
21:35 <dolio> Also from a more academic standpoint, having impredicative polymorphism lets you encode all data types without including them directly in your language, which is interesting.
21:35 <monochrom> Actually Welkin was right, RankNTypes cuts it.
21:36 <dolio> Like, `forall r. r -> (r -> r) -> r` is the natural numbers, but only if r can be instantiated to that type somehow.
21:36 <Adeon> does quickcheck have some convenience feature to detect diverging computation? like a timeout
21:36 <ryba> dolio: aaand thats exactly why i need to learn type theory :)
21:36 <Adeon> trying to skim documentation but can't find something that looks like it's what I'm looking for
21:37 <dolio> Otherwise there will be some (computable) functions on the natural numbers that you cannot write.
21:37 <monochrom> Take for example you're back in Java, and you have a class that has some polymorphic methods, public class X { <T> T foo(T) ... }.
21:37 <dolio> (Like the Ackermann function, I believe.)
21:37 <ryba> dolio: like?
21:37 <Adeon> er, found it, it's called `microseconds`
21:38 <monochrom> Then you put a lot of such objects in a Vector<X>. So suddenly you are instantiating a type variable (that of Vector) to a type that contains a forall type.
21:38 <ryba> monochrom: did you just assume my programming language? :P
21:38 <lyxia> Adeon: you mean 'within'?
21:38 hackebeilchen joined
21:38 <monochrom> Oh, it's a safe bet. :)
21:38 <Adeon> er
21:38 <Adeon> yes
21:38 <Adeon> within :)
21:39 <ryba> monochrom: thank God not this time
21:39 <monochrom> Just want to make the story all the more creepy by pointing out "any average Java programmer may have already done this without knowing"
21:40 <ryba> monochrom: yup, the "without knowing" part is creepy
21:40 robotroll joined
21:41 <dolio> Actually, there will always be some computable functions that you can't write, if your language is total. But there will be some that you would be able to write with the naturals that you can't write with the encoding. Ackermann is an example.
21:42 <lyxia> riff: you can only make pure (de)serializers with cereal
21:43 <riff> lyxia: bummer, that's the impression that I was getting. Thanks for confirming that for me, seems that I'll need to rewrite the entire program to get it working with haskell-mpi
21:45 dan_f joined
21:45 visser_ joined
21:48 raichoo joined
21:50 fizbin joined
21:52 splanch joined
21:52 epsilonhalbe joined
21:52 epsilonhalbe left
21:53 deepfire joined
21:53 hiratara joined
21:55 vikaton joined
21:56 <nut> test
21:57 <nut> :t map
21:57 <lambdabot> (a -> b) -> [a] -> [b]
21:59 Itkovian joined
21:59 splanch joined
21:59 WhiskyRyan joined
22:00 <lambdabot> untest
22:00 ericdwhite joined
22:00 <ExpHP> hm, I could've sworn there was a language extension for custom unary operators, isn't there?
22:00 <ExpHP> can't seem to find it now
22:00 mekeor joined
22:02 <lyxia> That doesn't sound familiar.
22:02 vicfred joined
22:03 <ExpHP> I can't remember where I read it, but it just basically loosened the restrictions on slice syntax so that e.g. (@ 3) didn't have to be a function
22:03 <glguy> postfixoperators
22:03 <ExpHP> oh no, I hope they aren't only postfix! :(
22:03 CuteKitten joined
22:03 marcopullo joined
22:04 <glguy> wouldn't make sense otherwise
22:04 <ExpHP> well yeah, I know, if it allowed both then all prefix and postfix ops would have to be the same
22:04 <ExpHP> just simply because it isn't encoded in the type system which is which
22:05 <ExpHP> but I wanted to be able to write (%"somestring") to do formatting on a string :V
22:05 np356 joined
22:05 <ExpHP> oh well. thanks glguy
22:05 <CuteKitten> Hi, is there something like this that already exists? In the form of a monad possibly or combining combinators that I'm not aware? http://lpaste.net/354181
22:06 <CuteKitten> I would like to do an action, collect the result, and execute another action, assuming the result passes a condition. If all is well, we repeat the process, until the first action produces a result we don't like.
22:07 <CuteKitten> Forget the uneccessary Applicative f => f ~ IO in the annotation.
22:07 <ertes> CuteKitten: do you care about the result, or only the effects?
22:08 <CuteKitten> ertes: Only the effect, but if it can be made even more general, I'll take it.
22:08 <ExpHP> CuteKitten: sounds like some kind of monadic unfold
22:08 <ExpHP> CuteKitten there's a bunch of loops here though I don't notice anything with quite that signature: https://hackage.haskell.org/package/monad-loops-0.4.3/docs/Control-Monad-Loops.html
22:09 <CuteKitten> I've noticed the pattern 5-10 times in my game. I'm using some `fix $ \loop ->` construct, but it's repetitive and error-prone.
22:09 <ertes> CuteKitten: 'forever' with MaybeT
22:10 <CuteKitten> ertes: Wont `forever $ runMaybeT` just run a MaybeT computation infinitely?
22:10 jaco_____ joined
22:10 <ertes> no, MaybeT short-circuits
22:10 <ertes> :t \p c -> forever (c >>= guard . p)
22:10 <lambdabot> (Alternative f, Monad f) => (a -> Bool) -> f a -> f b
22:11 <CuteKitten> :t forever
22:11 <lambdabot> Applicative f => f a -> f b
22:11 <CuteKitten> Oh interesting, forever is generic.
22:11 <ertes> but you don't get to keep the results, that's why i asked
22:11 <CuteKitten> I think it's fine.
22:12 <ertes> remember to wrap a runMaybeT around that, otherwise you're short-circuiting out of something larger
22:12 <CuteKitten> ertes: As long as the first computation's result can be used with a predicate to determine if we continue or not.
22:13 worch joined
22:14 <CuteKitten> ertes: runMaybeT $ do { a <- cond <$> actionA; b <- lift actionB }
22:14 tomboy64 joined
22:18 locallycompact joined
22:20 ericdwhite joined
22:22 mda1 joined
22:22 splanch joined
22:23 ragepandemic joined
22:23 splanch_ joined
22:25 louispan joined
22:25 splanch__ joined
22:25 <ExpHP> is there a way I can conditionally import a module in .ghci, only if the module exists?
22:26 splanch joined
22:26 alexelcu joined
22:28 splanch_ joined
22:28 <monochrom> Maybe import it anyway. If there is an error, does it continue with the remaining lines?
22:29 <ExpHP> monocrom yeah it does, it's just annoying to see all the error output
22:30 sebastianrkg joined
22:30 splanch__ joined
22:30 skeuomorf joined
22:31 <sebastianrkg> hey guys, I'm wondering what is the best/your favourite Visual Studio Code plugin for Haskell?
22:31 hiratara joined
22:32 <sebastianrkg> Haskero and Haskelly both have some popularity it seems, and then there are a few others out there
22:32 <Welkin> I didn't know people used visual studio with haskell o.o
22:32 <Welkin> everyone seems to use emacs or vim
22:33 <sebastianrkg> I've heard that VSCode's plugins are quite good. I'm not much of an emacs/vim guy (right now, I use Sublime Text)
22:33 <Welkin> emacs seems to have the best haskell support
22:34 <ExpHP> ^ my life changed when I switched from vim to spacemacs
22:34 <sebastianrkg> Welkin: for sure, I would agree with that. It's just not my editor of choice
22:34 <ExpHP> intero, man. :O
22:34 eacameron joined
22:35 zeroed joined
22:35 zeroed joined
22:36 HoloIRCUser4 joined
22:38 perrier-jouet joined
22:40 jgertm joined
22:40 conal joined
22:41 xyther joined
22:41 malt3 joined
22:42 gman98 joined
22:45 uwap joined
22:47 raycoll joined
22:48 lambdafan joined
22:48 zero_byte joined
22:50 KongWubba joined
22:51 uwap joined
22:53 KongWubba left
22:53 mda1 joined
22:57 dan_f joined
22:59 patbecich joined
22:59 earldouglas joined
22:59 <lpaste> lambdafan pasted “Type Teris with Conduits” at http://lpaste.net/354183
22:59 serendependy joined
23:00 <lambdafan> any ideas?
23:01 fadeway__ joined
23:03 dcoutts_ joined
23:04 <lambdafan> hi duncan
23:04 <lambdafan> I just posted this conduits problem I'm trying to sort
23:04 <geekosaur> lambdafan, you n eed a MonadIo constraint on m
23:05 <geekosaur> er MonadIO
23:05 <lambdafan> oooh!
23:05 <geekosaur> because sourceHandle is only meaningful if there is a (System.IO.)Handle
23:05 jgertm joined
23:05 <lambdafan> I removed m
23:05 <lambdafan> constrainted to State
23:05 <lambdafan> constained I mean
23:05 eacameron joined
23:06 <geekosaur> you need to remove sourceHandle if you want to get rid of the MonadIO
23:06 <lambdafan> the initial code compiles
23:06 <lambdafan> engine :: MonadResource m => Handle -> m Editor
23:06 <lambdafan> ^ that compiles
23:07 <geekosaur> ok, MonadResource is providing MonadIO then
23:07 <lambdafan> ah so there must not be an instance of MonadIO for StateT?
23:07 Achylles joined
23:08 <geekosaur> the problem is that it's using Identity as the monad, not something over IO
23:08 <lambdafan> yeah that's how StateT makes State, with the Identity Monad.
23:09 <geekosaur> right, you can;t use State directly, you need StateT IO
23:09 <lambdafan> very well :)
23:10 <geekosaur> becuase that's the only way it can make a Conduit from a Handle, is if the Conduit is rooted in IO instead of e.g. Identity
23:12 <lambdafan> okay making changes
23:13 <lambdafan> whelp
23:13 <lambdafan> I spent all day banging my head against that
23:13 <lambdafan> thanks geekosaur
23:14 <lambdafan> well, it took me all day to be able to form a question to ask
23:14 <lambdafan> okay another question
23:14 Guest71 joined
23:15 <lambdafan> sourceHandle won't close the handle
23:15 <lambdafan> so how do I close it?
23:15 <lambdafan> I thought about using bracketP, but I need to munge the file prior to streaming it through
23:15 <lambdafan> which is why I pass in the handle
23:16 skeuomorf joined
23:16 <geekosaur> I think you end up setting up a ResourceT yourself, so you can close it in the ResourceT finalizer
23:17 <geekosaur> (which is what MonadResource is doing in the ones where it opens the file itself)
23:17 <lambdafan> geekosaur, okay I need to go digging for examples. I am sure I've seen them
23:19 <lambdafan> looks like I want allocate
23:20 systadmin joined
23:20 patbecich joined
23:20 theDon_ joined
23:20 meba joined
23:21 jgertm joined
23:23 epsilonhalbe joined
23:23 nakal joined
23:24 markus1199 joined
23:24 markus1209 joined
23:26 marcopullo joined
23:27 jacob____ joined
23:28 ljc joined
23:29 OscarZ joined
23:33 oberstein joined
23:34 mendez joined
23:34 mjs2600 joined
23:34 mjs2600 left
23:35 frontendloader joined
23:37 <lolisa> Hello, I am getting "Exposed modules use unallocated top-level names: DDF", when I upload my stuff on Hackage, should I be concerned about this?
23:38 <geekosaur> there is a preference for using the existing module hierarchy --- although this can be taken too far (see for example the weird mishmashes under Control.* and Data.*)
23:41 <lolisa> I mean, I know I should put my stuff into Language.DDF, but it seems rather long to import like Language.DDF.Lang and other stuff, so is it bad to just leave it under DDF, or it is OK?
23:41 conal joined
23:41 splanch joined
23:43 splanch_ joined
23:47 Coldblackice joined
23:49 a143753 joined
23:50 splanch_ joined
23:52 nick_h joined
23:53 marcopullo joined
23:54 louispan joined
23:59 zoran119 joined
23:59 fadeway_ joined