<     May 2017     >
Su Mo Tu We Th Fr Sa  
    1  2  3  4  5  6  
 7  8  9 10 11 12 13  
14 15 16 17 18 19 20  
21 22 23 24 25 26 27  
28 29 30 31
00:10 dni- joined
00:14 kadoban_ joined
00:15 saussure joined
00:21 halogenandtoast joined
00:22 brailsmt joined
00:27 JoelMcCracken joined
00:30 netheranthem joined
00:33 <lpaste> brailsmt pasted “halp” at http://lpaste.net/1361137013696233472
00:33 saussure joined
00:33 <brailsmt> i've been fighting with this thing for a few hours, and i can't seem to grok what is going on
00:37 <brailsmt> i'm pretty sure something is wrong with the type of buildHttpRequest, but i'm not sure what
00:37 <thang1> your buildHttpRequest is returning a value of Request, not of 'm b'
00:38 <thang1> "setRequestHeader Hdr.hAccept mimes" is where it's happening
00:39 <thang1> Also in doRequest, it wanted a type Response Value -> [a0] and you gave it Response Value -> Value
00:39 texasmynsted joined
00:40 <thang1> "getBody" is what broke, there.
00:40 takle joined
00:42 <thang1> There's a theme in all of your errors here. It's expecting some genericreturn value and you're giving it some concrete thing instead that isn't working. eg Request -> Request instead of Request -> mb. Response Value -> Value instead of Response Value -> [a0], and you never unwrapped your Maybe String
00:43 saussure joined
00:45 <brailsmt> ok, looks like i'm pretty well lost then... *sigh*
00:46 stevenxl joined
00:47 <thang1> If it helps, I'm lost too :p
00:50 EricPoe joined
00:52 <brailsmt> at least i'm not alone ;)
00:52 saussure joined
00:54 <stevenxl> Hi folks. I was wondering if anyone can help me on Chapter 16 of the Haskell Book. I don't understand how (fmap . fmap) typechecks.
00:54 <brailsmt> maybe once i hit ballmer's peak, i'll understand what i'm doing wrong...
01:00 Zialus joined
01:02 vaibhavsagar joined
01:04 <glguy> stevenxl: is there a particular question you had about it?
01:05 <glguy> :t (.)
01:05 <lambdabot> (b -> c) -> (a -> b) -> a -> c
01:05 <glguy> :t fmap
01:05 <lambdabot> Functor f => (a -> b) -> f a -> f b
01:06 mac10688 joined
01:07 <thang1> :t (fmap . fmap)
01:07 <lambdabot> (Functor f, Functor f1) => (a -> b) -> f1 (f a) -> f1 (f b)
01:10 saussure joined
01:20 <stevenxl> Hi glguy - I'm having a tough time expressing my confusion. I have to chew on it a bit.
01:25 conal joined
01:27 <thang1> Here's how I think about it
01:28 <thang1> :t map
01:28 <lambdabot> (a -> b) -> [a] -> [b]
01:28 saussure joined
01:28 <thang1> map takes a function of type (a->b) and a list and applies that function to everything in the list
01:29 <thang1> fmap is the same thing (insert super mild handwaving)
01:29 <thang1> So fmap . fmap is just applying something and then applying the next thing on top of that
01:29 halogenandtoast joined
01:29 <thang1> > map (+1) [1..5]
01:29 <lambdabot> [2,3,4,5,6]
01:30 <thang1> > (map . map) (+1) [1..5]
01:30 <lambdabot> error:
01:30 <lambdabot> • Ambiguous type variable ‘b0’ arising from a use of ‘show_M729397896775...
01:30 <lambdabot> prevents the constraint ‘(Show b0)’ from being solved.
01:31 <geekosaur> > (map . map) (+1) [[1..5],[6..10]]
01:31 <lambdabot> [[2,3,4,5,6],[7,8,9,10,11]]
01:31 <thang1> right, that's what I meant :p
01:31 <glguy> stevenxl: Perhaps it would help to see fmap rearranged as : fmap :: (a->b) -> (f a->f b)
01:40 <lpaste> stevenxl pasted “fmap compose” at http://lpaste.net/1073444904320892928
01:40 <lpaste> stevenxl pasted “fmap compose” at http://lpaste.net/8106720624824549376
01:40 <stevenxl> huh - didn't know the bot did that
01:40 <stevenxl> cool
01:40 <glguy> stevenxl: Always start by renaming all the types so that none of the variables conflict
01:41 <stevenxl> glguy: I did get to the conclusion that the right associativity of the (->) type constructor, but when I plob in those type signatures, I get all confused.
01:41 <stevenxl> OK I'll try it that way
01:41 <glguy> so a, b, and c is reserved for (.), to start
01:41 <stevenxl> OK cool
01:42 kaychaks joined
01:43 <stevenxl> glguy: sorry I'm a bit distracted and I'd hate not to pay attention while you are giving of your time. I will pop back in when I can devote myself to the conversation fully.
01:43 <stevenxl> Thank you.
01:44 lewis joined
01:46 saussure joined
01:48 <lpaste> glguy annotated “fmap compose” with “fmap compose (annotation) for stevenxl” at http://lpaste.net/8106720624824549376#a355826
01:48 <glguy> stevenxl: Don't worry, I just leave this window up. I'm not waiting for any response
01:49 Youmu joined
01:52 moei joined
01:56 saussure joined
01:59 saussure joined
02:00 dni- joined
02:00 saussure joined
02:02 cschneid_ joined
02:17 Bare joined
02:20 geekosaur joined
02:21 louispan joined
02:41 takle joined
02:47 exferenceBot joined
02:52 hexagoxel joined
02:54 michbad joined
02:56 yellowj joined
03:03 yellowj joined
03:25 aarvar joined
03:28 juanpaucar joined
03:29 diegs_ joined
03:35 louispan joined
03:42 conal joined
03:48 dni- joined
03:49 ianandrich joined
04:16 systemfault joined
04:16 systemfault joined
04:26 bydo joined
04:32 juanpaucar joined
04:42 takle joined
04:58 permagreen joined
05:05 blissdev joined
05:15 ianandrich joined
05:16 meandi_2 joined
05:32 watersoul joined
05:33 systemfault joined
05:37 juanpaucar joined
05:37 watersoul joined
05:37 dni- joined
05:45 eacameron joined
05:52 brailsmt joined
06:12 uglyfigurine joined
06:24 nomadic joined
06:26 nomadic left
06:38 coredump joined
06:39 <coredump> so, is there a book/guide to learn haskell that doesn't depend on my math knowledge
06:39 <coredump> because I am ass in math
06:40 eacameron joined
06:43 takle joined
06:44 <thang1> Which one are you getting stuck on currently?
06:44 <coredump> I started "Learn a little haskel for great good"
06:45 <coredump> one of the first examples was like 'lets use a function to verify the theorem XYZ", and while I kinda understood the code, I had no idea what the damned theorem was so I missed half the idea :P
06:45 <thang1> Is that differnt than "Learn you a haskell for great good"?
06:45 <coredump> I have to admit that it has been a while and it may have changed.
06:46 <thang1> anyway, Haskell from first principles is my personal favorite. you can tell because I can't stop shilling it on the irc :p
06:46 <coredump> thang1: no, that's the one.
06:47 <thang1> The first chapter is entirely lambda calculus... Read through it briefly because it's interesting, but if you don't get any of it, it doesn't matter. The next chapters are much easier and the book is designed to teach someone assuming zero prior programming, "nerdy", "mathy", etc., experience
06:47 <coredump> is there one to peolpe that already program, but suck at calculus? :)
06:47 <coredump> I will chekc tha tone, thanks
06:47 <coredump> that one*
06:49 herr_jth joined
06:49 _herr_jth joined
06:49 <thang1> Eh, not really to be honest. Haskell is mathy enough by nature that any possible introduction that assumes any sort of competence in the reader is gonna start from "now gee let's look'a'see here about these theorems n jazz"
06:50 <coredump> life is hard for math impaired people :\
06:50 <thang1> Even though Haskell from first principles is aimed at total beginners, I've done programming for a few years as a student now and I've given it to professional programmers and they've all found it quite good. It's easy enough to read that you can skim through what you need in order to get to what you need to learn
06:53 brailsmt joined
06:56 govg joined
07:01 eacameron joined
07:03 <coredump> hope there's a chapter about xmonad config
07:03 <coredump> :D
07:06 <MarcelineVQ> no such luck :>
07:07 <coredump> I was reading someone today about his move from xmonad to i3 and his biggest motive was 'after cutting and pasting configs from diverse sites, I was totally incapable of understanding what exactly those lines meant'
07:07 <coredump> what was pretty funny
07:07 <MarcelineVQ> ehe, for me that's true of most config files
07:09 <* coredump> having sendmail.cf flashbacks
07:09 <thang1> especially true for xmonad if you're not into haskell and you copy and paste some extensive stuff :p
07:15 thc202 joined
07:19 takle joined
07:22 eacameron joined
07:24 mattyw joined
07:25 Robin_Jadoul joined
07:26 louispan joined
07:26 dni- joined
07:31 Pupnik joined
07:34 nickolay joined
07:37 grayjoc joined
07:50 eacameron joined
07:54 brailsmt joined
07:59 mengu joined
08:02 mthek joined
08:04 govg joined
08:06 zero_byte joined
08:10 Rembane joined
08:10 Rembane left
08:11 bvad joined
08:15 eacameron joined
08:15 sabin joined
08:18 sullyj3 joined
08:19 <sullyj3> reposting from #haskell: Are there any base functions that would make this nicer? it's for generating pascals triangle, you subsequently map sum over the result.
08:19 <sullyj3> http://lpaste.net/355830
08:19 <sabin> Is Haskell Programming From First Principals worth the $60 price tag?
08:24 heyitsmave joined
08:25 gryan joined
08:27 eacameron joined
08:33 juanpaucar joined
08:34 takle joined
08:37 eacameron joined
08:40 NoCreativity_ joined
08:42 simendsjo joined
08:42 govg joined
08:45 mengu joined
08:55 brailsmt joined
08:56 WhereIsMySpoon joined
09:01 grdryn joined
09:03 bvad joined
09:04 EricPoe joined
09:15 dni- joined
09:16 romank joined
09:20 btk joined
09:24 mstruebing joined
09:24 netheranthem joined
09:26 <srhb> sabin: Only you can answer that, I'm afraid. A lot of people in this channel really like the book and don't seem annoyed from having had to pay that. Of course, that depends not only on how much you like the book, but also on your financial situation.
09:28 saussure joined
09:29 govg joined
09:36 Levex joined
09:37 juanpaucar joined
09:38 uglyfigurine joined
09:40 <Xion_> thang1: Do you have a recommendation for a beginner->intermediate book? For someone who doesn't shudder at the sight of a monad or applicative but doesn't yet grasp more complex function composition tricks immediately, or hasn't worked with various more advanced libraries like lenses?
09:43 Gurkenglas joined
09:46 saussure joined
09:48 <srhb> Xion_: I don't know of a book that deals with lenses explicitly. I think the various blog posts might be the way to go. Also, most books from there tend to tackle specific topics (like Simon Marlows book Parallel and Concurrent Programming in Haskell)
09:49 <Xion_> Yeah, I think at my stage I just need to try hacking on some practical projects more
09:49 <srhb> Xion_: Yeah. :)
09:49 <Xion_> And then come back here crying when I have problems ;)
09:50 <srhb> You can do a whole lot with just basic Haskell, with the tools you already have. Specific libraries' style might force you to learn some topic to use them efficiently. That turns out to be a good motivator a lot of the time :)
09:55 saussure joined
09:55 tsmish joined
09:56 brailsmt joined
09:57 nullcone joined
09:57 <Xion_> I've been somewhat successfully hacking on the Haskell-written system we have at work, but I feel that if I were to join that team, I'd like to be a little more comfortable with it :)
09:58 yellowj joined
10:01 qu1j0t3 joined
10:13 saussure joined
10:16 malaclyps joined
10:16 madjestic joined
10:18 yellowj joined
10:19 fotonzade joined
10:23 saussure joined
10:26 mstruebing joined
10:39 im0nde joined
10:41 saussure joined
10:41 juanpaucar joined
10:45 TCZ joined
10:46 mattyw joined
10:49 stevenxl joined
10:51 delexi joined
10:51 <stevenxl> glguy: Thank you very much for the annotations. The whole concept of "unification" was somehow lost on me. I was getting confused on the two equations for b.
10:57 brailsmt joined
10:58 saussure joined
11:04 dni- joined
11:04 mengu joined
11:08 mengu joined
11:08 saussure joined
11:09 eacameron joined
11:12 mengu joined
11:17 mengu joined
11:22 mengu joined
11:26 saussure joined
11:28 tsmish joined
11:29 eacameron joined
11:31 prophile joined
11:39 mengu joined
11:39 eacameron joined
11:41 juanpaucar joined
11:44 abrar joined
11:44 saussure joined
11:45 <scav> Is there any obvious way of calling an IO function (e.g. getPOSIXTime and use it as input for a pure function) from within a pure function? or do i have to call the pure function from the IO function?
11:47 mengu joined
11:49 eacameron joined
11:50 <scav> I should probably do some more reading and understand how IO works
11:52 takle joined
11:54 saussure joined
11:56 tusj joined
11:57 halogenandtoast joined
11:58 brailsmt joined
12:00 WhereIsMySpoon joined
12:02 <Xion_> If you call something like that from a pure function, it will no longer be pure.
12:04 lewis joined
12:06 <scav> Sure, but how are you going to apply that to real life? purity is nice and all, but this means that once you actually solve real life problems with Haskell the entire codebase is tainted?
12:10 <Xion_> It means that you need to make your intentions clear and put the function using getPOSIXTime inside the IO monad itself.
12:12 saussure joined
12:12 <scav> and can this function return from the IO monad, say a Bool or a String that can be used by pure functions later?
12:12 netheranthem joined
12:13 <scav> or are you stuck with IO the instance you decide to make an application that actually does anything?
12:16 <Xion_> The usual way the application is structured is that `main` is IO () and calls other IO functions, up until whatever depth is necessary, but the "leaf" bits can be made pure.
12:16 lewis joined
12:17 <scav> okay, makes sense
12:17 <Xion_> If you need current time in a function, then clearly that function cannot be pure :) But perhaps you can extract a Time -> stuff subfunction from it, and then only the wrapper calling getPOSIXTime needs to be in IO
12:23 exferenceBot joined
12:25 <scav> ill try - thanks :)
12:30 saussure joined
12:31 pbrant joined
12:36 fortruce joined
12:38 eHammarstrom joined
12:39 <WhereIsMySpoon> Why can sum' xs = foldl (\acc x -> acc + x) 0 xs be turned into sum’ = foldl (+) 0 ? i understand how the lambda is turned into just (+), but why can you just omit the xs’s?
12:39 saussure joined
12:40 <eHammarstrom> In a type definition of a function, how can I define something as both Ord and Eq? Or does one imply the other?
12:40 <eHammarstrom> Say, isPalindrome :: [Ord, Eq] -> Bool
12:41 <WhereIsMySpoon> you dont need ord
12:42 <eHammarstrom> Yeah I see that now, but anyways. Can something have 'dual' classes?
12:42 Levex joined
12:42 <WhereIsMySpoon> myFunc :: (Ord a, Eq a) => a -> b i think?
12:44 <eHammarstrom> Yeah, thansk
12:53 dni- joined
12:55 buggerme joined
12:56 brailsmt joined
12:57 saussure joined
12:59 <fortruce> WhereIsMySpoon - it might be helpful to consider that "foldl (+) 0" is equivalent to "\xs -> foldl (+) 0 xs". So when you omit the xs's, sum' is still a function.
12:59 yellowj joined
13:00 eacameron joined
13:00 <WhereIsMySpoon> fortruce: that isnt helping =/ how does haskell ‘know’ that it should be operating on the xs passed through the function
13:04 <fortruce> > :t (+)
13:04 <lambdabot> <hint>:1:1: error: parse error on input ‘:’
13:04 <fortruce> :t (+)
13:04 <lambdabot> Num a => a -> a -> a
13:05 iAmerikan joined
13:06 <Iceland_jack> WhereIsMySpoon: Functions can be partially applied, which means they are not applied to all of their arguments
13:06 <fortruce> Okay, so (+) is a function from num -> num -> num, if we only call it with 1 argument, then we get
13:06 <fortruce> :t (+) 1
13:06 <lambdabot> Num a => a -> a
13:06 <fortruce> A function from num -> num
13:06 <WhereIsMySpoon> sure
13:07 <fortruce> > let addOne = (+) 1; in addOne 2
13:07 <lambdabot> 3
13:07 saussure joined
13:07 <fortruce> When we assign that to a name addOne, then addOne becomes a function from num -> num, which we can then call with 2
13:08 <eHammarstrom> I have a function `twice f x = f (f x)` and I want the type def to be `twice :: (a -> b) -> a -> b` but that is wrong, why is it `(a -> a) -> a -> a`?
13:08 <Iceland_jack> eHammarstrom: because the output of (f) gets fed into (f)
13:08 <Iceland_jack> so the output must be the same as the input
13:08 <eHammarstrom> I see!
13:10 eacameron joined
13:10 <fortruce> So, since foldl is (b -> a -> b) -> b -> [a] -> [b], when we say foldl (+) 0, we are left with [a] -> [b]
13:10 <fortruce> which would be similar to addOne like:
13:11 <fortruce> > let foldIt = foldl (+) 0; in foldIt [1,2,3]
13:11 <lambdabot> 6
13:11 <WhereIsMySpoon> :t foldl
13:11 <lambdabot> Foldable t => (b -> a -> b) -> b -> t a -> b
13:12 <WhereIsMySpoon> :t foldl (+)
13:12 <lambdabot> (Num b, Foldable t) => b -> t b -> b
13:12 <WhereIsMySpoon> :t foldl (+) 0
13:12 <lambdabot> (Num b, Foldable t) => t b -> b
13:13 <WhereIsMySpoon> what does t b mean
13:14 <fortruce> It means some type 'b' that has an instance of the Foldable typeclass
13:14 <WhereIsMySpoon> i see
13:14 <WhereIsMySpoon> :t foldl (+) 0 [1,2]
13:14 <lambdabot> Num b => b
13:14 <WhereIsMySpoon> right
13:17 <fortruce> It might also be helpful to look at the type signature of foldl as Foldable t => (b -> a -> b) -> (b -> (t a -> b))
13:17 <fortruce> So, foldl (+) returns Foldable t => b -> (t a -> b)
13:18 <fortruce> At each step, it is a function which takes 1 argument and returns a function that takes the next argument
13:18 cschneid_ joined
13:18 <Iceland_jack> These examples are very polymorphic
13:18 <fortruce> > ((foldl (+)) 0) [1,2]
13:18 <lambdabot> 3
13:20 <fortruce> Not sure if that helps or adds confusion though -- and yea Iceland_jack I should probably have stuck without something else :/
13:20 <WhereIsMySpoon> fortruce: im not sure this still explains why syntactically i can omit xs from both sides
13:21 <WhereIsMySpoon> or maybe im just stupids
13:21 takle joined
13:21 <fortruce> You're not stupid, it's a tough concept to wrap your head around at first.
13:24 <fortruce> Just to clarify though, it's not a syntax sugar trick. Back to the addOne example. Think of (+) not as a function that takes 2 numbers and returns their sum, but as a function that takes a number and Returns another function that takes a number and returns it plus the original.
13:24 <Iceland_jack> WhereIsMySpoon: All of these define the same thing
13:24 <Iceland_jack> add a b = a + b
13:24 <Iceland_jack> add a b = (+) a b
13:24 <Iceland_jack> add a = (+) a
13:24 <Iceland_jack> add = (+)
13:24 <fortruce> (+) :: Integer -> (Integer -> Integer)
13:25 saussure joined
13:25 <fortruce> So, when you call (+) 2, you get back a function that takes a number and adds it to 2
13:26 <fortruce> And when I do addTwo = (+) 2 I'm assigning that returned function to addTwo, so now addTwo is Integer -> Integer
13:26 <fortruce> > let addTwo = (+) 2; in addTwo 3
13:26 <lambdabot> 5
13:28 <scav> Xion_ thank you for the input. it helped me put things into perspective. since everything runs from main :: IO () it became a bit easier to chain the results and pretend it was not IO
13:29 <WhereIsMySpoon> fortruce: i get that
13:33 iAmerikan joined
13:37 albertus1 joined
13:39 cschneid_ joined
13:41 Iceland_jack joined
13:43 saussure joined
13:43 kritzcreek joined
13:45 <ski> scav : "or do i have to call the pure function from the IO function?" -- yes,"and can this function return from the IO monad, say a Bool or a String that can be used by pure functions later?" -- yes, if you pass on that result from the ("impure") `IO'-operation to the ("pure") non-`IO'-operation. like `do x <- ioInteraction; let {y = internalComputation x}; ..x..y..'
13:45 tsmish joined
13:45 buggerme joined
13:45 <scav> thanks ski, gotta run
13:45 <ski> np
13:46 lewis joined
13:46 <ski> (all functions in Haskell are pure)
13:47 Bare- joined
13:52 aarvar joined
13:55 tsmish joined
14:01 saussure joined
14:03 hphuoc25 joined
14:04 eacameron joined
14:04 diegs_ joined
14:04 juanpaucar joined
14:08 saussure joined
14:09 juanpaucar joined
14:10 jathan_ joined
14:11 mr_sm1th joined
14:14 eacameron joined
14:16 lewis joined
14:19 stevenxl joined
14:26 eacameron joined
14:28 takle joined
14:28 chlong joined
14:37 carlomagno joined
14:37 eacameron joined
14:37 brailsmt joined
14:38 yellowj joined
14:42 dni- joined
14:49 diegs_ joined
14:51 Levex joined
14:55 prophile joined
14:57 fotonzade joined
15:02 sullyj3 joined
15:03 cschneid_ joined
15:03 <sullyj3> how do I i get the key of the maximum value in a map? There's a bunch of max related functions in Data.Map but none of them exactly do that.
15:04 uglyfigurine joined
15:05 juanpaucar joined
15:08 prophile joined
15:08 <Xion_> sullyj3: This would be O(n) so you probably have to do it manually with something like mapAccum
15:09 <sullyj3> :t mapAccum
15:09 <lambdabot> error:
15:09 <lambdabot> • Variable not in scope: mapAccum
15:09 <lambdabot> • Perhaps you meant one of these:
15:09 <mniip> :t M.mapAccum
15:09 <lambdabot> (a -> b -> (a, c)) -> a -> M.Map k b -> (a, M.Map k c)
15:10 <mniip> a fold is fine too
15:10 <sullyj3> ta
15:10 <mniip> :t M.foldrWithKey
15:10 <lambdabot> (k -> a -> b -> b) -> b -> M.Map k a -> b
15:10 tsmish joined
15:11 <mniip> yeah, pretty sure you want foldrWithKey
15:11 <mniip> as mapAccum doesn't give you keys
15:13 mac10688 joined
15:21 jmiven joined
15:21 zero_byte joined
15:23 levex_ joined
15:25 NoCreativity joined
15:26 grayjoc joined
15:29 juanpaucar joined
15:31 <sullyj3> mniip: Thanks, that seems right. I'm kinda struggling though. My map :: Map.Map Char Int
15:32 <sullyj3> if I want to return the key of the maximum value my initial accumulator should be a Char, right? But what char should I initialise it to?
15:32 <sullyj3> What if it turns out the initial acc is actually a key in the map?
15:33 juanpaucar joined
15:33 <sullyj3> oh, I can make the acc a pair and get the val out at the end!
15:34 <sullyj3> wait, that's still the same problem
15:34 <ski> could you use `Maybe Char' ?
15:35 <ski> or `Maybe (Char,Int)', perhaps
15:35 <mniip> sullyj3, you want to have b ~ Maybe (k, a)
15:35 <mniip> or something
15:36 <sullyj3> So, start with Nothing as the initial acc?
15:36 Levex joined
15:36 <sullyj3> That makes sense
15:36 <ski> yep
15:36 <mniip> yes
15:36 <sullyj3> Thanks guys, I'll give that a go
15:36 <mniip> that way you would also get a nice 'Nothing' if the map were empty
15:36 <sullyj3> cool!
15:36 <ski> i suppose an alternative would be to first check whether it's empty, and otherwise use `(Char,Int)'
15:37 <mniip> does Data.Map.Map have an uncons?
15:37 <ski> unsure
15:37 <mniip> I think it had some 'view' functions
15:37 <mniip> :t M.minViewWithKey
15:37 <lambdabot> M.Map k a -> Maybe ((k, a), M.Map k a)
15:38 <ski> *nod* (i was just looking for something like that)
15:39 <ski> this way, the callback passed to `foldrWithKey' wouldn't need to interpret the `Maybe' every time
15:40 <mniip> yeah but we're getting into "messy" territory
15:40 eacameron joined
15:40 <ski> a bit, aye
15:40 <mniip> as in, you probably want a very distinct function rather than an integrated oneliner/where-binding
15:41 ianandrich joined
15:42 madjestic joined
15:46 <tsmish> Are there any conventions about use of pointless notation and ($)?
15:47 <sullyj3> got it to compile! https://pastebin.com/7rUmZGca (looks like lpaste is down)
15:50 <sullyj3> is it possible to condense the LT and EQ cases into one?
15:50 stvc joined
15:53 <sullyj3> oops, should really be called maxByVal
15:53 yellowj joined
15:54 romank joined
15:56 govg joined
15:56 conal joined
15:56 <ski> @type let frob :: (c -> Maybe (e,c)) -> ((e -> e -> e) -> e -> c -> e) -> ((e -> e -> e) -> c -> Maybe e); frob uncons fold (<>) coll = fmap (\(el,coll) -> fold (<>) el coll) (uncons coll) in frob
15:56 <lambdabot> (c -> Maybe (e, c)) -> ((e -> e -> e) -> e -> c -> e) -> (e -> e -> e) -> c -> Maybe e
15:56 <srhb> sullyj3: if v <= maxVal then...
15:57 <ski> @type let frob :: (c -> Maybe (e,c)) -> (e -> c -> e) -> (c -> Maybe e); frob uncons fold coll = fmap (\(el,coll) -> fold el coll) (uncons coll) in frob
15:57 <lambdabot> (c -> Maybe (e, c)) -> (e -> c -> e) -> c -> Maybe e
15:57 <ski> @type let frob :: (c -> Maybe (e,c)) -> (e -> c -> e) -> (c -> Maybe e); frob uncons fold = fmap (uncurry fold) . uncons in frob
15:57 <lambdabot> (c -> Maybe (e, c)) -> (e -> c -> e) -> c -> Maybe e
15:57 <sullyj3> srhb: I'm an idiot
15:57 <sullyj3> haha thanks
15:57 <srhb> sullyj3: No you're not. :-)
15:58 eacameron joined
15:59 <srhb> sullyj3: You might also want to drop the Just, since it's there in every case.
15:59 <srhb> sullyj3: Or if you really want to keep it despite being meaningless, fold with (Just . f)
16:01 <sullyj3> srhb: you might have missed earlier, we were talking about initializing the acc to Nothing in case of empty map, and to avoid arbitrarily saying some k is the initial max
16:01 <sullyj3> and of course the output of f has to match the type of the acc
16:02 <mniip> ski, frobnication sure is a universal operation
16:02 <srhb> sullyj3: Sorry, you are right, I just got here and didn't scroll back. :)
16:03 <sullyj3> The Just.f is a good tip though, thanks!
16:03 <srhb> sullyj3: I only noticed it had no semantic meaning in f at all (since it was used in _every_ case, so it couldn't possibly carry any meaning _inside_ f)
16:03 diegs_ joined
16:04 <ski> sullyj3 : `f k v = Just . maybe (k,v) (\(maxKey,maxVal) -> if v <= maxVal then (maxKey, maxVal) else (k,v))'
16:04 <srhb> (is semantic meaning a pleonasm?)
16:04 <mniip> ski, hold on
16:04 <ski> sullyj3 : or possibly `f k v = Just . maybe (k,v) (maximumBy (comparing snd) . (: [(k,v)]))' (is there no `maxBy' !?)
16:04 <mniip> I had something somewhere
16:04 <mniip> that made use of tuple comparison
16:04 <mniip> in a situation just like this
16:05 <sullyj3> :t maybe
16:05 <lambdabot> b -> (a -> b) -> Maybe a -> b
16:06 <ski> sullyj3 : `maybe' is just a shorthand way of checking a `Maybe', giving ways to handle each of the two possible cases
16:06 <mniip> :t M.foldrWithKey (\k v -> max (v, k))
16:06 <lambdabot> (Ord t, Ord t1) => (t1, t) -> M.Map t t1 -> (t1, t)
16:07 <ski> mniip : that `frob' was just a train of thought regarding whether it could be worth it to abstract the operation of building a summary operation which can handle an empty collection (by returning `Maybe') from one that can't .. conclusion is that it's probably not worth it
16:08 <mniip> :t fmap (\((k, v), m) -> M.foldrWithKey (\k v -> max (v, k)) (k, v) m) . M.minViewWithKey
16:08 <lambdabot> Ord t => M.Map t t -> Maybe (t, t)
16:09 <sullyj3> ski: so the first b is a fallback in case (Maybe a) is nothing?
16:09 <mniip> :t fmap (\((k, v), m) -> M.foldrWithKey (\k v -> max (v, k)) (v, k) m) . M.minViewWithKey
16:09 <lambdabot> (Ord t1, Ord t) => M.Map t1 t -> Maybe (t, t1)
16:09 <ski> using the apparently nonexistant `maxBy', it'd be `f k v = Just . maybe (k,v) (maxBy (comparing snd) (k,v))', which looks nicer
16:09 <ski> (`maxBy :: Ord b => (a -> b) -> a -> a -> a', in case it's not obvious)
16:09 <mniip> that would be a maxOn
16:09 <mniip> not By
16:10 <ski> er, you're right
16:10 <mniip> comparing snd sounds like (a -> a -> Ordering)
16:10 <sullyj3> :t max
16:10 <lambdabot> Ord a => a -> a -> a
16:10 <sullyj3> :t on
16:10 <lambdabot> (b -> b -> c) -> (a -> b) -> a -> a -> c
16:10 <ski> sorry, i was confusing myself a bit :) :/
16:10 <sullyj3> :t max `on`
16:10 <lambdabot> error:
16:10 <lambdabot> parse error (possibly incorrect indentation or mismatched brackets)
16:11 <sullyj3> :t (max `on`)
16:11 <lambdabot> Ord c => (a -> c) -> a -> a -> c
16:11 <sullyj3> :t (max `on` snd)
16:11 <lambdabot> Ord c => (a, c) -> (a, c) -> c
16:12 <ski> i meant to pass `comparing snd', and so i meant to use an operation with type `(a -> a -> Ordering) -> a -> a -> a', iow `maxBy', not `maxOn' which would have the type `Ord b => (a -> b) -> a -> a -> a'
16:12 <sullyj3> > (max `on` snd) ('a', 1) ('b', 2)
16:12 <lambdabot> 2
16:13 <ski> (apparently my mind for whatever reason recalled the incorrect type for `maxBy', even though not fitting in this situation)
16:13 OscarZ joined
16:13 <ski> sullyj3 : yeah .. that doesn't work here, since it'd just return the second component, not the whole pair
16:13 lewis joined
16:14 <sullyj3> yeah, I realised that afterwards haha
16:14 <sullyj3> I'm trying to figure out why one of my intermediate rewrites isn't compiling
16:15 <sullyj3> https://pastebin.com/JhPuzfZx
16:15 OscarZ joined
16:16 <ski> sullyj3 : you need `((Just .) .) . f' there, `\x y z -> Just (f x y z)', expanded out
16:16 <sullyj3> oh.
16:16 <sullyj3> ew
16:17 <ski> (yeah, that looks a bit uncomfortable if you're not used to reading that. don't worry if you don't even want to get used to reading such things)
16:17 <ski> oh, and the type signature for `f' is wrong
16:18 brailsmt joined
16:18 <sullyj3> oh yeah
16:19 <sullyj3> f :: k -> a -> Maybe (k, a) -> (k, a)
16:19 <sullyj3> Are there any alternatives to nested composition and just writing Just in all the cases?
16:19 <ski> mniip : shouldn't require `Ord' on the values
16:20 <sullyj3> ski: why not? we're comparing them
16:20 <ski> er .. the keys
16:22 <ski> sullyj3 : you could define `result post f = post . f', and write `(result . result . result) Just f'. one can also define `argument pre f = f . pre' and `(pre ~> post) f = post . f . pre'
16:22 <mniip> ski, well, maps already require Ord on the keys
16:22 <sullyj3> Lol. Never mind then.
16:22 <mniip> so it's no big deal
16:23 <ski> the types here are `result :: (b0 -> b1) -> ((a -> b0) -> (a -> b1))',`argument :: (a1 -> a0) -> ((a0 -> b) -> (a1 -> b))',`(~>) :: (a1 -> a0) -> (b0 -> b1) -> ((a0 -> b0) -> (a1 -> b1))'
16:23 <sullyj3> maybe
16:23 <ski> one can use functions like this to "specify a path to step inside a type, where a function is to be applied"
16:23 <mniip> well, sure, you could have a map created in another module with Ord instances not in current scope, and, sure, tearing down such a map should require no Ord on the keys
16:24 mstruebing joined
16:24 <ski> in this case we're "stepping inside" the result type of a function, respectively the argument type of a function
16:24 <ski> see
16:24 <ski> @where SEC
16:24 <lambdabot> http://conal.net/blog/posts/semantic-editor-combinators/
16:24 <ski> for more on this idea
16:24 <ski> `map' can be used here to "step inside" the element type of a list, e.g.
16:25 saussure joined
16:25 <sullyj3> :t (max `on`)
16:25 <lambdabot> Ord c => (a -> c) -> a -> a -> c
16:25 <sullyj3> @hoogle Ord c => (a -> c) -> a -> a -> a
16:25 <lambdabot> Prelude (.) :: (b -> c) -> (a -> b) -> a -> c
16:25 <lambdabot> Data.Function (.) :: (b -> c) -> (a -> b) -> a -> c
16:25 <lambdabot> Data.GI.Base.ShortPrelude (.) :: (b -> c) -> (a -> b) -> a -> c
16:26 <sullyj3> damn
16:27 <ski> `result . result . argument . result . first . map' will allow one to go from `A -> B -> (C -> ([D0],E)) -> F' to `A -> B -> (C -> ([D1],E)) -> F', by using a function that transforms `D1' into `D0'
16:27 <sullyj3> That's basically how pythons sorted(l, key=f) works
16:28 <Cale> :t sortBy . comparing
16:28 <lambdabot> Ord a => (a1 -> a) -> [a1] -> [a1]
16:28 <ski> the "path" here specifies that we're moving past two `->'s, then into the argument type there, past the `->' in that argument type, into the first component of the pair type, and inside the list type
16:28 eacameron joined
16:29 <sullyj3> Cale: sorry, I meant max(a,b, key=f)
16:31 dni- joined
16:34 kaychaks joined
16:39 <Bare-> Hi all. Working through HsFP's Ch11 Vigenere cipher and would appreciate some critique to better understand how I should think about these problems. I have it working for one case (capital letters), but my solution feels rather hacky: http://lpaste.net/7310354209776336896. Of note, I'm wondering if there's a better approach to encoding/decoding the cipher vs separate functions with a mere signage swap. I also could not figure out an elegant means
16:39 <Bare-> to cycling the key string without passing it through a separate function. Most efforts to contain it all as one would cause issues handling the space characters.
16:43 <kaychaks> Hi, I would like some help to this issue of mine - https://stackoverflow.com/questions/44167823/constraining-types-in-gadt-constructor
16:44 <sullyj3> @djinn Ord c => (a -> c) -> a -> a -> a
16:44 <lambdabot> Error: Class not found: Ord
16:44 <sullyj3> wut
16:45 <sullyj3> @djinn (a -> c) -> a -> a -> a
16:45 <lambdabot> f _ _ a = a
16:46 dummycode joined
16:46 <Cale> kaychaks: Why not just make Concept be a GADT to start with?
16:49 <kaychaks> Cale : Ok. How is that going to solve me realise the intent with Constructs. I thought Concept is a pretty straightforward construction. I need to use Construct's constructors compose Concepts.
16:49 <Cale> Bare-: I would probably define some function cycleRange :: (Char, Char) -> Int -> Char -> Char which takes a range like ('A','Z') and cycles the characters between those values by the given amount, and leaves everything else untouched.
16:49 <ski> Bare- : perhaps you'd like to use an `isAlphabetic' (that you define) rather than specifically matching on space
16:50 <ski> encode = (subtract `on` ord) 'A' -- yet another way to define your `encode'
16:50 eacameron joined
16:51 <ski> (you could also do `vigenere cs = vigParse cs . cycle', fwiw)
16:51 <Cale> kaychaks: Well, maybe I don't understand well enough what you're trying to represent.
16:51 WhereIsMySpoon joined
16:52 <ski> Bare- : one approach to avoid the repetition between `vigParse' and `unVigParse' is to generalize on the common parts, abstracting the differing parts into new parameters
16:53 <ski> Bare- : perhaps something like `vigProcess :: (Char -> Char -> Char) -> (String -> String -> String)', passing in `shiftr' alternatively `shiftl' as first argument
16:54 <ski> Bare- : if you're also abstracting out how you distinguish between letters and non-letters, then you could make it polymorphic, not caring (and clearly, from inspecting only the type, not being able to mess with the elements, apart from via the callback(s))
16:56 <Cale> kaychaks: But it seems like you want the type of a Concept to indicate which constructor it was built with
16:56 <ski> i suppose `decode = chr . (ord 'A' +)' might go nicely together with `encode', could be used in `shiftr',`shiftl'
16:57 <Cale> kaychaks: Which implies that it ought to be a GADT
16:57 <ski> but possibly you also want to handle lower case (presumably wanting to keep the case of the plaintext/ciphertext)
16:57 <Bare-> I see. pointfree still isn't readily intuitive for me, but I try for the simple cases. I'll have to play with these other suggestions, slightly overwhelmed! I'm considering how I might include both lower and upper cases. I know I can use isLower/Upper, but deciding the best place to stick without more repetition it is my dilemma.
16:57 texasmynsted joined
16:57 <Bare-> I actually had decode in there, but discovered I never used it
16:57 <ski> well, you forgot to use it in `shiftr',`shiftl', then, i think :)
16:58 <ski> (or perhaps decided against it)
16:58 <Bare-> not consciously :)
16:58 <ski> i was pondering whether it would be nicer to specify where `26' comes from, rather than keeping it as a magic constant
16:59 poissonmann joined
16:59 <Bare-> True. It is whimsical at the moment
17:00 <ski> ord (decode i) = ord 'A' + i -- it would be nice if `decode' could actually be defined like this :)
17:00 poissonmann joined
17:00 <kaychaks> Cale : yes I want Construct's constructors to constrain their type params to that of Concept's promoted ones. If also I make Concept GADT, I am failing to get how it will help me constrain the Construct's constructor type params
17:01 <Bare-> And yes, with both upper/lower case I need some way to wrap 'Z' to 'A' and 'z' to 'a' independently
17:01 merijn joined
17:02 iAmerikan joined
17:03 argent0 joined
17:03 begriffs joined
17:04 <ski> > let ((chr .) -> decode) = \i -> ord 'A' + i in map decode [0,2,1] -- doesn't look nice :/
17:04 <lambdabot> "ACB"
17:05 poissonmann joined
17:06 <ski> Bare- : oh, i forgot to say that you can drop all except the first `let' there, if you keep the individual definitions aligned. .. also, did you want to use `putStrLn' rather than `print' (on a `String' !) there ?
17:06 <Cale> kaychaks: Well, from your example, you want to be able to write Has person name. Those arguments both have type Concept something
17:07 chankari joined
17:07 <Cale> kaychaks: So both of the arguments to Has ought to have types constructed by Concept
17:07 <Bare-> I'm not too confident with IO and the putStr/print distinctions yet to be honest. That was just a quick hacky check and the first thing that seemed to work
17:07 conal joined
17:08 <ski> Bare- : anyway, if you generalize to a `vigProcess', then you could make that a local helper function of a function that does the `cycle' (or, if you prefer, `vigProcess' could be made to start over when the key is exhausted .. but probably that's more involved)
17:08 <kaychaks> Cale : yes. However, for Has I want to constrain the second type param to be of `Relation (which is the promoted type of the constructor Relation of Concept)
17:08 <ski> Bare- : in any case, this wrapper function could then be called from two places, passing `shiftr' resp. `shiftl'
17:09 <Cale> kaychaks: That doesn't make sense -- that type has no values.
17:10 <Bare-> I think I understand, then vigenere and unVigenere can just call vigProcess with their respective shifts instead of rewriting everything
17:10 <ski> Bare- : `putStr' and `putStrLn' are for outputting the *contents* of a(n arbitrary) *string* (with a newline in the latter case) (not printing quotes, no string escapes). `print' is for outputting a string representation of a *Haskell* value. in case that value is (or contains) a string, that string will be wrapped in quotes and escaped according to normal Haskell syntax
17:10 <ski> Bare- : basically, yes
17:11 <ski> Bare- : the latter part of what i said just involves hiding `cycle' inside that as well
17:11 <kaychaks> Cale : Hmm. So are you saying that it's not feasible to do something like that ?
17:11 <Bare-> Oh, right. That would be effective
17:11 <Cale> kaychaks: When you promote a data constructor D of type T to create a type 'D, that is not of kind *, it's of kind 'T
17:11 pilne joined
17:11 <ski> Bare- : but also consider Cale's suggestion
17:12 <Cale> kaychaks: and 'D doesn't have values.
17:12 <Cale> kaychaks: but it can be used to index a GADT or something
17:12 <ski> > rangeSize ('A','Z') -- could be a nice way to specify where `26' comes from
17:12 <lambdabot> 26
17:14 <ski> (when handling both lower and upper case english ASCII characters (i'm assuming you don't attempt to tackle a larger unicode subset of letters), you'll still rely on the number of lower case letters being the same as the number of upper case letters ..)
17:14 <Cale> kaychaks: However, if Concept was a GADT, then you could have the result types of the constructors vary in a way which revealed information about which constructor was used to build the Concept.
17:15 <Bare-> Thanks for the print explanation, I see I could've just used putStrLn for everything.
17:15 <Bare-> and yes, the idea is to avoid ending up in unicode land when the message is encoded
17:15 <Bare-> and I recall there's numbers and some symbols between upper and lower letters?
17:16 <Bare-> their ord values, I mean.
17:16 <ski> oh, so the plaintext could still contain non-ASCII unicode letters ? do you want to leave them untouched ?
17:16 <ski> Bare- : correct
17:16 <ski> > ['Z' .. 'a']
17:16 <lambdabot> "Z[\\]^_`a"
17:17 <Bare-> my thought was if it's lower case, keep it in the range of [a..z], and likewise for the upper
17:17 <* ski> nods
17:21 <kaychaks> Cale : ok. let me try to work on it. could you provide any example ?
17:23 govg joined
17:25 diegs_ joined
17:28 <ski> @let data Case = Upper | Lower deriving (Eq,Ord,Show,Read,Bounded,Enum,Ix)
17:28 <lambdabot> Defined.
17:28 <ski> @let caseOf :: Char -> Maybe Case; caseOf c | isUpper c = Just Upper | isLower c = Just Lower | otherwise = Nothing
17:28 <lambdabot> Defined.
17:28 <ski> @let toCase :: Case -> Char -> Char; toCase Upper = toUpper; toCase Lower = toLower
17:28 <lambdabot> Defined.
17:29 <ski> @let toCaseOf :: Char -> Char -> Char; toCaseOf = fromMaybe id . fmap toCase . caseOf
17:29 <lambdabot> Defined.
17:29 <merijn> ski: What's that supposed to do for letters that have no case?
17:29 <ski> > zipWith toCaseOf (cycle "Help Me!") "Mary goes to France."
17:29 <Cale> kaychaks: http://lpaste.net/355841
17:29 <lambdabot> "Mary GoeS to FraNce."
17:29 <merijn> > caseOf 'ಠ'
17:29 <lambdabot> Nothing
17:30 <ski> merijn : it might be better to do nothing in `toCase' in such cases
17:30 <merijn> At least that's correct :)
17:30 <ski> Bare- : something like the above might perhaps be handy
17:30 <Cale> kaychaks: Does that example make sense?
17:31 <ski> > [c | c <- ['\0' ..],isUpper c,isLower c]
17:31 <lambdabot> ""
17:32 <* ski> isn't sure what `toUpper' and `toLower' is specified to do, when given a non-cased character, or one which have no corresponding character in the desired case
17:33 <Cale> Haha, are there uppercase letters for which no lowercase equivalent is defined?
17:33 <Cale> (or vice versa)
17:33 <Bare-> ski : I'll consider that, thanks! I appreciate all the patience. I have vigProcess implemented. This looks much nicer. Still have the cycle in vig/unVig, stumped how I'd get it into the vigProcess function. I'll toy with the upper/lower problem for a bit.
17:34 <ski> > caseOf 'ẞ'
17:34 <lambdabot> Just Upper
17:34 <ski> > toCase Lower 'ẞ' == 'ß'
17:34 <lambdabot> True
17:34 <ski> > toCase Upper 'ß' == 'ẞ' -- :(
17:34 <lambdabot> False
17:34 <kaychaks> Cale : Wow. Thanks. Is ConceptType the phantom type ?
17:34 <Cale> > toCase Upper 'ß'
17:34 <lambdabot> '\223'
17:34 <ski> > all isLetter "ßẞ"
17:34 <lambdabot> True
17:34 <ski> > 'ß'
17:35 halogenandtoast joined
17:35 <lambdabot> '\223'
17:35 <kaychaks> Cale : I was trying to think in so many weird ways. your solution shows how simple it could be. thanks again
17:35 <Cale> kaychaks: You could call it that, yes.
17:35 <ski> Bare- : make a new function that wraps `vigProcess', call `vigProcess' from that, using `cycle' on the argument. call this function from `vig',`unVig' instead
17:38 eacameron joined
17:41 <Bare-> I think that's the solution I would've settled on. Is it a more 'proper' approach to contain the cycle in a separate function?
17:44 <dummycode> Is there a simpler way to write this? [(a, b, c) | a <- "pbtdkg", b <- "aeiou", c <- "pbtdkg"]
17:44 <dummycode> Was looking for something like [(a, b, c) | a,c <- "pbtdkg", b <- "aeiou"]
17:45 <mniip> dummycode, [(a, b, c) | let x = "pbtdkg", a <- x, c <- x, b <- "aeiou"]
17:47 <dummycode> okay, not much cleaner, but better. thanks
17:47 <srhb> Has anyone here used http-proxy successfully? Even the most basic version gives me InvalidUrlException
17:50 <ski> @check \c -> isUpper c ==> (toUpper (toLower c) == c)
17:50 <lambdabot> +++ OK, passed 100 tests.
17:50 <ski> @check \c -> isLower c ==> (toLower (toUpper c) == c)
17:50 <lambdabot> +++ OK, passed 100 tests.
17:51 <ski> > (`any` "LjDz") $ \c -> (`any` [toUpper . toLower,toLower . toUpper]) $ \idem -> idem c == c
17:51 <lambdabot> False
17:51 <ski> > (`all` [("LJLjlj",('LJ','lj')),("DZDzdz",('DZ','dz'))]) $ \(cs,extremes) -> (`all` [(toUpper,fst),(toLower,snd)]) $ \(to,tgt) -> (`all` cs) $ \c -> to c == tgt extremes
17:51 <lambdabot> True
17:52 eacameron joined
17:52 <mniip> > all (\c -> isUpper c <= (toUpper (toLower c) == c)) ['\0'..'\65535']
17:52 <lambdabot> False
17:53 <ski> Bare- : it's probably more "proper" to not have to burden the caller with having to use `cycle' on the input. this is a common pattern, sometimes called "worker-wrapper", your worker does most of the job, but is defined internally to a wrapper which handles initialization and finalization
17:54 <mniip> > text $ filter (\c -> isUpper c > (toUpper (toLower c) == c)) ['\0'..'\65535']
17:54 <lambdabot> İDžLjNjDzϴẞΩKÅ
17:54 uglyfigurine joined
17:56 thedoomguy joined
17:59 <ski> > or (zipWith (==) "ΩKÅ" "ΩKÅ")
17:59 <lambdabot> False
18:00 <ski> > "Å"
18:00 <lambdabot> "A\778"
18:02 <ski> > and (zipWith ((==) `on` toLower) "ΩKÅ" "ΩKÅ")
18:02 <lambdabot> True
18:02 <Bare-> I see. It just occurred to me I didn't consider the case of a lower letter encoded with an upper. This is becoming complicated! Perhaps outside of the scope of the exercise, but still interesting.
18:03 <ski> "the case of a lower letter encoded with an upper" ?
18:04 <Bare-> so if you encoded "Meet at dawn" with "Ally" instead of all caps, the 'a' in "at" would be shifted by 'A' as "Ally" cycles
18:05 <Bare-> One option would be to equate them if the case is different, so a shift of zero with 'a' and 'A'
18:07 <Cir0X> I'm having a hard time adding a githug dependency to my stack project. For some reason it uses the regular version and not my fixed one. Any ideas? http://lpaste.net/355844
18:07 takle joined
18:09 <ski> oh, there's two majuscule omega letters, one a variant
18:09 <ski> > (==) 'Θ' 'ϴ'
18:09 <kadoban> Cir0X: That appears to be the same version as hackage has. Is it actually different?
18:09 <lambdabot> False
18:10 <ski> > ((==) `on` toLower) 'Θ' 'ϴ'
18:10 <lambdabot> True
18:10 <ski> > text $ filter (\c -> isLower c > (toLower (toUpper c) == c)) ['\0'..'\65535']
18:10 <lambdabot> µıſςϐϑϕϖϰϱϵẛι
18:11 <* ski> was thinking it might be some technical unit symbol ..
18:12 eacameron joined
18:13 brailsmt joined
18:13 <Cir0X> kadoban: It is different: https://github.com/Cir0X/themoviedb/commit/0bab1bf1ac2b5c92279f31db9b0bbafe7524f8a5
18:13 <Cir0X> Do I need to make a new release to make it work? I thought stack pulls the repo and build's it
18:13 <ski> Bare- : not sure what you mean by "equate them if the case is different, so a shift of zero with 'a' and 'A'" .. do you mean that we keep the case of the letter to be transformed, but the offset of the corresponding key letter is only considered within the alphabet of the same case ?
18:14 im0nde joined
18:15 <kadoban> Cir0X: It's possible the version needs to be different? I didn't think so though. You could try stack clean and then build again maybe? Might require some extra compilation though.
18:15 <Bare-> Yes. I'm not certain how the cipher should operate otherwise (if it does). This is merely an idea of how to handle it, and one I think I can reasonably accomplish :^)
18:16 saussure joined
18:20 dni- joined
18:20 juanpaucar joined
18:21 <Cir0X> kadoban: clean build didn't help :\
18:22 saussure joined
18:22 <kadoban> Cir0X: Try changing the version number (and pointing at that new commit) ?
18:32 brailsmt joined
18:34 <Cir0X> kadoban: It seems he uses the right version now, but can't find the functions I've added http://lpaste.net/355845
18:35 begriffs_ joined
18:36 <kadoban> Cir0X: Are you importing them correctly? That sounds like just a code error
18:38 <Cir0X> kadoban: When I'm using the "old" function it work's but not with the newly added function http://lpaste.net/3695644772082384896
18:40 <kadoban> It looks like you added those exports from N.A.T.Actions, not the file you're importing. Check the module you're importing.
18:41 not_on_fp joined
18:44 <Cir0X> kadoban: Oh, I've missed that. Thanks a lot!
18:46 <kadoban> Cir0X: Anytime. By the way, is this what led you to believe that it wasn't using the new version? You could probably undo the version part and etc. if you wanted to, assuming it is.
18:49 <Cir0X> kadoban: Yes that was my interpretation of the Problem. I'll revert the version bump real quick and see if it works
18:49 nullcone joined
18:52 <Cir0X> kadoban: Works fine now =)
18:52 brailsmt joined
18:52 <kadoban> Cool :)
18:58 watersoul joined
19:05 <thang1> So I have a weird question
19:05 <thang1> How would I test my implementation of "lefts" from Data.Maybe?
19:06 <thang1> The Haskell Book doesn't give any examples of using it (or how to test any of the Either functions I'm reimplementing)
19:07 <kadoban> thang1: What's it do?
19:09 <thang1> :t lefts
19:09 <lambdabot> [Either a b] -> [a]
19:09 mac10688 joined
19:09 <kadoban> Oh. Good starting place would be just running it on some things and making sure it gives you the expected behavior. Do you understand what it should do?
19:10 <thang1> I'd be fine with figuring out how to make a list of Eithers, for some reason that part is eluding me. [Left a, Right b, Left c] should work right?
19:10 <kadoban> > [Left 5, Right "hi", Left 2]
19:10 <lambdabot> [Left 5,Right "hi",Left 2]
19:10 <kadoban> Yes, depending on what a b and c are
19:11 <thang1> Yup, works that way, I was overcomplicating that in my head
19:11 <thang1> (I kept trying to construct a full Either a b with some types of something and it wasn't working right)
19:11 <kadoban> Ah
19:11 <thang1> Or at least it would've been far too complicated for simple testing :p
19:12 <kadoban> Once you do a few tests, if that's not convincing enough, later you could use QuickCheck to verify that it has the same behavior as the one from Prelude or Data.Either or wherever it lives
19:16 <thang1> Yeah, the few tests was all I needed. I'll use quickcheck once I get to that part of the book :p
19:18 <kadoban> Cool
19:22 <thang1> Is lpaste working right now? It's not loading on my computer
19:25 <geekosaur> not loading here either
19:25 <geekosaur> unfortunately I think it's currently unowned
19:25 <thang1> that's unfortunate. Any good alternatives? I try to avoid pastebin
19:27 <kadoban> gist.github.com is fairly nice IMO.
19:27 <kadoban> The highlighting works well enough at least, and you can have multiple files and change versions and etc.
19:39 <thang1> right, of course. I always forget about that one lol
19:42 <thang1> https://gist.github.com/jared-w/8544e26101558618c38c030d93cab23c
19:42 <thang1> So, I'm trying to change the lefts into a fold and I'm pretty sure I'm doing something wrong
19:54 <Cale> > foldr (\x xs -> case x of Left v -> v : xs; _ -> xs) [] [Left 1, Right "hello", Left 2, Left 3]
19:54 <lambdabot> [1,2,3]
19:55 <Cale> > foldr (\case Left v -> (v:); _ -> id) [] [Left 1, Right "hello", Left 2, Left 3]
19:55 <lambdabot> [1,2,3]
19:56 <thang1> So I'm going to have to stick the case inside the fold basically?
19:56 <kadoban> Yes, instead of the 'if'. It's a better idea here, using fromLeft is funky.
19:56 <thang1> I was trying to compensate for not being able to use a case statement in a lambda function
19:57 <thang1> Since I didn't realize I could just stick the case statement in the lambda function :p
19:57 juanpaucar joined
19:57 <kadoban> Yours could "work", like foldr (\x xs -> if isLeft x then fromLeft x : xs else xs) ... but it's not so good style.
19:57 <Cale> It's not a case statement, it's a case *expression* -- which is why it's valid there :)
19:57 <kadoban> Hm, yes that's a good point.
19:57 <thang1> What's the difference?
19:57 <Cale> Just where in the syntax those things go
19:58 <kadoban> Between if and case or between expressions and statements?
19:58 <Cale> Statements in Haskell are the things which make up a do-block.
19:58 <thang1> ah right, okay. Vocabulary messup on my part then
19:59 <kadoban> Cale: Is that the right word for those, statements? Is there a way to differentiate parts of do-block syntax from language constructs like data Blah = ... I guess those are ... what definitions?
19:59 juanpauc_ joined
20:04 <Cale> The report calls those "declarations"
20:04 <kadoban> Ahh, right
20:04 <kadoban> Thanks. I should reread the report sometime
20:09 dni- joined
20:17 theencoded joined
20:21 lewis joined
20:34 chlong joined
20:37 test283597320589 joined
20:37 iAmerikan joined
20:38 diegs_ joined
20:39 chlong joined
20:39 ianandrich joined
20:40 zero_byte joined
20:41 mr_sm1th joined
20:50 diegs_ joined
20:50 diegs_ joined
20:54 iAmerikan joined
20:57 fotonzade joined
21:00 takle joined
21:04 uglyfigurine joined
21:06 uglyfigurine joined
21:06 uglyfigurine joined
21:08 test283597320589 left
21:13 uglyfigurine joined
21:17 juanpaucar joined
21:18 juanpauc_ joined
21:24 mattyw joined
21:32 iAmerikan joined
21:32 juanpaucar joined
21:35 halogenandtoast joined
21:41 prophile joined
21:42 juanpaucar joined
21:44 iAmerikan joined
21:52 juanpaucar joined
21:52 juanpaucar joined
21:54 hiratara joined
21:55 marmalodak joined
21:58 dni- joined
22:05 prophile joined
22:07 louispan joined
22:11 bluepixel joined
22:22 juanpaucar joined
22:31 hiratara joined
22:33 geekosaur joined
22:35 carlomagno joined
22:49 mengu joined
22:50 juanpaucar joined
22:56 netheranthem joined
22:58 juanpaucar joined
22:59 juanpaucar joined
23:02 juanpaucar joined
23:02 <* ski> tends to prefer using the term "command" to "statement", preferring the latter for declarative statements a la logic programming
23:03 juanpauc_ joined
23:20 Orion3k joined
23:21 im0nde_ joined
23:23 louispan joined
23:28 juanpaucar joined
23:30 arquebus joined
23:41 louispan joined
23:42 Iceland_jack joined
23:44 juanpaucar joined
23:46 Guest25 joined
23:47 dni- joined