<    March 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:00 <Lazersmoke> cause what you are really doing is *deconstructing* the data and inspecting the individual parts
00:01 <Lazersmoke> so instead of `(MessageTree leaf)`, just match on `Leaf`
00:05 takle joined
00:09 takle_ joined
00:13 faberbrain joined
00:17 cschneid_ joined
00:22 ljc joined
00:23 takle joined
00:27 jdelreal joined
00:28 uglyfigurine joined
00:32 <amIaName> So now I am facing another issue: I am getting a parsing issue when I type in the line "insert message tree@(left (Unknown _) right) = tree"
00:32 <amIaName> The compiler does not like my use of "left". Why is this happening?
00:33 takle joined
00:33 <kadoban> You probably mean Left
00:33 hphuoc25 joined
00:34 <amIaName> There is no "Left" type
00:34 <amIaName> Why should this be capitalized?
00:34 <kadoban> There is an Either type though, which has the constructors Left and Right
00:35 <amIaName> Sorry, this is part of a conversation from 30 minutes ago. Here is the relevant paste: http://lpaste.net/6474668988335915008
00:35 <amIaName> I am in the second week of the cis194 course
00:38 <Lazersmoke> amIaName: you need to include Node in there
00:38 <Lazersmoke> tree@(Node left (Unknown _) right)
00:38 <amIaName> But what if it is a leaf?
00:38 <Lazersmoke> then have another pattern that is just Leaf
00:38 <Lazersmoke> like "insert message Leaf = ..."
00:39 <Lazersmoke> or if it doesn't matter if its a leaf or not a leaf, then just do "insert message tree = ..."
00:39 <Lazersmoke> follow?
00:40 <amIaName> It doesn't matter if on the second layer is a leaf or a node
00:41 <amIaName> That's what I'm hoping for at least
00:41 <Lazersmoke> when you use an @-pattern, you still need to specify the data constructor
00:42 <Lazersmoke> when you write "tree@(left (LogMessage _ timeStampTree _) right)", it doesn't know you are talking about a Node
00:42 <Lazersmoke> tree@(Node left (LogMessage _ timeStampTree _) right)
00:42 <Lazersmoke> ^ this is the correct way to write what you intend
00:43 <amIaName> Oh! I completely misunderstood what you were saying. I though you meant applying node on the left, which would mean putting it on the right too
00:44 louispan joined
00:44 Rizy joined
00:47 <amIaName> Thank you for your help. This now works correctly
00:48 prophile joined
00:51 takle joined
01:01 freeside joined
01:02 takle joined
01:11 takle joined
01:23 notarobot joined
01:30 MotherFlojo joined
01:30 Levex joined
01:33 jrm joined
01:48 Youmu joined
01:53 tolt left
02:02 takle joined
02:08 louispan joined
02:13 <mounty> What's the correct import to obtain nominalDay :: NominalTimeDiff ? https://hackage.haskell.org/package/time- says it exports it but it lies.
02:14 <mounty> ScorePost.hs:28:50: error:
02:14 <mounty> Module ‘Data.Time.Clock’ does not export ‘nominalDay’
02:14 <mounty> It appears to be in an 'Internal' package but that's presumably not the official/portable way to get it.
02:15 <mounty> And yes, I know 86400 but I want it to be portable.
02:15 <geekosaur> make sure youy have that actual version of the time package
02:17 <MarcelineVQ> if you're using stack the latest time on an lts is only note however https://hackage.haskell.org/package/time-
02:18 <mounty> geekosaur: I'm relying on cabal to pull in the package. Obviously I don't so I suppose the question is: where is nominalDay officially declared now? I know about that Internal package but surely that's not for general use?
02:18 <mounty> If I try to import the internal package:
02:18 <mounty> ScorePost.hs:29:1: error:
02:18 <mounty> Failed to load interface for ‘Data.Time.Clock.NominalDiffTime’
02:18 <mounty> Use -v to see a list of the files searched for.
02:18 Zialus joined
02:19 <MarcelineVQ> it's declared in that internal package and exported from the package named in the docs you linked, it's quite new though so be sure to check you have the same version as geekosaur mentioned
02:19 <geekosaur> I don't know where the version you are usin g defines it, because I don't know what version you are using
02:20 <geekosaur> if you are not using then the documentation does not reflect what you have available, and in whatever version you have the Internal module might well be the only place it exists
02:20 <mounty> I'm using a cabal sandbox. I'm trying to find out now what version it has pulled-in.
02:24 conal joined
02:24 <* mounty> bangs head on wall.
02:24 <mounty> The version information must be somewhere.
02:25 <mounty> find .cabal-sandbox/* -type f ! -name '*.dyn_hi' ! -name '*.hi' | xargs grep -w Data.Time.Clock
02:25 <mounty> returns only binary files.
02:25 <geekosaur> I think there's a .cabal-sandbox/lib with separate directories for each package it installed, named by the package name+version?
02:26 <geekosaur> you can reconstruct it from the binaries the way you tried *but* you need to be able to read z-encoding :)
02:26 <MarcelineVQ> cabal sandbox --help says you can write cabal sandbox hc-pkg list dunno what that'll display though
02:28 <MarcelineVQ> looks like it'll have two sections, the libs your ghc has and the libs in the sandbox
02:29 <MarcelineVQ> iow cabal sandbox hc-pkg list | grep 'time' should let you know what time you have, and if it lists two I'd expect it's the latter
02:30 <mounty> Thanks geekosaur and MarcelineVQ: time-
02:30 <mounty> I don't really know cabal that well but getting everything up to date is a pain right? I don't mind blowing it away and restarting, as it's a sandbox.
02:31 <geekosaur> you might just need to `cabal update`, then blow away .cabal-sandbox and try again
02:32 <geekosaur> but if something you use depends on the older time, that won't work and you may have to use the internal symbol
02:32 <MarcelineVQ> it might just use the one that comes with his ghc, start by specifying the version of time you want in your .cabal file at lesat
02:32 <MarcelineVQ> *at least
02:32 <geekosaur> ^
02:32 <MarcelineVQ> really though if you just want nominalDay this is not necesary :> my link earlier was to point out that the definition for it is just: nominalDay = 86400
02:33 <MarcelineVQ> it's good to work with cabal though so I'm not trying to dissuade you if you're wanting to
02:33 <mounty> I'm happy to blow it away and restart. I can get on with other things while it does it, such as doing a stack build on another VM.
02:35 <mounty> I build with cabal on Gentoo Linux and stack on CentOS.
02:35 <mounty> That of course has its challenges. Stack reports:
02:36 \Mike joined
02:36 <mounty> Not in scope: type constructor or class ‘Yesod.PersistQueryRead’
02:36 <mounty> Perhaps you meant ‘Yesod.PersistQuery’
02:36 <MarcelineVQ> is this the same project? you don't use a cabal sandbox with stack :>
02:36 <mounty> That code was fine on Gentoo+cabal.
02:37 <mounty> MarcelineVQ: it is the same project. I use the sandbox on Gentoo but .stack-work on CentOS.
02:37 takle joined
02:37 <mounty> I use symlinks to keep the built stuff separate on the separate machines.
02:37 <MarcelineVQ> hmm sounds complicated, but if your versions are fully specified in your .cabal file I guess it would work out
02:38 <mounty> It seems to work alright. For example: .stack-work -> /var/tmp/mounty/JackRose/stack-work
02:38 Decoy__ joined
02:38 <mounty> .cabal-sandbox -> /var/tmp/mounty/JackRose/sandbox
02:38 <MarcelineVQ> complete side-note curiosity, what are you wanting to use nominalDiff to do?
02:38 <MarcelineVQ> *nominalDay
02:38 <mounty> Well it's a bit involved. Do you know anything about flashcards and spaced repetition software?
02:39 <MarcelineVQ> Not a bit but now I'm interested
02:39 <MarcelineVQ> actually maybe I do, you mean like learning flashcards?
02:39 <mounty> Yes, I do.
02:39 <MarcelineVQ> I've used Anki some
02:39 <mounty> I use Anki myself.
02:40 <mounty> So the first time a card is presented, the software has no prior knowledge of how you've scored so it doesn't have enough information to re-schedule the card.
02:40 <mounty> So I just schedule one day * (your score / 4)
02:40 <mounty> (based on a score of 0 .. 5)
02:41 <mounty> https://github.com/mounty1/JackRose for more.
02:41 <mounty> The scoring/rescheduling is that last little piece that makes the software basically usable.
02:42 <MarcelineVQ> utc tracks the day but you'd like to use something like nominalDay so that it's straightforward to decrement to the next interval?
02:42 <mounty> It's nothing like as sophisticated as Anki yet though.
02:42 <mounty> MarcelineVQ: sorry; I don't really understand what you mean.
02:43 <mounty> I should explain that JackRose uses a 'continuous time' spacing algorithm; it calculates spacing in terms of seconds; not days.
02:44 <mounty> So if you give yourself 4/5 on the first scoring of an item, it sets the next review to 86400 seconds.
02:47 <MarcelineVQ> :>
02:47 mthek joined
02:49 <mounty> Rats; did a stack update but I still have that Yesod.PersistQueryRead problem.
02:49 <MarcelineVQ> have you specified the specific version of persistent to use?
02:50 <mounty> IIRC newer versions of Persistent distinguish between read and write access for greater safety and it looks like the newer version hasn't made it to stack's suppository yet.
02:50 <MarcelineVQ> this is quite important when working accross multiple tools, especially since stack relies on resolvers to pick versions if you don't tell it otherwise
02:50 <mounty> No; I just rely on stack to use the latest.
02:51 <MarcelineVQ> 2.5 is the earliest version with PersistQueryRead
02:53 <mounty> OK, so stack.yaml says "resolver: lts-6.27"
02:53 <mounty> Presumably I should try something a bit more bleeding-edge to get Persistent 2.5 ?
02:54 <MarcelineVQ> 7.0 and newer
02:54 <mounty> resolver: lts-7.0 ?
02:55 <mounty> "Downloading lts-7.0 build plan"
02:55 <MarcelineVQ> yeah https://www.stackage.org/diff/lts-6.30/lts-7.0
02:55 <mounty> here we go ...
02:56 <mounty> Meanwhile back on Gentoo/cabal: Module ‘Data.Time.Clock’ does not export ‘nominalDay’
02:56 <MarcelineVQ> Did you specify the version that has nominalDay in your .cabal file?
02:56 <mounty> I think I stuffed up. I deleted my cabal.sandbox.config
02:57 mthek joined
02:57 <mounty> cabal sandbox init again ?
02:57 <MarcelineVQ> cabal sandbox init should make one of those
02:57 liam_ joined
02:57 <Guest9155> is there an HTTP lib that's built in to Haskell or do i need to go download something?
02:59 <MarcelineVQ> Guest9155: there's a lot of options for http libs, I'd try asking in #haskell where they may have good opinions on what's easy to start with
02:59 <geekosaur> there is little "built in"
02:59 <geekosaur> the compiler ships with the minimum it needs to provide full compile functionality including TH etc. it is *not* batteries-included, and the community decided it hated batteries-included.
02:59 <geekosaur> so yes you must download something
03:03 <Guest9155> okay so i found this and it looks good https://github.com/haskell/HTTP and i have an app created by stack
03:03 <Guest9155> what do i put where in i assume my .cabal file? to get it
03:04 <Guest9155> wait
03:04 <Guest9155> i think i got it
03:04 <Guest9155> just HTTP in the build-depends section?
03:04 <Guest9155> look at that, Haskell isn't that hard
03:06 moei joined
03:06 <MarcelineVQ> good job, note that isn't the github version you have but will be one of the versions from http://hackage.haskell.org/package/HTTP that's linked at the top of that page you linked
03:07 <Guest9155> yeah I was confused by it being imported in examples as Network.HTTP but having to add just "HTTP" to the cabal file
03:08 <Guest9155> does using a function that has an IO return type mean everything that calls it has to be "IO"?
03:09 louispan joined
03:10 <geekosaur> Guest36413, it can have a MonadIO constraint but then you use liftIO to evaluate it
03:10 <geekosaur> otherwise yes
03:15 smwangi joined
03:16 MotherFlojo joined
03:17 hphuoc25 joined
03:18 hphuoc25 joined
03:21 takle joined
03:23 <mounty> Coming back to building with cabal on Gentoo, I rmed .cabal-sandbox and cabal sandbox init
03:24 <mounty> after cabal install, cabal sandbox hc-pkg list | grep time
03:24 <mounty> gives time-
03:24 <mounty> How can I get it up to 1.8?
03:25 <mounty> I don't see any reference to a resolver or similar concept in cabal.sandbox.config
03:29 cschneid_ joined
03:31 louispan joined
03:34 <geekosaur> that would imply you have a dependency that wants that version
03:34 <geekosaur> there is no resolver; that's a stack thing
03:35 <geekosaur> what's your cabal file look like?
03:35 <mounty> So some other package is requiring time <= 1.6 ?
03:35 <geekosaur> @paste
03:35 <lambdabot> Haskell pastebin: http://lpaste.net/
03:35 <mounty> I'll use pastebin if you don't mind because I have an account.
03:35 <mounty> Do you mean cabal.sandbox.config ?
03:36 <geekosaur> no, I mean the cabal file
03:36 <monochrom> *.cabal
03:36 <geekosaur> foo.cabal that specifies your dependencies and potentially versions thereof
03:36 <monochrom> pastebin wastes vertical space. It almost double-spaces your code.
03:37 <geekosaur> (for "foo" being whatever you used, which might be named after your project or not)
03:37 <monochrom> I would use pastebin for submitting my PhD thesis because the school requires it to be double-spaced. That's how helpful pastebin is.
03:37 <mounty> http://pastebin.com/pk3zhLr8
03:37 takle joined
03:38 <mounty> OK monochrom but my life is already too complicated and as you can see, I paste stuff other than Haskell source.
03:39 <mounty> (at least, I assume you can see that)
03:39 mac10688 joined
03:39 <mounty> No explicit version numbers specified there.
03:40 liam_ joined
03:40 <monochrom> It may still choose 1.6 because you already have it from GHC.
03:41 <mounty> You mean the constraint is wired into GHC ??? I'm on 8.0.2 on Gentoo.
03:41 <geekosaur> if it has a package and there's no other reason to download one, yes
03:41 <monochrom> I don't mean wired. I mean no reason to do extra work. I mean laziness.
03:41 <geekosaur> otherwise you can try specifying time == in your dependencies
03:42 <monochrom> To be fair I am not completely sure, there was a time cabal would aggressively bring in newest versions.
03:43 systemfault joined
03:43 takle joined
03:45 <mounty> So it's just down to a policy setting? Like conservative/LTS/bleedingEdge/reckless ?
03:45 eacameron joined
03:46 <monochrom> But there is no policy setting.
03:47 <geekosaur> no policy setting, it used to default to latest but now defaults to installed so it's less likely to trash your package db in non-sandboxed ode
03:47 <geekosaur> *mode
03:48 <geekosaur> (ghc has ... odd notions of how dependencies work. or rather, they make perfect sense for what ghc is doing under the covers, but everyone conditioned by C libraries expects something different)
03:50 exferenceBot joined
03:50 <mounty> trying: HDBC- (user goal)
03:50 <mounty> next goal: JackRose (user goal)
03:50 <mounty> rejecting: JackRose-0.8 (conflict: HDBC => time==, JackRose => time>=
03:51 <mounty> Backjump limit reached (currently 2000, change with --max-backjumps or try to run with --reorder-goals).
03:51 <mounty> So it looks like HDBC is keeping the version of time down.
03:51 <mounty> I don't really understand why, when I only just rmed .cabal-sandbox and cabal sandbox init again, it's not pulling the latest stable versions of all packages.
03:53 <mounty> Trying cabal update outside the sandbox, in response to geekosaur's comment "it used to default to latest but now defaults to installed so it's less likely to trash your package db in non-sandboxed code".
03:53 <monochrom> When you rmed .cabal-sandbox and cabal sandbox init again, did that get rid of HDBC? How do you know?
03:54 <mounty> If you rm .cabal-sandbox, you get rid of all built packages, n'est-ce pas?
03:54 hexagoxel joined
03:54 <mounty> Surely?
03:54 <geekosaur> that was my suggestion, and no I am not completely certain --- but I don't recall where the ghc package db goes in a sandbox and I don't currently have any (populated) sandboxes
03:54 <monochrom> If you are asking me, you don't know.
03:54 <geekosaur> you still likely have the package db entries
03:55 <geekosaur> ghc's package db and cabal's package libraries are two different things
03:55 <geekosaur> one should point to the other, but they're distinct and managed separately. (but i would have expected the package db to be in .cabal-sandbox...)
03:55 <mounty> Surely if you're using a sandbox, the global cabal stuff (in my case, at $HOME/.cabal) is ignored?
03:56 <geekosaur> yes
03:56 <monochrom> To be fair, I don't know either, but I don't use sandboxing, and I am not running into problems.
03:56 <geekosaur> but that is user, not global
03:56 <mounty> True.
03:56 <mounty> Hmm.
03:56 <geekosaur> the truly global stuff is likely to be in /usr/lib/ghc-<version> ad you can;t and indeed must not ignore that, because you need base from it
03:56 <* mounty> scratches head.
03:57 <monochrom> The two high-probability scenerios I know are:
03:57 <monochrom> 1. You have HDBC in global. You got it from Gentoo?
03:58 <monochrom> 2. Your HDBC is just in the sandbox but it was built before you said "time 1.8"
03:59 <monochrom> There may be other scenerios I don't know of, of course.
03:59 <mounty> Just finding out. Some packages do come from Gentoo because it pulls them in to build cabal-install.
03:59 <mounty> find /usr -iname '*HDBC*'
03:59 <geekosaur> you might be better off using stack if you've got distro package manager libraries installed in ghc's global db --- they WILL mess with your builds
03:59 <monochrom> But HDBC would not be one of them. HTTP sure.
03:59 <mounty> Can't use stack on Gentoo.
03:59 <geekosaur> (don;t do that. but if you have already done it, you need stack's idea of sandboxing --- which involves beating ghc over the head)
04:00 <monochrom> I thought it didn't beat GHC. (No one could.) I thought it simply downloaded one more GHC.
04:00 <mounty> If I could use stack on Gentoo I would. Better to have one build system on all platforms, obviously.
04:00 takle joined
04:01 <monochrom> Err OK I guess they could use a GHC feature to say "ignore global, use mine instead".
04:02 <mounty> So now that I've constrained time >= can I tell cabal sandbox to pull HDBC etc. to be consistent with that?
04:05 <geekosaur> recent enough ghc has something like that. earlier versions it has to do evil things to make ghc use stack's global db instead of its own
04:06 <mounty> Just flicking back to my stack build for a moment. https://www.stackage.org/diff/lts-6.30/lts-8.5 which is the newest version still constrains time to
04:07 <geekosaur> then I think you're stuck with what it has
04:07 <geekosaur> meaning the internal module or use hardcoded (or locally defined) day constant
04:08 <mounty> I think so too. Thanks geekosaur, monochrom and MarcelineVQ for your help again.
04:17 faberbrain joined
04:25 takle joined
04:29 samangan joined
04:31 liam_ joined
04:32 takle joined
04:36 gfixler joined
04:43 takle joined
04:46 uglyfigurine joined
04:50 aniketd joined
05:05 takle_ joined
05:11 lithie joined
05:11 cschneid_ joined
05:13 moei joined
05:18 takle joined
05:19 faberbrain joined
05:20 howdoi joined
05:24 takle joined
05:29 <zipper> Hello, so last night I had an issue with writing pure for `newtype Compose f g a = Compose {getCompose :: f (g a)} deriving (Eq, Show)` and you guys said the solution was in f and g having applicative instances
05:29 <zipper> I still haven't figured it out.
05:31 <Cale> Should just be using pure twice, once for f and once for g
05:31 <Cale> (and then wrapping up the result)
05:32 MotherFlojo joined
05:32 <zipper> Cale: I thought of that but f and g won't be in scope
05:33 <zipper> and if I pass them it stops being `pure :: a -> Compose f g a`
05:33 <kadoban> zipper: 'pure' is definitely in scope
05:33 <zipper> f and g won't be in scope
05:34 <zipper> `pure a = Compose $ pure f ((pure g) a) `
05:34 <zipper> `pure a = Compose $ \f g -> pure f ((pure g) a) `
05:34 <kadoban> Yes, there are no values named f and g. They are types
05:34 <zipper> breaks the type sig
05:34 <zipper> They are functions
05:34 <zipper> hmmmm
05:35 <zipper> pure and pure are also functions
05:35 <zipper> I get you
05:35 <zipper> `pure a = Compose $ pure $ pure a`
05:35 <kadoban> Very nice :)
05:35 <zipper> so pure will be f and g
05:35 obh15 joined
05:35 <zipper> kadoban: Thanks
05:36 <obh15> can someone enlighten me what is resolver in stack?
05:36 <zipper> I have been off the book for like 5 weeks, picking up where I left off.
05:36 <kadoban> Yeah, 'pure' is polymorphic, so it'll be the one for f's intstance of Applicative and the one from g's instance of Applicative
05:36 <zipper> obh15: What do you mean? It helps stack figure out your depends.
05:36 <kadoban> obh15: A resolver is a set of packages and their exact versions.
05:36 <zipper> *dependencies
05:36 <zipper> WOW I didn't know that
05:37 <kadoban> https://www.stackage.org/lts-8.5 is an example
05:38 <obh15> so in lts haskell 8.5 there's a package named abstract-deque with version 0.3 ?
05:38 <obh15> to resolve something like that
05:38 <obh15> what about if I want to use another version that isn't included in the resolver
05:38 <kadoban> In lts-8.5, yeah that package has that version
05:38 <kadoban> Then you add an "extra-dep" which specifies a package and a version
05:39 <kadoban> It can either be a new package that's not in the resolver, or you can override the version of one that was already in there.
05:39 <obh15> Sorry for asking for that, I was a bit confused, about it
05:39 <kadoban> But once you start adding extra-deps, you end up a little on your own, in that it's not guaranteed to all work together. The "lts" and "nightly" resolvers are useful starting places because they're curated and tested to actually at least compile together in one set
05:40 <kadoban> Adding extra-deps is normal though
05:40 <obh15> kk
05:40 <kadoban> No need to apologize, it can be more than a little confusing.
05:40 <zipper> obh15: No need to be sorry for asking :)
05:40 <obh15> I was confused since i've never heard about something like resolver in another package manager of a language
05:41 <obh15> since you can just drop a package and its version and expect it to work
05:41 <obh15> thanks!
05:42 <zaquest> do they release lts every week? i just switched to 8.3 and to 8.4 in couple days after that and it turns out there's already 8.5 for 3 days
05:45 <kadoban> I'm not sure what the actual schedule is, it seems fairly hard to predict to me
05:45 exferenceBot joined
05:45 takle_ joined
05:49 <zipper> If I have a type f g (a->b) and f g a with fmap I would need to compose fmap twice to apply a -> b to a
05:49 <zipper> How would the same be done with Applicative?
05:52 <zipper> Oh wait fmap and pure kinda serve the same purpose
05:52 <zipper> Well no
05:52 <MarcelineVQ> <*> is more like fmap than pure is
05:56 takle joined
06:00 <zipper> f -> g -> (a -> b) and f -> g -> a, one <*> will only achieve g -> (a -> b) -> g a.
06:00 <zipper> Which makes no sense
06:06 <zipper> Which is just asking for another <*>
06:06 <MarcelineVQ> give it a try
06:09 <zipper> MarcelineVQ: I can see the types in my head but I can't get the syntax right. idk if that makes sense.
06:09 <zipper> I can see I need to apply <*> to the first result but
06:10 <zaquest> you have `cf :: f (g (a -> b))` and `ca :: f (g a)` since you only have Functor and Applicative instances for `f` and `g`, the best you can do to apply a wrapped function to a wrapped value is to use `<*>`. so you do `_ <*> ca`, now what is `_`, it should have type `f (g a -> g b)`, but you have only `cf :: f (g (a -> b))`, so you need to transform `g (a -> b)` into `g a -> g b` inside `f`, looks like a job for `fmap`, now you have `(_ <$>
06:10 <zaquest> cf) <*> ca` where `_` should have type `g (a -> b) -> (g a -> g b)` but this is a type signature of `<*>` for `g`, so: `((<*>) <$> cf) <*> ca`.
06:12 eacameron joined
06:13 uglyfigurine joined
06:13 eacameron joined
06:13 Pupnik joined
06:14 takle joined
06:16 <MarcelineVQ> you seem to be on the right track, note that `(_ <$> cf) <*> ca` is the same as `_ <$> cf <*> ca` it gets messy pretty quick with <*> and <$> I'd use liftA2 as a helper to write this which is liftA2 x y z = x <$> y <*> z
06:17 louispan joined
06:17 <MarcelineVQ> it's a good mnemonic you're lifting over f and lifting over g to apply (a -> b) to a
06:17 <zipper> Ok I like your thought process
06:17 <zipper> Which is working behind from the solution you want
06:20 takle joined
06:21 Prutheus joined
06:23 <MarcelineVQ> the question you end up with on the way is _what_ are you lifting, all we want to do is apply a function we already have to a value we already have, do you know of an function/operator for that?
06:26 takle joined
06:31 MotherFlojo joined
06:32 <MarcelineVQ> gotta go, keep plugging at it you've got the pieces :>
06:34 hexagoxel joined
06:34 uglyfigurine joined
06:36 MotherFlojo joined
06:36 <zipper> MarcelineVQ: fmap
06:36 <MarcelineVQ> simpler than that
06:37 <MarcelineVQ> if <*> is f (a -> b) -> f a -> f b and fmap is (a -> b) -> f a -> f b what
06:38 <MarcelineVQ> 's the next simpler thing after that
06:40 <lpaste_> MarcelineVQ pasted “zipper” at http://lpaste.net/353519
06:42 <zipper> The next simpler thing? that's just function application
06:42 <zipper> MarcelineVQ: `___ :: (a -> b) -> a -> b`
06:42 takle joined
06:44 moei joined
06:44 <MarcelineVQ> exactly right but we can't pass that around because it's syntactic, so we make a function to apply a function so it has a name :>
06:44 <MarcelineVQ> :t ($)
06:44 <lambdabot> (a -> b) -> a -> b
06:46 <MarcelineVQ> this is where the dollar you may see often is really useful, people tend to use it to avoid ( ) but it's usefulness is also in that it's a name and passable value for function application
06:47 <MarcelineVQ> so in the sense that for this problem you want to lift over f and lift over g to apply (a -> b) to a that fits ($) nicely
06:48 <MarcelineVQ> Hopefully that's more helpful than confusing :X those are all the pieces you need for the problem so good luck
06:50 ThomasLocke_ joined
06:50 ThomasLocke_ joined
06:52 ThomasLocke joined
06:54 takle joined
06:55 meandi_2 joined
07:00 gmg85 joined
07:00 takle joined
07:09 Decoy__ joined
07:14 eacameron joined
07:15 louispan joined
07:22 vaibhavsagar joined
07:24 takle joined
07:25 t0by joined
07:25 t0by joined
07:27 kritzcreek_ joined
07:31 <zipper> MarcelineVQ: Yes it really is. Just trying to juggle code at work with what you are saying :)
07:32 <zipper> I really appreciate you taking the time to break it down for me.
07:33 galderz joined
07:33 galderz joined
07:35 louispan joined
07:39 eacameron joined
07:40 uglyfigurine joined
07:55 uglyfigurine joined
08:03 thc202 joined
08:03 madjestic joined
08:04 wei2912 joined
08:06 mengu joined
08:09 takle joined
08:14 takle joined
08:15 louispan joined
08:20 uglyfigurine joined
08:21 prophile joined
08:33 louispan joined
08:38 ederign joined
08:44 hdeshev joined
08:45 zero_byte joined
08:46 takle joined
08:51 takle_ joined
08:54 eacameron joined
08:54 uglyfigurine joined
08:59 Miroboru joined
08:59 takle joined
09:07 eacameron joined
09:08 faberbrain joined
09:08 uglyfigurine joined
09:18 merijn joined
09:21 nacon joined
09:21 nacon joined
09:22 grdryn joined
09:23 Durz0 joined
09:28 takle joined
09:29 Miroboru joined
09:31 Levex joined
09:41 hexagoxel joined
09:43 uglyfigurine joined
09:53 trolling joined
10:02 Nik05 joined
10:03 takle joined
10:03 Rizy joined
10:08 eacameron joined
10:09 uglyfigurine joined
10:14 Pupnik_ joined
10:16 gregman_ joined
10:24 uglyfigurine joined
10:27 raduom joined
10:32 louispan joined
10:34 flounders joined
10:36 <Geekingfrog> How can I transform ExceptT String (Reader.ReaderT Int IO) Int Into something less specific using constraints like MonadIO m, MonadReader and the like ?
10:37 <Geekingfrog> Currently I have (MonadReader Int m, MonadIO m) => ExceptT String m Int but the compilers isn't happy
10:37 <Akii> The compiler suggests to use a certain language extension
10:38 <Akii> FlexibleContexts I think
10:39 <Akii> if not, just paste some minimal code on lpaste
10:40 eacameron joined
10:40 <Geekingfrog> I have this extension already. Let me setup a paste with a minimal example
10:41 takle joined
10:43 uglyfigurine joined
10:43 <Geekingfrog> Oh wait, I'm stupid. The type signature is fine.
10:44 <Geekingfrog> I have an issue with the implementation -_-
10:44 <Akii> :D
10:46 <Geekingfrog> Ah ok, if I use Control.Monad.Trans.Reader.ask that doesn't work. But Control.Monad.Reader.Class.ask does work.
10:46 <Akii> kinda makes sense
10:46 <Akii> idk I just use ClassyPrelude and most of the time the correct function is already imported xD
10:47 o`connor joined
10:52 thc202 joined
10:53 Levex joined
10:57 uglyfigurine joined
10:57 <Geekingfrog> I should really start trying using classy prelude
10:57 <Geekingfrog> I'm getting a bit tired to always import some basic stuff
10:58 <Akii> absolutely
10:59 <Akii> can only highly recommend it
10:59 <Geekingfrog> yet another thing to learn though.
10:59 <Akii> doesn't take much time
10:59 <Geekingfrog> And I really like qualified import
11:00 <Geekingfrog> Well, I was planning to refactor a few things today, might as well get the classy prelude
11:07 eacameron joined
11:10 faberbrain joined
11:10 louispan joined
11:19 Rizy joined
11:19 yellowj joined
11:21 harfangk joined
11:23 shayan_ joined
11:23 uglyfigurine joined
11:28 Miroboru joined
11:28 cschneid_ joined
11:36 uglyfigurine joined
11:39 nyuszika7h joined
11:43 snowcrshd joined
11:43 mengu joined
11:48 mengu joined
11:50 jorris joined
11:53 jomg joined
11:54 mengu joined
11:59 mengu joined
12:02 uglyfigurine joined
12:05 slomo joined
12:10 Decoy__ joined
12:15 meck joined
12:17 smwangi joined
12:18 Pupnik joined
12:28 Prutheus joined
12:29 Prutheus joined
12:36 raduom joined
12:37 Rodya_ joined
12:40 eacameron joined
12:42 Miroboru joined
12:44 ThomasLocke joined
12:46 nyuszika7h joined
12:46 Durbley joined
12:49 aarvar joined
12:51 Ayey_ joined
13:00 <tapirus> If I want to enter a multi-line command in ghci, I can surround it with :{ :}
13:03 <tapirus> however, when I do that, the prompt changes, to show all imported modules
13:03 <tapirus> e.g.
13:03 <tapirus> ghci> :{
13:03 <tapirus> Prelude Data.Maybe Data.List Control.Applicative Data.Function Control.Monad Data.Char Data.List.Split| do
13:04 <tapirus> The reason I'm using :{ :} is because I want to enter commands in a way that's more readable than separating them by semicolons, but with that prompt it sort of defeats the purpose....is there any way around this?
13:05 chlong joined
13:08 carlomagno1 joined
13:08 thc202 joined
13:09 zero_byte joined
13:11 Ferdirand joined
13:11 expo873 joined
13:12 faberbrain joined
13:12 mizu_no_oto_work joined
13:16 contiver joined
13:18 jorris joined
13:21 jmg joined
13:21 hexagoxel joined
13:22 <jmg> is there a vim plugin or ghci option that can watch a .hs file for changes and then reload it and run the last command?
13:25 mattyw joined
13:27 eacameron joined
13:27 yellowj joined
13:29 pbrant joined
13:32 eacameron joined
13:34 <jmg> oh I found this http://unix.stackexchange.com/questions/72086/ctrl-s-hang-terminal-emulator which is basically what I want to do
13:35 <jmg> whoops I meant this http://stackoverflow.com/questions/2782752/how-can-i-open-a-shell-inside-a-vim-window
13:36 <jmg> or actually this http://stackoverflow.com/questions/7705717/automatically-reloading-ghci-running-hlint-on-file-updates
13:36 <jmg> lol
13:36 mojjo joined
13:36 <Cale> you might find ghcid useful
13:36 Rizy joined
13:39 <Cale> the --test flag lets you specify an expression to run as GHCi would every time that a file in your project changes
13:39 eacameron joined
13:40 <jmg> yah this looks exactly like what I want
13:43 Gurkenglas joined
13:47 HaskellLord69 joined
13:49 <jmg> thanks Cale, this is working great
13:49 <Cale> Great :)
13:51 vaibhavsagar joined
13:51 <Cale> We use it pretty extensively where I work
13:51 <Cale> I often have two of them running, for the frontend and backend of one of our web applications
13:52 <Cale> and it's also good for regenerating CSS while working on the Haskell code that generates it :)
13:56 eacameron joined
13:57 skapazzo joined
14:06 yellowj joined
14:09 jorris joined
14:11 Levex joined
14:11 ederign joined
14:25 jrajav joined
14:25 ederign joined
14:34 myrkraverk_ joined
14:38 Levex joined
14:43 Rizy joined
14:51 cschneid_ joined
14:58 Ayey_ joined
15:01 Decoy__ joined
15:07 Ayey_ joined
15:07 liam_ joined
15:13 faberbrain joined
15:16 netheranthem joined
15:16 skeet70 joined
15:20 uglyfigurine joined
15:20 uglyfigurine joined
15:20 Ayey_ joined
15:52 Ayey_ joined
15:52 yellowj joined
16:06 freeside joined
16:06 hoffmeyer joined
16:07 Rodya_ joined
16:12 thc202 joined
16:15 conal joined
16:22 Deide joined
16:25 guampa joined
16:27 Levex joined
16:31 Levex joined
16:38 faberbrain joined
16:42 TCZ joined
16:43 Rodya_ joined
16:44 Ayey_ joined
16:46 pilne joined
16:48 <jmg> so If I have a type defined as newtype (Eq a, Fractional a) => PowSe a = PowSe [a]
16:49 <jmg> that basically beans I can have a PowSe of anything as long as it derives Eq and Fractional?
16:50 Levex joined
16:52 Ayey_ joined
16:53 mengu joined
16:56 jgertm joined
16:59 Ayey_ joined
17:02 jathan joined
17:06 <lpaste_> saylu pasted “applicative for Reader” at http://lpaste.net/353536
17:09 <Geekingfrog> I'm getting a Text from a network with the string "\163" (which correspond to "£"). Is there a way to display the £ symbol and not the escaped version ?
17:09 joncfoo joined
17:13 mthek joined
17:13 <geekosaur> Geekingfrog, don't use Show
17:13 <geekosaur> (depending on what is happening between reception and display, this may not be under your control though)
17:13 <Geekingfrog> Ah, you're right, that may just come from me displaying things in ghci
17:14 <geekosaur> use putStrLn in ghci instead of letting ghci do it (which will use show)
17:15 <saylu> Hey mates! I'm a bit confused about writing an applicative instance for Reader
17:16 <Geekingfrog> geekosaur: yes, you're right. I don't have the issue with putStrLn. Thanks.
17:17 Decoy__ joined
17:17 Ayey_ joined
17:24 <lpaste_> saylu revised “applicative for Reader”: “applicative for Reader” at http://lpaste.net/353536
17:24 <saylu> Ah! Got it working, though it's super ugly!
17:25 <saylu> I ended up writing this:
17:25 <saylu> Oops nevermind -- I'm going to look this up in docs to see the right way
17:26 <saylu> Well, I wrote:
17:26 <saylu> (Reader rab) <*> (Reader ra) = Reader $ \r -> (rab r) . ra $ r
17:26 <saylu> which would have been prettier as
17:26 <saylu> ` (Reader rab) <*> (Reader ra) = Reader (rab <*> ra)`
17:27 faberbrain joined
17:36 Ayey_ joined
17:36 jorris joined
17:42 Ayey_ joined
17:42 merijn joined
17:50 takle_ joined
17:53 Ayey_ joined
18:06 taksuyu joined
18:09 nil_ joined
18:10 uglyfigurine joined
18:16 <nil_> Is it at least informally true that if 'a' is an ArbitraryTypeclass then (e -> a) is also an ArbitraryTypeclass?
18:17 <glguy> no
18:17 <nil_> Counterexample?
18:17 <glguy> class Length a where length :: a -> Int
18:18 <nil_> Umm, instance Length a => Length (e -> a) where length = fmap length ?
18:18 <glguy> Eq, Ord
18:18 <glguy> no
18:20 <nil_> ...elaborate please?
18:20 <glguy> Your code doesn't typecheck, so it's not a valid instance
18:20 <glguy> and Eq and Ord and further examples
18:20 <nil_> Oh :)
18:22 rembo10 joined
18:23 dni- joined
18:25 Levex joined
18:35 Ayey_ joined
18:36 expo873 joined
18:38 Levex joined
18:40 freechips joined
18:42 takle joined
18:43 Prutheus joined
18:45 agates joined
18:54 TCZ joined
18:58 Levex joined
19:01 zero_byte joined
19:06 liam_ joined
19:09 freechips joined
19:09 nadirs joined
19:10 merijn joined
19:10 Ayey_ joined
19:19 Ayey_ joined
19:27 Ayey_ joined
19:38 vaibhavsagar joined
19:40 joncfoo joined
19:43 mwilly joined
19:44 jmg joined
19:44 malaclyps joined
19:46 malaclyps joined
19:57 snowcrshd joined
19:57 Decoy__ joined
20:01 t0by joined
20:01 t0by joined
20:03 Ayey_ joined
20:05 MotherFlojo joined
20:08 liam_ joined
20:11 kori joined
20:11 louispan joined
20:12 <kori> hey! this isn't 100% a haskell question, it's more like 50%. I'm implementing something similar to Maybe in scheme and I need help translating (Maybe:>>= (Just 10) (lambda (x) (Maybe:>>= (Just 5) (lambda (y) (/ x y))))) to Haskell to see if the behavior of that function is correct
20:12 <kori> it returns (Just (Just 2)) and that makes sense considering how bind was implemented but I'm not sure if that's analogue to how it works in Haskell
20:13 <kori> https://github.com/kori/monad-mandala/blob/master/maybe.scm the code is here
20:13 <kori> I tried (Just 10) >>= \x -> (Just 5) >>= \y -> x / y but that returns type errors I'm not sure how to solve
20:15 Ayey_ joined
20:15 mizu_no_oto_work joined
20:15 <glguy> > (Just 10) >>= \x -> (Just 5) >>= \y -> Just (x / y)
20:15 <lambdabot> Just 2.0
20:16 louispan joined
20:16 <lpaste_> saylu pasted “Reader Monad” at http://lpaste.net/353541
20:16 <saylu> Hey folks! I'm having some trouble with writing this. I'm trying to write an instance of monad for Reader
20:16 <geekosaur> at a guess the type errors had more to do with Fractional than Maybe
20:17 <kori> I see hmmmm
20:17 <kori> https://github.com/kori/monad-mandala/blob/master/maybe.scm#L21
20:18 <kori> so, should it be (f (Unwrap a)) here?
20:18 <kori> I thought about making Just "flattening" so (Just (Just (Just... a))) would return (Just a) but I saw that Just doesn't behave like that in haskell
20:19 skapazzo joined
20:19 <glguy> kori: http://hackage.haskell.org/package/base-
20:19 <geekosaur> are you missing the join part of bind, perhaps?
20:19 <glguy> This isn't the place to get help with Scheme, but if you need help understanding the Haskell, we can do that
20:20 <kori> glguy: yeah I'm aware this is kind of a mixed question
20:20 <kori> geekosaur: probably! I'm kinda constrained but i'm trying to work within those constraints
20:20 <glguy> Since you don't seem to understand how >>= works on Maybe in Haskell, that's a good place to start
20:21 <kori> glguy: I looked at the definitions
20:21 <kori> but that probably wasn't enough
20:22 <glguy> Yeah, if you don't understand what the definition means you might have some questions about what it does
20:24 <kori> glguy: I got confused because I thought >>= was supposed to return a monadic value every time, considering the type signature
20:24 <kori> so I decided to return (Just (f (Unwrap a))) instead of just (f (Unwrap a))
20:24 <kori> (this is going to get confusing fast)
20:28 <kori> well I think I know what to return now considering the example glguy gave above
20:28 <kori> thanks
20:28 skapazzo joined
20:30 <kori> Prelude> (Just 10) >>= \x -> (Just 5) >>= \y -> return (x * y)
20:30 <kori> Just 50
20:30 <kori> yeah
20:30 Ayey_ joined
20:35 c0dehero joined
20:41 MotherFlojo joined
20:42 joncfoo joined
20:42 <lpaste_> saylu revised “Reader Monad”: “Reader Monad” at http://lpaste.net/353541
20:42 <saylu> Got it!
20:43 <saylu> But I'm curious -- is this the "right" way to write this instance?
20:43 <saylu> Is there a cleaner way?
20:46 Ayey_ joined
20:47 Levex joined
20:50 justicefries joined
20:51 faberbrain joined
20:52 conal joined
21:02 MotherFlojo joined
21:05 Ayey_ joined
21:05 merijn joined
21:09 mizu_no_oto_work joined
21:11 <Gurkenglas> I think you don't need the first pair of brackets in line 6, and Data.Coerce could do the wrappery for you, leaving something like (>>=) = coerce $ \x f -> f x x
21:13 MotherFlojo joined
21:15 Ayey_ joined
21:18 contiver joined
21:21 peterbecich joined
21:22 conal joined
21:22 liam_ joined
21:36 jgertm joined
21:40 conal joined
21:43 takle_ joined
21:45 takle joined
21:46 Ayey_ joined
21:53 hiratara joined
21:54 thc202 joined
22:00 joncfoo joined
22:03 eacameron joined
22:11 sa11 joined
22:12 NoCreativity joined
22:13 MotherFlojo joined
22:15 skapazzo joined
22:16 louispan joined
22:17 fhoffmeyer joined
22:25 Uniaika joined
22:31 hiratara joined
22:37 Decoy__ joined
22:37 Ayey_ joined
22:41 mizu_no_oto_work joined
22:43 louispan joined
22:46 uglyfigurine joined
22:48 jathan joined
22:49 skapazzo joined
22:54 Rodya_ joined
22:56 conal joined
22:59 patbecich joined
22:59 RusAlex joined
23:00 jorris joined
23:10 emmanuel_erc joined
23:11 conal joined
23:17 geekosaur joined
23:18 fhoffmeyer joined
23:30 zero_byte joined
23:31 Ayey_ joined
23:33 eacameron joined
23:41 peterbecich joined
23:41 ali_bush joined
23:41 ali_bush joined
23:47 Rodya_ joined
23:53 vaibhavsagar joined
23:54 jorris joined
23:55 mwilly joined