<    April 2017    >
Su Mo Tu We Th Fr Sa  
 2  3  4  5  6  7  8  
 9 10 11 12 13 14 15  
16 17 18 19 20 21 22  
23 24 25 26 27 28 29  
00:00 darkr0ck3t joined
00:00 <jle`> that's my theory, as someone who has little knowledge of ghc parsing
00:00 <NemesisD> glguy: thanks for this! is this something that exists in the wild or do people write this up themselves
00:00 <glguy> NemesisD: The singletons package is the sledge hammer for this stuff
00:00 <glguy> I don't know what people do in the wild
00:00 danthemyth joined
00:01 <jle`> NemesisD: the singletons package actually has this built-in
00:02 <jle`> it has a Demote type family
00:02 <nshepperd> glguy: even 'instance (Demote x, Demote xs) => Demote (x : xs)' works for me
00:02 <jle`> it exports instances for all of the main types in Prelude
00:02 <NemesisD> yeah, i've heard of that one, i was a bit uncomfortable bringing in all that in a previous incarnation of this but i actually may end up with enough constructors that using the TH demotion stuff may be smart
00:02 <jle`> and it gives you TH that lets you generate instances for your custom type
00:02 <glguy> nshepperd: Good fix
00:04 <Welkin> jle`: Nei sik m sik gong gwong dung wa aa?
00:04 <jle`> for singletons, there's `type family Demote (x :: k) :: Type`, and `instance Demote (x :: Bool) = Bool`
00:04 <jle`> type families take implicit kind arguments for some reason
00:04 <nshepperd> λ> :t demote
00:04 <nshepperd> demote :: Demote v => proxy v -> *
00:04 <jle`> Welkin: ?
00:04 <nshepperd> poor ghci can't handle it :)
00:05 <Welkin> jle`: guess that answers it :P
00:06 <NemesisD> thanks for the recommendations folks, ill check out singletons!
00:06 <jle`> for what its worth, this demoting stuff is a part of what singletons was made for
00:06 <nshepperd> ah, I need to set -XPolyKinds for ghci to get the type sig right
00:07 <jle`> i used to try to do it all by hand too
00:07 <jle`> back in the old days
00:07 <glguy> demote :: forall b (a :: b) (proxy :: b -> *). Demote a => proxy a -> b
00:07 <jle`> i suppose there is some value in doing it by hand to help yourself understand it, to undersatnd that it isn't magic
00:07 <glguy> That's a type!
00:07 <jle`> hooray for type in type
00:07 significance joined
00:07 <glguy> the singletons package doesn't take advantage of this sweet TypeinType action
00:08 <glguy> at least afaik
00:08 <jle`> it does now actually
00:08 <glguy> oh, coool
00:08 <glguy> -o
00:09 <glguy> type Demote (a :: k) = DemoteRep k
00:09 <nshepperd> that's a interesting type signature indeed
00:09 Noldorin joined
00:10 <jle`> singletons has been taking advatnage of typeintype since soon after it was released
00:10 <nshepperd> it implies that the b that contains types, is the same thing as the b that contains values, not just some separate 'promoted' version of it
00:10 <jle`> mostly because the author of singletons was one of the people who implemented TypeInType
00:10 <nshepperd> which i guess is what TypeInType is all about?
00:11 filterfish joined
00:11 <jle`> one of the most satisfying results was the ability to make kindclasses
00:11 <jle`> ...or well, i guess they're typeclasses, heh
00:12 HugoDaniel joined
00:13 <jle`> a lot of singletons had "kind-classes" that were implemented using an ugly Proxy hack but now they'rvery natural and just normal typeclasses, which is nice
00:13 jdt joined
00:14 <nshepperd> couldn't you make kindclasses before?
00:15 darjeeling_ joined
00:16 ed1 joined
00:16 <barrucadu> Is there a good blog post or something on using singletons? It's one of those libraries which looks pretty interesting, but I have no idea what I'd use it for.
00:16 <jle`> i think there was some issue
00:16 <jle`> nshepperd: i have trouble now making them until i turn on TypeInType
00:17 <jle`> barrucadu: i have a blog series that uses singletons heavily, if you want
00:17 cpup joined
00:17 <jle`> barrucadu: but the singletons library itself has pretty good documentation
00:17 <barrucadu> jle`: That'd be interesting
00:17 zero_byte joined
00:17 <jle`> https://blog.jle.im/entry/practical-dependent-types-in-haskell-1.html introduces and uses singletons as a means to an end
00:18 <nshepperd> I can make a useless kindclass
00:18 <barrucadu> Thanks
00:18 <lpaste> nshepperd pasted “Useless kindclass” at http://lpaste.net/354416
00:18 <nshepperd> maybe the issue was that you can only make useless ones? :p
00:18 <jle`> nshepperd: huh hm
00:18 Lord_of_Life joined
00:19 nomicflux joined
00:19 <jle`> i wonder what the issue is
00:20 <nshepperd> one problem is that you can't put a Proxy k in that method signature to disambiguate the kind (because Proxy doesn't work for kinds)
00:20 <nshepperd> but that doesn't seem to be an impediment to anything
00:21 darkr0ck3t left
00:22 Jesin joined
00:23 <jle`> maybe can you not make associated types?
00:23 <jle`> that might have been the problem
00:23 Marumarsu joined
00:23 <jle`> hm
00:23 <glguy> You could make kind indexed type families before that
00:25 <glguy> Check out https://github.com/ekmett/hask/blob/master/old/src/Hask/Core.hs#L225-L233
00:25 path[l] joined
00:27 HugoDaniel joined
00:28 <jle`> hm, i wonder what was forcing singletons to use the Proxy hack before TypeInType then
00:29 benl23 joined
00:30 Lord_of_Life joined
00:39 ljc joined
00:43 hamishmack joined
00:46 des_ joined
00:46 darkSeid_ joined
00:52 hive-mind joined
00:53 dan_f joined
00:53 AX3L joined
00:53 dfeuer joined
00:54 anuxivm left
00:54 ed1 joined
00:55 takle joined
00:55 isidore joined
00:56 Boomerang joined
00:59 fizbin joined
01:01 Boomerang joined
01:02 <Sornaensis> hi does anyone here know what systems' programming is
01:04 e14 joined
01:04 <tippenein> it's a marketing term, imo
01:05 <geekosaur> generally kernel or core system services, as opposed to application services
01:07 <geekosaur> for the webapp-on-the-cloud set: systems programming is what makes the cloud exist
01:10 JeanCarloMachado joined
01:11 Xanather joined
01:14 e14 joined
01:16 ebsen joined
01:16 eschnett joined
01:17 ed1 joined
01:20 slack1256 joined
01:20 IanKelling joined
01:23 zcourts joined
01:26 HoierM joined
01:30 <Cale> Or for certain types of people, "not just proving theorems"
01:33 ed1 joined
01:36 filterfish joined
01:36 path[l] joined
01:36 filterfish_ joined
01:38 tmtwd joined
01:39 nomicflux joined
01:40 ed1 joined
01:43 <thimoteus> lol Cale
01:45 louispan joined
01:47 Wizek_ joined
01:47 xfix joined
01:49 IanKelling joined
01:53 ebsen joined
01:54 merijn joined
01:54 Supersonic112_ joined
01:54 markasoftware joined
01:56 latencyloser joined
01:59 raycoll joined
02:00 hucksy joined
02:02 bshelden joined
02:03 ertes joined
02:11 exferenceBot joined
02:11 SimpleL joined
02:11 raycoll joined
02:11 t7 joined
02:13 Jesin joined
02:15 ed1 joined
02:15 significance joined
02:15 hexagoxel joined
02:15 ed1 joined
02:16 tripped joined
02:17 sellout- joined
02:18 ed1 joined
02:18 ed1 joined
02:18 Rainb joined
02:19 mrjake joined
02:23 <mrjake> http://lpaste.net/354424 Anyone have any idea why accelerate-cuda isn't building?
02:24 infinity0 joined
02:24 Argue_ joined
02:25 Swizec joined
02:25 <geekosaur> probably because it's deprecated/unmaintained and accelerate changed in a way that broke it
02:25 <geekosaur> "__This backend has been deprecated in favour of accelerate-llvm-ptx.__"
02:25 Kundry_Wag joined
02:26 infinity0 joined
02:27 <mrjake> right, but accelerate-cuda is still a dependency of accelerate-examples...
02:27 <mrjake> should I just delete it from the .cabal file?
02:28 Goplat joined
02:28 e14 joined
02:29 mizu_no_oto_work joined
02:30 {emptyset} joined
02:31 <geekosaur> hm. hackage thinks the only 1.x accelerate release is and accelerate-cuda should still work with it. are you using accelerate from git?
02:32 TrazzleDazzle joined
02:32 <geekosaur> I expect removing accelerate-cuda from the accelerate-examples cabal file will just cause the examples to not build
02:32 <mrjake> nope, pulling straight from hackage
02:32 <mrjake> right
02:33 <geekosaur> your best bet might be to contact tmcdonell@cse.unsw.edu.au then
02:33 TrazzleDazzle left
02:33 inkbottle joined
02:34 <geekosaur> oh, this is https://github.com/AccelerateHS/accelerate/issues/335 Build failure with ghc-8.0.2
02:34 Destol joined
02:36 <mrjake> ahh ok. I googled but didn't find that.
02:38 mazeinmaze_ joined
02:39 benl23 joined
02:39 athan joined
02:45 ebzzry joined
02:48 baldrick1 joined
02:48 wei2912 joined
02:48 ed1 joined
02:49 ed1 joined
02:51 infinity0 joined
02:52 louispan joined
02:54 vaibhavsagar joined
02:54 meandi joined
02:55 tput- joined
02:58 suppi joined
03:00 danthemyth joined
03:03 permagreen joined
03:03 pera joined
03:04 tripped joined
03:04 mikecheck joined
03:04 verement joined
03:08 latencyloser left
03:09 verement joined
03:10 sellout-1 joined
03:10 HoierM joined
03:11 takle joined
03:13 latencyloser1 joined
03:13 Argue__ joined
03:14 JoshS joined
03:14 drostie-m joined
03:16 JeanCarloMachado joined
03:17 bshelden joined
03:18 tput- joined
03:19 raycoll joined
03:19 shane joined
03:23 lambda-11235 joined
03:23 HEGX64 joined
03:24 felixsch_ joined
03:24 AX3L joined
03:25 harfangk joined
03:28 path[l] joined
03:31 louispan joined
03:36 drbojingle joined
03:37 louispan joined
03:37 xall joined
03:37 <EvanR> :t (- 1)
03:37 <lambdabot> Num a => a
03:38 <EvanR> thats so annoying
03:38 <glguy> You can change it if you want to
03:38 <EvanR> oh?
03:38 perlnecrohacker joined
03:39 <glguy> Oh, I guess NegativeLiterals doesn't change that to be a subtraction
03:40 perlnecrohacker joined
03:40 <glguy> :t subtract 1
03:40 otto_s joined
03:40 <lambdabot> Num a => a -> a
03:41 perlnecrohacker joined
03:41 <EvanR> :t (+ -1)
03:41 <lambdabot> error:
03:41 <lambdabot> The operator ‘+’ [infixl 6] of a section
03:41 <lambdabot> must have lower precedence than that of the operand,
03:41 <glguy> (+ -1) :: Num a => a -> a
03:41 <EvanR> what
03:41 <glguy> Prelude Data.Word> :set -XNegativeLiterals
03:42 <EvanR> ah
03:42 <EvanR> i dont really understand why the default is to use negate
03:42 <EvanR> when the class has a fromInteger
03:42 <glguy> > (-0) :: Double
03:42 <lambdabot> -0.0
03:43 <EvanR> omg
03:43 <glguy> Prelude Data.Word> (-0)::Double -- 0.0
03:43 <glguy> with NegativeLiterals
03:43 perlnecrohacker joined
03:44 <* EvanR> checks to see if gustafson eliminated negative zero
03:45 perlnecrohacker joined
03:46 <EvanR> i guess so if he eliminated +/- infinity
03:46 mzf joined
03:46 perlnecrohacker joined
03:47 mzf joined
03:47 perlnecrohacker joined
03:49 filterfish_ joined
03:58 Marumarsu joined
03:59 fkurkowski joined
04:01 nepiktaz joined
04:04 lifter joined
04:06 <EvanR> > sin 1e300
04:06 <lambdabot> -0.8178819121159085
04:06 <EvanR> interesting
04:08 capuk joined
04:08 malakin1 joined
04:09 sleffy joined
04:09 ryxai joined
04:09 ryxai joined
04:10 jasondockers_ joined
04:10 ryxai joined
04:10 ryxai joined
04:11 significance joined
04:11 ryxai joined
04:11 WarmCookie joined
04:12 stolaruk joined
04:14 edvorg joined
04:16 <significance> Hey all! I've been trying for the past while to figure out how to implement `foldl :: (a -> a -> a) -> a -> [a] -> a`. The recursive case for foldr, i.e. `foldr f s (x:xs) = f x (foldr f s xs)`, was quick to figure out, but I can't seem to figure out the one for foldl. Any other hints I could work from?
04:17 <significance> My issue is that if I peel off x from (x:xs), I don't know how to make it associate to the left recursively.
04:18 adirsms52 joined
04:20 <glguy> Well, consider:
04:20 <glguy> > foldl f z [a,b,c]
04:20 <lambdabot> error:
04:20 <lambdabot> Ambiguous occurrence ‘b’
04:20 <lambdabot> It could refer to either ‘Debug.SimpleReflect.b’,
04:20 <glguy> ?undefine
04:20 <lambdabot> Undefined.
04:20 <glguy> > foldl f z [a,b,c]
04:20 <lambdabot> f (f (f z a) b) c
04:20 <glguy> See that (f z a) in there?
04:21 <significance> Ahh, let me give it one more shot -- thanks!
04:21 sanitypassing joined
04:23 texasmynsted joined
04:23 <significance> glguy: thank you! that did it :)
04:24 <glguy> We did it!
04:24 mda1 joined
04:24 brynedwards joined
04:25 sleffy joined
04:30 jdt joined
04:31 Noldorin joined
04:32 tolt_ joined
04:33 sleffy joined
04:33 sanett joined
04:41 badlands joined
04:42 drbojingle left
04:43 Qfwfq joined
04:44 wahrsagevogel joined
04:44 keemyb joined
04:45 jgertm joined
04:46 WizJin joined
04:46 spott joined
04:51 patrickmn joined
04:53 pmn joined
05:00 pmn joined
05:01 abh joined
05:08 <mrjake> What's the proper procedure for asking library maintainers to bump version bounds?
05:09 pmn joined
05:09 jgt1 joined
05:10 teggi joined
05:10 mzf joined
05:12 <edwardk> mrjake: a find getting a bottle of fine whisky delivered to your home to be a powerful motivator
05:12 <edwardk> mrjake: (true story, it even worked)
05:12 <mrjake> haha
05:13 <edwardk> if that is beyond your means simply begging and pleading upon bended knee might work
05:13 teggi joined
05:15 JoshS joined
05:16 soLucien joined
05:17 <significance> I read at this link (http://stackoverflow.com/questions/5889696/difference-between-data-and-newtype-in-haskell) that when newtype is used, the constructor is "erased" from the data structure, i.e. newtype Book = Book (Int, Int) means Book (Int, Int) will have the same representation as (Int, Int) internally.
05:18 <significance> Is the constructor literally just erased after typechecking?
05:18 <WarmCookie> significance: Correct.
05:19 {emptyset} joined
05:19 <significance> How would that work? The type Book has one field, but (Int, Int) has two
05:20 <Cale> significance: Well, pattern matching against the Book type constructor just turns into a no-op
05:20 <significance> Cale: ohh, like Book _ ?
05:20 <Cale> yeah, it doesn't force the evaluation of the scrutinee
05:20 <Cale> @let newtype Book = Book (Int, Int)
05:20 <lambdabot> Defined.
05:20 <Cale> @let data Tome = Tome (Int, Int)
05:20 <lambdabot> Defined.
05:20 <mrjake> edwardk: actually it's one of your libraries http://lpaste.net/354425
05:21 <Cale> > case undefined of Book _ -> 5
05:21 <lambdabot> 5
05:21 <Cale> > case undefined of Tome _ -> 5
05:21 <lambdabot> *Exception: Prelude.undefined
05:21 <significance> whoa, awesome!
05:21 <significance> thank you :)
05:21 <significance> so wait, what happens if we define Book with getInts (via record syntax)?
05:22 <Cale> Well, that's just syntax sugar, it defines a function for you
05:22 <edwardk> mrjake: linear-accelerate has been released. cabal update?
05:22 <significance> if we run getInts $ Book 3 5, wouldn't that become getInts $ (3, 5), which would be an issue?
05:22 <Cale> That doesn't typecheck
05:22 <edwardk> mrjake: we released it the day after they shipped all the accelerate stuff
05:23 <edwardk> mrjake: i love it when i get requests that don't require me to do anything.
05:23 <significance> @let newtype Book a b = Book { getInts (a, b) }
05:23 <lambdabot> Parse failed: Parse error: (
05:23 <Cale> newtypes are only allowed to have a single data constructor with a single field
05:23 <Cale> @undefine
05:23 <lambdabot> Undefined.
05:23 <Cale> @let newtype Book = Book { getInts :: (Int, Int) }
05:23 <lambdabot> Defined.
05:24 <significance> > getInts $ Book 3 5
05:24 <Cale> :t getInts
05:24 <lambdabot> Book -> (Int, Int)
05:24 <lambdabot> error:
05:24 <lambdabot> • Couldn't match expected type ‘Integer -> Book’
05:24 <lambdabot> with actual type ‘Book’
05:24 <Cale> :t Book
05:24 <lambdabot> (Int, Int) -> Book
05:24 <significance> > getInts $ Book (3, 5)
05:24 <lambdabot> (3,5)
05:24 <significance> > getInts $ (3, 5)
05:24 <lambdabot> error:
05:24 <lambdabot> • Couldn't match expected type ‘Book’
05:24 <lambdabot> with actual type ‘(Integer, Integer)’
05:24 <WarmCookie> significance: Only `data` can have multiple fields, and since they are algebraic, the constructor must be tagged for the sum types (otherwise you could accidently make a union).
05:24 <significance> So `getInts $ Book (3, 5)` works, but if we remove the Book constructor, we have `getInts $ (3, 5)`
05:25 <geekosaur> the type is erased *after* the typechecker; you need the Book constructor still
05:25 <significance> WarmCookie: ahh, thank you
05:25 <significance> geekosaur: But even if we typecheck first, wouldn't `getInts $ (3, 5)` still not make sense?
05:25 <WarmCookie> significance: This tag that exists at runtime isn't needed for newtypes.
05:26 ljc joined
05:26 <geekosaur> also the usual point of a newtype is to hide something (usually typeclass instances) about the original type, so you need the constructor to identify that you are using the newtype
05:26 eklavya joined
05:26 <edwardk> mrjake: don't let that stop the whisky delivery though ;)
05:26 <significance> Ahh, gotcha. Why I'd want newtype makes a lot of sense -- just how it's handled internally I'm wondering
05:27 <mrjake> edwardk: haha ok. just did cabal update but still not working... give me a minute
05:27 <geekosaur> so with data, you have a bunch of nested boxes <Book, <2-tuple <I# Int#> <I# Int#>>>
05:27 <significance> does it literally just delete the constructor (literally remove the string "Book") after typechecking, or does it handle the methods (like getInts) of newtypes specially as well?
05:27 <geekosaur> as the runtime representation
05:28 <significance> Sweet, following so far :)
05:28 <WarmCookie> edwardk: What's a good read on category theory? I'm getting acquinted with objects, morphisms, the laws, functors, categories of categories, but a lot of jargon and concepts are missing.
05:28 <geekosaur> the runtime representation for the newtype version omits the outer box. but the compile time representation still requires the box
05:29 <edwardk> WarmCookie: I gave a decently detailed response to that here: https://www.quora.com/What-is-the-best-textbook-for-Category-theory
05:29 <significance> WarmCookie: total noob here and haven't read it yet, but I've heard great things about CT for the Working Mathematician
05:29 <geekosaur> and if you go behind the compiler's back with something like unsafeCoerce, you can make the compiler think (3,5) is a Book (3,5) (but don't do that; types are there for a reason)
05:29 jmcarthur joined
05:29 <WarmCookie> edwardk: Much appreciated.
05:29 <significance> geekosaur: if we omit the outer box in the runtime representation, how would Haskell handle something like getInts $ Book (3, 5) internally?
05:30 Kundry_Wag joined
05:30 <significance> It would create the simplified runtime representation of Book (3, 5), right? But then how would it handle getInts?
05:30 <edwardk> significance: it becomes the identity function
05:30 <edwardk> after things desugar into core
05:30 <geekosaur> once you're past the typechecker, *all* types go away --- but the runtime representation still has constructor tags in it
05:31 <geekosaur> because you need to handle things like data Maybe a = Nothing | Just a, so a Maybe Int has to have a constructor tag (in ghc, 0 for Nothing and 1 for Just _)
05:31 <mrjake> edwardk: stack build says "WARNING: Ignoring out of range dependency (allow-newer enabled): linear-accelerate-0.2. accelerate-examples requires: >=0.3" Not sure why it's still trying to build version 0.2 ?
05:31 <Cale> WarmCookie: btw, I agree with Ed on this, Awodey's book is probably the best modern intro to CT
05:32 <significance> edwardk: ahh, sweet, thank you
05:32 <WarmCookie> Cale: I just placed my order :)
05:32 <significance> geekosaur: that makes a ton more sense -- thank you!
05:32 <edwardk> mrjake: guessing you probably installed linear-accelerate already, so cabal is trying to reuse the existing version of your dependencies?
05:32 <WarmCookie> Cale: I shall watch TheCatsters in the mean time.
05:32 <geekosaur> but with newtype, you are prevented from doing things that require the constructor tag and the runtime rep doesn't have one. so after typechecking you have getInts :: (Int,Int) -> (Int,Int); getInts = id
05:32 sanett joined
05:32 <edwardk> did you do this in a sandbox or dump crud all over your global install?
05:33 <significance> geekosaur: ohhhhh, gotcha. does the constructor tag just say that "we may have several constructors, so watch out
05:33 <geekosaur> except faster because ghc usually just eliminates the function entirely
05:33 <significance> "?
05:33 <geekosaur> partly. it also enables laziness
05:33 <mrjake> edwardk: that's probably true. Is there any way to avoid a full rebuild? I'm on a slooooow machine.
05:33 <geekosaur> because you don;t have the actual value in the box, you have a pointer
05:33 <significance> how so?
05:33 <significance> ohh, neato
05:33 <geekosaur> and the thing pointed to may not have been evaluated yet
05:33 <edwardk> mrjake: well, you can do all sorts of scary cabal install --force stuff
05:33 <thimoteus> edwardk: appreciate the quora link. i'm going through mac lane right now, any suggestions for what to pick up afterwards?
05:34 <edwardk> thimoteus: depends on if you make it clean through or if you bounce half way =)
05:34 <significance> why can't we do that with several constructors?
05:34 <geekosaur> but with a newtype, neither tag nor pointer so you don't have that extra level of laziness
05:34 osa1 joined
05:34 <significance> why don't we have a pointer for newtype but have one for data?
05:34 <Cale> If you're using nix, you can try sticking doJailbreak on things and seeing if that gets them to build :)
05:34 <thimoteus> edwardk: at the moment i'm enjoying lots of opportunities to do literally nothing except read, so i devote a few hours a day to it (literally nothing else to do)
05:35 <edwardk> thimoteus: anyways, i like Serge Lang's Algebra as a nice next step
05:35 cmr joined
05:35 cmr joined
05:35 <thimoteus> edwardk: thanks, i'll check it out :)
05:35 <edwardk> its about the same density as maclane, just about 10 times longer
05:36 <geekosaur> also, things can get more complex than this because you can mark fields as strict and then ghc will at higher optimization levels unpack them into the constructor, omitting the intervening pointer. but here things get complex, because it can't always do that
05:36 <edwardk> and it is kind of careful to introduce categorical analogues to the bits of algebra it introduces as it goes as i recall
05:37 <geekosaur> it needs to be able to determine the size of each chunk of memory, which is to some extent controlled by the tag (using the Maybe example, Nothing is just a Word# 0# but Just is Word# 1 followed by a pointer, so generally twice as large)
05:37 <mrjake> edwardk: I'll probably just do a full build, but I'll have the same problem with gloss-accelerate depending on accelerate- Looks like I'll have to ping that maintainer?
05:37 <significance> ohh, awesome -- thank you!
05:37 <geekosaur> and it needs to know where things are inside that chunk of memory, so there are limits to what it can omit when and still be able to manage memory properly
05:38 <significance> is the reason that pattern matching a newtype is lazy just a design choice?
05:38 <geekosaur> if you want the full story, the ghc Commentary and various Notes in the source code discuss all the details.
05:38 <geekosaur> er?
05:38 <significance> The reason that a case on `Book _` wouldn't evaluate the inside value
05:39 <geekosaur> it's not truly lazy in the case you are thinking of, it just knows it doesn't have to look because at runtime there is no Book constructor tag to be checked
05:39 <significance> Why aren't wildcards like that always evaluated "lazily" like that?
05:39 <edwardk> significance: anything in kind * in haskell is represented as some kind of object on the heap. that object is either a computation that will run and produce a data constructor, or a data constructor. newtypes are just a compiler trick to say 'hey look please don't make an extra level of indirection here for me' because data Foo = Foo Int -- is a either a
05:39 <edwardk> computation that'll yield a Foo Int or a tag that says "hey i'm constructor 0" followed by a pointer to the Int on the heap, which in turn is either a pointer to a computation that will return a number or a "I# 123#" for some primitive machine int
05:39 <geekosaur> whereas if it is a `data` then it has to look at least at the constructor tag, and will trip the `undefined`
05:39 augur joined
05:40 <geekosaur> it never looks at the wildcard
05:40 <edwardk> significance: newtype Foo = Foo Int -- on the other hand doesn't introduce the new level of indirection, its either a computation that will produce an integer, or an "I# 123#" constructor for some machine int
05:40 <geekosaur> it's only looking at the `Book` --- which for a newtype is a no-op because it doesn;t actually exist except in the mind of the typechecker
05:40 <geekosaur> but for `data` it exists at runtime as a constructor tag
05:40 <edwardk> with data Foo = Foo Int, you can have _|_, Foo _|_, or Foo (I# someactualmachineint)
05:40 <geekosaur> so it has to be checked
05:40 <significance> ahh, I sorta see
05:41 <edwardk> with newtype Foo = Foo Int, _|_ = Foo _|_, so its just two cases
05:41 <significance> but for instance if we match, say, `Just _`, why would the value _ be evaluated?
05:41 <edwardk> significance: it isn't
05:41 <significance> derp
05:41 <geekosaur> remember, in the example you brought up, we were not looking at a (Book undefined), but at an (undefined)
05:42 <significance> geekosaur: oh, you're right
05:42 <mrjake> edwardk: wait, what is up with these gloss-accelerate version numbers?,,, According to hackage website is the newest
05:42 <geekosaur> [08 05:21:08] <Cale> > case undefined of Book _ -> 5
05:42 <significance> now I get it, awesome -- thank you!
05:42 <edwardk> mrjake: http://hackage.haskell.org/package/gloss-accelerate
05:42 <edwardk> i see 1.9.00 there
05:43 <significance> If we have a value that matches Book, we know that it only has one constructor with one field, so we can pretty much skip past?
05:43 <edwardk> the base bound seems tight though
05:43 <significance> > case undefined of Just _ -> 5
05:43 <lambdabot> *Exception: Prelude.undefined
05:44 <significance> > case undefined of Book _ -> 5
05:44 <lambdabot> 5
05:44 <edwardk> mrjake: i have no idea what is going on with that package. you'd have to bug trevor
05:44 <edwardk> Explicitly deprecated versions for gloss-accelerate include:,,
05:44 <mrjake> edwardk: ok. as you can see version is bolded and seemingly the default. I'll bug him
05:44 <edwardk> i'm guessing there was some kind of snafu with the release?
05:45 <geekosaur> significance, no, the Book doesn;t actually exist so matching against just the Book part and having a wildcard for the field is a no-op
05:45 <significance> ah.
05:45 hamishmack joined
05:45 <geekosaur> but if you tried to inspect the value instead of matching with a wildcard, the undefined would explode
05:46 <edwardk> anyways explicit version deprecations don't work -- at least don't have an effect on cabal at last check, so he might have to go back and push a release of each to force them not to try to build
05:46 <significance> sorry I'm so slow at this -- what is it that the constructor tag declares?
05:46 <geekosaur> you could think of it as actually matching against _ _ instead of Book _ (but you can't actually do that)
05:47 <edwardk> looks like he should have just released as a 2.0 or something
05:47 <edwardk> but then screwed up
05:47 <mrjake> edwardk: thanks for all your help!
05:47 <edwardk> and pushed out a release with a lower version number than what is already on hackage
05:47 <mrjake> edwardk: yeah exactly
05:47 <edwardk> no worries, wish i could be more help, but i don't have accelerate installed
05:47 <edwardk> and i've only used gloss once for a quick demo
05:48 <geekosaur> in a single constructor situation it does nothing but be consistent so the memory manager knows what's going on
05:48 <significance> ahh, gotcha -- but because newtype ensures it isn't dereferenced, it doesn't have a constructor tag (?)
05:48 <significance> the constructor is just declared "in place" without a pointer?
05:48 baldrick1 joined
05:49 <geekosaur> (there are unboxed values though --- that's where the stuff I mentioned earlier with the #s appended came from --- and those are primitives that the memory manager knows about already. although that's a slight lie, you'd want to look up RuntimeRep in the ghc Commentary for the truth :)
05:49 <geekosaur> newtype is just a fiction of the typechecker
05:49 <geekosaur> beyond that it's just the field value
05:50 <geekosaur> no constructor tag, no pointer to the actual field value, just the field value itself and a note-to-self inside the typechecker to pretend that its type is actually different from that of the field
05:50 <significance> why don't the constructors for newtypes have the constructor tag?
05:50 <geekosaur> so that you can treat it differently, say by not mixing an Age with a Count. or so you can have both Sum and Product Monoids on Integer
05:51 <edwardk> significance: a newtype is just a pleasant fiction between you and the type checker. its used to help pick which instances will get selected. if we didn't have typeclasses all it'd do is prevent some things from typechecking
05:51 <edwardk> no runtime representation
05:52 <geekosaur> significance, what I just described is what newtypes are intended for. if you think about it, there's no need for any extra tagging or whatever, all there is is just a note to the typechecker to treat it as a distinct type
05:52 Jeanne-Kamikaze joined
05:52 <geekosaur> that's all a newtype does
05:52 mrjake left
05:52 <significance> don't types declared with `data` have constructors with the constructor tag?
05:52 <geekosaur> yes
05:53 <edwardk> data isn't a pleasant fiction between you and the typechecker, it actually creates some structure
05:53 <geekosaur> and data is used for more than what I just described for newtype, so it needs the tag
05:53 cmr joined
05:53 <edwardk> data Either a b = Left a | Right b -- there are two cases there. it has to know which you have
05:53 cmr joined
05:53 <significance> but if we don't have the constructor tag for newtype constructors, how does ghc know that we're talking about a constructor?
05:53 sanett joined
05:54 <significance> and not some other piece of data?
05:54 <edwardk> the 'constructor and pattern matching for a newtype 'constructor' become identity functions and optimize away
05:54 <glguy> significance: The types aren't needed at runtime
05:54 <geekosaur> I think maybe all this stuff about the typechecker is just soaring far overhead...
05:54 <edwardk> then it matches like it would on whatever the underlying type is
05:54 <glguy> significance: They're needed to generate code. Once that's done they can be forgotten
05:55 <edwardk> if we didn't have a typechecker, and were just in lisp or something you could pretend newtypes don't exist, and just write code using the 'guts' of the newtype, no operational overhead. newtype induces no operational overhead, but provides a new "type", not any new things on the heap.
05:56 <edwardk> its just guidance to the typechecker to pretend something is different
05:56 e_svedang joined
05:56 <edwardk> newtype Foo = Foo (SomeCrazyThing) at runtime is just SomeCrazyThing
05:56 sleffy joined
05:56 <significance> So (sorry, noob question) we typecheck, then optimize (stripping away newtype constructors) and finally run?
05:57 <edwardk> the act of typechecking compiles into a form where newtype constructors just don't exist any more
05:57 <jle`> hm, i wonder what was forcing singletons to use the Proxy hack before TypeInType then
05:58 hurkan joined
05:58 <edwardk> typechecking produces a sort of "core" program as a witness that it checked the type correctly, in that core all the code for picking out instances is elaborated, newtypes don't exist any more except as type manipulations, etc.
05:58 <jle`> oh sorry, accidentally sent an old message
05:59 <edwardk> we then do optimizations on the core, then compile that to another representation that we can run
05:59 <significance> so then wherever a Book (Int, Int) and a (Int, Int) are are treated the same, as the newtype optimization skips the extra layer of <Book, ...> ?
05:59 <jle`> significance: well, we write a program to compile, and the type system helps us ensure that the program we compile makes sense
05:59 <edwardk> significance: exactly
05:59 <significance> ahh, thank you all so so much
05:59 <jle`> the type system doesn't play a role in the actual compiled code
05:59 <edwardk> and newtypes aren't just an "optimization" in that they have different semantics than having that indirection
05:59 <jle`> it's just a tool for us and for the compiler to make sure that the programs we write make sense before we compile them
06:00 <significance> ahh. a lot of new stuff for me tonight :)
06:00 <significance> thank you so much for putting up with me!
06:00 Ferdirand joined
06:00 <edwardk> jle`: in a calculus a la curry thats true, we're a la church though -- our types guide instance selection so they change the semantics of your program, technically. without typeclass inference that statement is fully true though
06:00 cmr joined
06:00 cmr joined
06:02 baldrick1 joined
06:05 vlatkoB joined
06:07 xinming joined
06:08 hurkan1 joined
06:08 sanett joined
06:09 eklavya joined
06:10 t4nk932 joined
06:11 cmr joined
06:11 cmr joined
06:12 Gurkenglas joined
06:12 andyo joined
06:12 <t4nk932> Hello, does anyone have experience with running haskell in a serverless (azure functions, google cloud functions, AWS lambda) environments?
06:14 Rainb joined
06:15 baldrick1 joined
06:15 eklavya_ joined
06:17 xall joined
06:18 <glguy> You're more likely to get help asking your actual question
06:18 Lu joined
06:18 takuan joined
06:21 JeanCarloMachado joined
06:22 <t4nk932> How can I execute a Hello world haskell function in AWS lambda? ghcjs ? spawning a chile process from node https://github.com/abailly/aws-lambda-haskell? I would like to learn from someone who has done something similar.
06:22 <t4nk932> *child
06:22 Gurkenglas_ joined
06:24 Marqin joined
06:26 baldrick1 joined
06:26 AbelianGrape joined
06:28 <AbelianGrape> Anyone have any suggestions for why ByteStrings, which according to BS.length have length 20, are taking up 4kB of RAM *each*? This persists even using BS.copy and DeepSeq. I'm pretty befuddled
06:28 <brynedwards> t4nk932: Not me but here's a blog post that goes through it http://engineers.irisconnect.net/posts/2017-03-16-deploying-haskell-on-aws-lambda.html
06:28 SpinTensor joined
06:29 <cocreature> AbelianGrape: do you have some minimal example that shows this?
06:29 <cocreature> AbelianGrape: how are you measuring memory usage of individual bytestrings?
06:29 <AbelianGrape> cocreature: Give me a minute. I'm allocating 20,000 of them and storing them in various data structures (to rule out data structure overhead)
06:29 <AbelianGrape> And I'm using -hp to look at allocation types
06:29 <AbelianGrape> it's all PINNED
06:30 <AbelianGrape> goes away if I replace the bytestring with its hash
06:30 <cocreature> yeah PINNED is bytestring most of the time
06:31 <t4nk932> Thanks @brynedwards.
06:31 moet joined
06:31 Kundry_Wag joined
06:32 <moet> when using stack to build haddocks, it builds all the dependent packages.. it's crashing for me in the `gl` package with "too many files" .. how can i have it *just* build my current package and *not* the dependencies?
06:32 <moet> i've tried specifying the current package's name, but that still attempts to build the dependencie's haddocks first.
06:33 <moet> `--[no-]haddock-deps Enable/disable building Haddocks for dependencies`
06:33 <moet> nevermind.. didn't see this on my first look
06:35 BartAdv joined
06:35 raichoo joined
06:37 ner0x652 joined
06:39 ragepandemic joined
06:39 <AbelianGrape> cocreature: https://pastebin.com/R70qv9gN
06:40 <AbelianGrape> 20001 bytestrings, each 20 bytes long. Should come out to ~400k. But it's over 80 megs
06:40 ragepanda joined
06:40 <AbelianGrape> This is exactly what I'm doing in my real application btw
06:40 Croniamental joined
06:41 <AbelianGrape> I'm thinking maybe an FFI issue with the SECP library? But the memory leak does go away if I hash the bytestrings and then store them...
06:41 <cocreature> hash and store the original bytestring or store the hash?
06:41 <AbelianGrape> Is it possible that there's some finalizer on FFI-allocated data that's not being triggered as long as the bytestring is in scope, even after calling BS.copy?
06:41 <AbelianGrape> Just store the hash
06:41 <AbelianGrape> I wanted to rule out a plain old failure-to-free
06:41 pylbrecht joined
06:42 Welkin joined
06:42 bab joined
06:46 <cocreature> hm the code looks fine
06:46 <cocreature> I’m building haskoin to see if I can reproduce it
06:46 <AbelianGrape> Cool, thanks
06:48 <cocreature> gnah, I forgot to build with profiling enabled *rebuilds everything*
06:49 baldrick1 joined
06:50 hurkan joined
06:52 hive-mind joined
06:54 <ongy> note: ByteString has 2 Ints and a Ptr as management data, so slightly over 800k used memory should be expected
06:54 paulsh94 joined
06:54 mac10688 joined
06:54 <AbelianGrape> I'd be fine with that. But 100x that is no good
06:54 mikecheck left
06:55 shtuka joined
06:55 baldrick1 joined
06:56 AX3L joined
06:57 <shtuka> I have a question on https://hackage.haskell.org/package/mathgenealogy: I have installed it on Windows 10 via "cabal install mathgenealogy". When executing "mathgenealogy <URL>$, I get the error "mathgenealogy: Error - Couldn't find the 'dot' program. Did you install GraphViz?" graphviz and dot are installed. What should I do?
06:57 Netwolf joined
06:57 <ongy> shtuka: is dot in your PATH?
06:57 sleffy joined
06:59 pwnz0r joined
07:01 <shtuka> ongy: no, and I also cannot find a dot.exe on my hard disc
07:02 <Gurkenglas_> How do I copy a thunk, so that I can, say, traverse a list twice at different speeds, and trade off the space I would need to keep track of the elements until the second traversal for a need to compute them twice?
07:02 <cocreature> shtuka: did you install graphviz?
07:02 laz joined
07:02 <shtuka> cabal install graphviz ->All the requested packages are already installed:
07:03 yellowj joined
07:03 <AbelianGrape> Gurkenglas_: I think if you put the value on the RHS of a lambda constructor (i.e. replace foo = x with foo = \_ -> x) and then replace all instance of foo with "foo ()", it might recompute every time
07:03 <cocreature> shtuka: not the haskell package. you need to install http://www.graphviz.org/
07:05 <Gurkenglas> AbelianGrape, is there a way to do it if the value is only given as an argument? (Something smells second-class here)
07:06 <AbelianGrape> Gurkenglas: Don't know of any way to do that. Interesting use case though
07:06 pwnz0r joined
07:06 <AbelianGrape> Gurkenglas: In fact, I think it's impossible. It would break lazy IO
07:07 <AbelianGrape> (Not that lazy IO is particularly sturdy)
07:07 kdzd_m joined
07:07 <kdzd_m> hey all
07:07 <kdzd_m> allooooooo
07:07 steeze joined
07:08 <AX3L> Has anyone had problems with isEOF before? My program just seems to ignore Ctrl-D. I am running linux if that makes a difference.
07:10 <shtuka> cocreature: I installed graphviz. now mathgenealogy <URL> gives the error "Downloading entry number...1mathgenealogy: Error - Could not parse fetched data. Did you provide a valid URL to an existing math-genealogy entry?"
07:11 <cocreature> shtuka: I’ve never used that package, sorry. not sure what’s causing that
07:11 vlatkoB_ joined
07:11 <shtuka> ok
07:12 augur joined
07:13 <greister> data Aaa = Int Int Int ,I want to know Aaa is a type or value ?
07:13 Kreest__ joined
07:13 <cocreature> greister: that’s a syntax error :)
07:13 <AbelianGrape> greister: Your definition isn't right. You need a constructor on the right of the =
07:13 <AbelianGrape> data Aaa = Bbb Int In Int
07:14 <AbelianGrape> "Aaa" is a type. "Bbb" is a constructor, which is a function, which is a value
07:14 <AbelianGrape> Bbb :: Int -> Int -> Int -> Aaa
07:16 <greister> To define type constructor(Aaa) must have a data constructor,such as Bbb?
07:16 harfangk joined
07:16 <jle`> you only need a data constructor if you want it to have values
07:16 <jle`> it can't 'contain' anything without a constructor
07:16 <AbelianGrape> greister: jle` is correct. "data Void" is a valid data declaration. It has no constructors
07:17 <jle`> greister: so if you want to make a type that has three Int's, you need a constructor that contains three Ints
07:17 <jle`> s/contains/takes
07:17 <AbelianGrape> Also, usually you only use the phrase "type constructor" if your type takes arguments. For example, "data Foo a = ..." vs "data Bar = ...". People refer to Foo as a "type constructor", but not usually Bar
07:20 ircuser3 joined
07:20 <jle`> AbelianGrape: type constructor with no arguments are still called type constructors
07:21 <jle`> according to the haskell report
07:21 <jle`> just like how 'Nothing' is a data constructor
07:21 ogkloo joined
07:21 <jle`> https://www.haskell.org/onlinereport/haskell2010/haskellch4.html#x10-680004.2
07:23 dawehner joined
07:23 <MarcelineVQ> Gurkenglas: check out oneShot from GHC.Magic it may be worth experimenting with, alternatively you can possibly take advantage of the 'state hack' http://stackoverflow.com/questions/29404065/why-does-this-haskell-code-run-slower-with-o/30603291#30603291
07:24 <MarcelineVQ> hopefully I understood your question enough for those to be relevant
07:24 <cocreature> AbelianGrape: sorry I’m not sure what’s going on with your code.
07:25 orbifx joined
07:25 <AbelianGrape> cocreature: Oh well, thanks anyway
07:26 <AbelianGrape> jle`: That makes sense, but I've never heard it done at the type level.
07:26 eklavya joined
07:26 azahi joined
07:28 takle joined
07:29 <MarcelineVQ> note that it also allows you to call 0-arity type constructors 'type constants', but there's no real need to be that specific in general
07:32 zcourts joined
07:35 <ongy> will Nothing be pointer equivalent to another Nothing? There is no reason for it to exist more than once in Memory, is there? (I guess there's no reason for it to even exist once with the tagged pointer magic)
07:36 Welkin joined
07:36 <ggVGc> seems like a strange thing to worry about in haskell
07:37 <jle`> i believe in ghc, there is only one Nothing/()/etc. that exists at runtime
07:38 <ongy> ggVGc: still something I just wondered about :) And it does mather for STM
07:39 zeroed joined
07:39 zeroed joined
07:40 warlock joined
07:40 mooooooooo joined
07:40 mooooooooo left
07:44 chaosmasttter joined
07:44 plutoniix joined
07:45 cchalmers joined
07:45 <Gurkenglas> When following Usage at the bottom of https://github.com/viveksjain/live-haskell , I encountered http://lpaste.net/8247767724487344128 . What do?
07:46 _sras_ joined
07:46 <_sras_> is it possible to expose a submodule, like A.B, in stack?
07:47 <jle`> expose in what way
07:48 <jle`> and what is a submodule here? just a module that is nested two or more layers?
07:48 tctara joined
07:56 <jle`> (do you mean a hidden module?)
07:57 cchalmer_ joined
07:57 ubsan_ joined
07:58 <MarcelineVQ> Gurkenglas: that's no fun, is your stack version up to date?
07:58 AndreasK joined
07:58 uuplusu joined
07:59 hsk3 joined
08:00 <hsk3> Instead of this
08:00 <hsk3> (foo :: Int) <- myFunc
08:00 <hsk3> isn't it somehow possible to do
08:00 <hsk3> foo :: Int
08:00 <hsk3> foo <- myFunc
08:00 <hsk3> ?
08:00 <hsk3> (Put the type on a separate line.)
08:00 <Gurkenglas> MarcelineVQ, nope, lemme upgrade from 1.3.2 to 1.4.0
08:00 <jle`> it is not possible
08:00 <hsk3> Bummer
08:00 <_sras_> jle`: Just a regular module A.B. I want to use stuff from B to use from another top level package...
08:01 <jle`> _sras_: can you just import it?
08:01 <jle`> 'import A.B'
08:01 merijn joined
08:02 <MarcelineVQ> Gurkenglas: hmm that's fairly recent, it may be worth submitting a git issue for stack, possibly it's a windows problem and reporting it could help people
08:03 <_sras_> jle`: currently in my .cabal file, only one Module, App is exposed. I tried adding A.B to that list. But it does not seem to be working...
08:03 castlelore joined
08:03 castlelore joined
08:03 <jle`> what do you mean by not working
08:03 <jle`> can you provide a minimal example?
08:04 Xanather joined
08:04 <_sras_> jle`: Failed to load interface for A.B, while building the dependent package.
08:04 <MarcelineVQ> Gurkenglas: 1.4.* does handle setup depends differently so hopefully it'll help
08:04 <Gurkenglas> MarcelineVQ, upgrade didnt help
08:04 uuplusu joined
08:05 <jle`> _sras_: also, what is a 'top level package'?
08:05 <jle`> are you talking about a top-level module?
08:05 <cocreature> _sras_: is the module in exposed-modules in your cabal file?
08:06 <cocreature> or at least in other-modules if you are importing it from the same package
08:06 <_sras_> jle`: Oh. I think I got it. It is not in the dependent package's build dependency....
08:06 <Myrl-saki> Any idea on how to type a `Left -> Left' and `Right -> Right' without allowing `Left -> Right"?
08:07 cschneid_ joined
08:07 <_sras_> jle`: I have two separate packages that my main package depend on...
08:07 <geekosaur> Myrl-saki, you can't, if those are the usual Either constructors
08:07 <Myrl-saki> geekosaur: Of course
08:07 <jle`> ah i see
08:07 <Gurkenglas> MarcelineVQ, should I somehow cross-post https://github.com/viveksjain/live-haskell/issues/1 to stack or just run stack install ghci-ng in a new terminal on upgraded stack and copy the output there?
08:07 <jle`> _sras_: i don't think there is such thing as a top level backage
08:08 <Myrl-saki> geekosaur: But is it possible?
08:08 <geekosaur> since "you can't" was not clear: No, it is not possible.
08:08 <Gurkenglas> MarcelineVQ, note that the second part of the existing issue also misses some libpcre thing
08:09 <geekosaur> they are not distinct types, you cannot restrict their usage
08:09 stphrolland joined
08:10 <MarcelineVQ> Gurkenglas: I'll try building it (server) and see what happens
08:10 KongWubba joined
08:11 <Myrl-saki> geekosaur: I meant say, with an alternative type system.
08:11 <Myrl-saki> geekosaur: Or a refefinement of Either.
08:11 <Myrl-saki> redefinement*
08:12 oisdk joined
08:13 <geekosaur> you need someone with a better understanding of type systems to answer that
08:13 a3Dman joined
08:13 <Myrl-saki> geekosaur: Ah. Thanks anyway.
08:13 lep-delete joined
08:14 yellowj joined
08:14 <MarcelineVQ> Gurkenglas: try a manual ghci-ng build, stack unpack ghci-ng cd into it stack init and stack build
08:14 danthemyth joined
08:15 <Jinxit> let's say my data can either be One, Two, Three, etc (quite many), and each entry can be built using a subset of A, B, C (so perhaps One can be built using A or B, while Two can be built from A, B or C), what's a good way to represent this in haskell without allowing incorrect combinations?
08:16 <Rembane> Jinxit: I like the isValid-function-approach. Very simple.
08:17 <Jinxit> there are only 8 of (A, B, .. H) actually, but the (One, Two ..) has something like ~50-60 versions
08:17 <Jinxit> Rembane: but that would be runtime, yes?
08:17 <Myrl-saki> Rembane: Runtime check? :|
08:17 <Myrl-saki> geekosaur: How about dependent types?
08:17 <Myrl-saki> geekosaur: Either s a b -> Either s c d
08:17 <MarcelineVQ> Gurkenglas: bad news, I'm able to build either here so I can't trouble-shoot the issue on my end
08:18 <Myrl-saki> geekosaur: Where s states if it's Left or Right.
08:18 <Rembane> Jinxit, Myrl-saki: Runtime indeed.
08:18 benl23 joined
08:18 <Jinxit> static checking is what brings me to haskell :)
08:18 <Gurkenglas> MarcelineVQ, teamviewer?
08:19 stphrolland joined
08:19 <MarcelineVQ> nah I don't have anything like that
08:19 <Myrl-saki> Jinxit: Can you provide a concrete ecxample?
08:20 <Jinxit> well the problem is that i don't know how to represent it well, but i can try
08:20 <MarcelineVQ> I do find it ironic that this line appears underneath a giant Download button on the teamviewer website though "Allow someone to connect to your device without having to install any software." which brings you to a list of things to install
08:20 <Jinxit> i'll do it the dumb way just to show it
08:21 <Myrl-saki> Jinxit: Thanks.
08:22 <stphrolland> I'm puzzled by an error. Although I have added pipes and pipes-network to my build-depends section in the cabal file, stack cannot compile my code and says error: Failed to load interface for ‘Control.Proxy’. ANd when I check hackage, they are located inside the pipes package. ANy idea what could be wrong ?
08:22 <cocreature> Myrl-saki: what you can do is something like http://lpaste.net/354426
08:23 oish joined
08:23 <Jinxit> Myrl-saki: http://lpaste.net/6945794185941221376
08:24 <Jinxit> so certain combinations are illegal
08:24 <Myrl-saki> cocreature: Oh cool. No need for dependent types.
08:25 <Myrl-saki> Jinxit: Oh.
08:25 thc202 joined
08:25 <Jinxit> from a more practical standpoint it's about combining instructions with addressing modes
08:26 <Myrl-saki> Jinxit: You might want to check out my compil3e.
08:26 <MarcelineVQ> stphrolland: There's two places that provide Proxy that I can find and they're not what you've mentioned. Data.Proxy and Pipes.Internal
08:26 <geekosaur> stphrolland, make sure you are checking the same version
08:26 <Myrl-saki> Assembler.
08:27 <MarcelineVQ> geekosaur: oh is it a version issue?
08:27 <Myrl-saki> Jinxit: https://github.com/Myrl/MyM-Private/blob/master/src/myass/Types.hs
08:27 albertus1 joined
08:27 <geekosaur> no, that's a boilerplate answer because the ;last 3 times I helped someone with that it turned out they were using an old resolved
08:27 <geekosaur> *resolver
08:27 <MarcelineVQ> :>
08:28 <geekosaur> and using the docs for the latest version
08:28 koneida joined
08:28 <Jinxit> Myrl-saki: that doesn't have different address modes for the same instruction though, does it?
08:28 <geekosaur> Control.Proxy seems an odd place for that anyway
08:29 <geekosaur> although I suppose no odder than some of the Control vs. Data splits >.>
08:29 <Myrl-saki> Jinxit: Right.
08:29 osa1 joined
08:30 Welkin joined
08:30 <Jinxit> and i guess you can have things like "Add Absolute | AddI Immediate", but it feels like you're giving the same information twice
08:30 biglama joined
08:32 <adarqui> hey, i have a file with a bunch of text, but, separated into segments starting with: X <name> ......... so, X <name>\n<text for many lines>\nX <name2>\n..
08:32 <Myrl-saki> Jinxit: Honestly better.
08:32 <adarqui> with something so simple, wht would you use to parse? still parsec? or something else
08:33 <Jinxit> Myrl-saki: even with up to 8 variants of the same instruction? :|
08:33 Kundry_Wag joined
08:37 richi235 joined
08:37 kuribas joined
08:39 <kuribas> is reactive-banana usable with ghcjs, or should I use something else?
08:41 <Gurkenglas> 'kay, stack install ghci-ng failing on a missing '"dyn" library' reported. https://github.com/commercialhaskell/stack/issues/3116
08:41 <MarcelineVQ> kuribas: should be, there's examples for reflex, sodium, and reactive banana for ghcjs
08:41 adolby_ joined
08:41 <Myrl-saki> Jinxit: Yep.
08:42 <Myrl-saki> Jinxit: They're different types.
08:42 castlelore joined
08:42 <kuribas> MarcelineVQ: okay, thanks.
08:42 <Myrl-saki> Jinxit: I'll give you an example why.
08:42 <geekosaur> Gurkenglas, what ghc is stack using? one it installed, or a different one?
08:42 <Myrl-saki> Jinxit: different data structures*
08:42 <geekosaur> because it's looking for things like a 'dyn' way for base, and you'd have to get that with ghc
08:42 <Gurkenglas> geekosaur, I don't know, I think I ran stack setup at some point? How do I check?
08:42 <Myrl-saki> Jinxit: You'll be pattern matching differently anyway.
08:43 <Gurkenglas> (some months back or so)
08:43 armyriad joined
08:43 <geekosaur> stack paths, I think?
08:43 marr joined
08:44 <Gurkenglas> invalid argument 'paths'
08:45 jgt1 joined
08:45 zcourts joined
08:45 <Myrl-saki> Jinxit: Anyways. Now that you've said it.
08:46 <Myrl-saki> Jinxit: GADT would surely help.
08:46 <geekosaur> oh, it's "stack path", look for "compiler"
08:46 cschneid_ joined
08:47 <Jinxit> how would GADTs help? i'm not at all familiar with them
08:47 <MarcelineVQ> geekosaur, Gurkenglas: or helpfully, stack path --compiler-bin
08:48 <Gurkenglas> "C:\Users\Gurkenglas\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.3\bin"
08:49 <Myrl-saki> Jinxit: With GADT, you can use types to describe your data.
08:49 <Myrl-saki> Jinxit: Or something.
08:52 <Myrl-saki> Has anyone here read Clowns and Jokers?
08:52 Detrumi joined
08:52 swalladge joined
08:53 zcourts joined
08:54 <Myrl-saki> data Fix p = Fix (p (Fix p))
08:54 HugoDaniel joined
08:55 RonnieHolm joined
08:55 nshepperd joined
08:57 Berra joined
08:58 nepiktaz joined
08:59 uglyfigurine joined
09:00 Argue joined
09:02 bl0w3d_0ut joined
09:02 simukis_ joined
09:03 SimpleL joined
09:05 louispan joined
09:05 bl0w3d_0ut joined
09:06 ed1 joined
09:10 ljc joined
09:11 magneticduck joined
09:11 redpoppies joined
09:12 fizruk joined
09:13 mmn80 joined
09:15 <cocreature> Myrl-saki: I think I did but it’s been a long time. do you have some specific question?
09:15 eklavya joined
09:16 <Myrl-saki> cocreature: Page 3. I don't get how L1 {-o-o-o-} -> L2 {-<-o->-}
09:16 <Myrl-saki> cocreature: To be more exact, I don't exactly get the choice of figures.
09:18 <cocreature> Myrl-saki: sorry I don’t remember that part anymore
09:18 vaibhavsagar joined
09:19 <Myrl-saki> cocreature: I think the figures don't "really" matter.
09:19 <Myrl-saki> i'll go read some more, I guess.
09:20 wei2912 joined
09:20 <Myrl-saki> wei2912: Uwawawa. Otouto. :3
09:20 <wei2912> hi Myrl-saki
09:20 <wei2912> how've you been?
09:20 <Myrl-saki> wei2912: I'm plerning to make purrgurrming lengerg. :D
09:21 <wei2912> what happened to your spelling lmao
09:21 Jackneill joined
09:21 <wei2912> writing an interpreter or a compiler?
09:21 <Myrl-saki> wei2912: For Arduinos specifically. The lack of FP bothers me.
09:21 <wei2912> Myrl-saki: ah, i see
09:22 <Athas> Myrl-saki: cool! A full language or something embedded in Haskell?
09:22 <hsk3> Does error always crash the program, or is it just an exception that can be caught without crashing the program?
09:22 <cocreature> hsk3: it can be caught but the convention is that "error" is a fatal error and you shouldn’t catch it :)
09:23 <hsk3> thank you
09:23 <Myrl-saki> Athas: A full language. Not sure if I can just monad this.
09:23 <cocreature> hsk3: https://hackage.haskell.org/package/base- this is the exception that’s thrown if you call "error"
09:23 Denthir joined
09:24 <hsk3> great to know that
09:24 <kuribas> Myrl-saki: FP would be hard with the limitations of atmel µControllers.
09:24 <Athas> Myrl-saki: for my undergraduate thesis, I did a Haskell eDSL for programming Arduinos. Programs looked like this: https://github.com/dybber/fladuino/blob/master/fladuino/examples/alarm/Main.hs
09:24 <Athas> Functional reactive programing is a pretty decent model for small embedded devices.
09:24 Welkin joined
09:24 <Myrl-saki> kuribas: Indeed. That's why I'll be dabbling with linear types.
09:25 <Athas> The ergonomics were bad, though. I don't like eDSLs anymore.
09:25 <kuribas> in general?
09:26 <cocreature> Athas: what’s the output of your edsl? C code? binaries?
09:27 <Athas> cocreature: you run the Haskell program and it produces a C program, which you then compile.
09:27 Kreest_ joined
09:27 <Athas> kuribas: small ones seem to work well. Parser combinators are great, for example.
09:28 <cocreature> the big advantage of edsls is that it’s really easy to get started.
09:28 <cocreature> you don’t need to worry about writing parsers and all that boring stuff :)
09:29 <Myrl-saki> Athas: Why not ASM?
09:29 <cocreature> Myrl-saki: generating C code is usually significantly less work :)
09:30 redpoppies joined
09:30 <cocreature> and you get compiler optimizations performed by the C compiler for free
09:30 <Athas> Myrl-saki: wasn't necessary.
09:30 <kuribas> Athas: I am making a eDSL for metafont, and I think it's better than the unhygienic macro system of mf.
09:31 <Athas> Also, we re-used an existing framework (Flask) built by Geoffrey Mainland, which generated C.
09:31 <kuribas> Is there a recommended higher level library for accessing the DOM in ghcjs?
09:31 <Myrl-saki> cocreature: True.
09:31 <Athas> kuribas: I don't know Metafont well enough to judge whether a DSL would be nice to use. As long as the semantics are predictable and any type errors are comprehensible, then it's fine.
09:32 fotonzade joined
09:32 <cocreature> Myrl-saki: even if you don’t want to go via C you probably want to go to LLVM instead of actual assembly for that reason (and a lot of other reasons)
09:32 <Athas> It just seems like many Haskell eDSLs by necessity become highly abstract (type-wise), with resultant incomprehensible type errors.
09:32 <Gurkenglas> Is there an open source project that compensates contributions? (Would this fall to the problems of wrong incentives?)
09:33 <Myrl-saki> cocreature: Oh right. Thanks for reminding me LLVM exists. I'll probably go that route.
09:33 <cocreature> Gurkenglas: a lot of projects have bounties on specific issues that you get if you fix them (i.e. fix a bug, implement a feature, …)
09:33 <kuribas> Athas: metafont is just a programming language with equation solving builtin for generating fonts.
09:34 <cocreature> Myrl-saki: obviously you should make sure that LLVM supports the target architecture you are interested in before doing that :)
09:34 Kundry_Wag joined
09:35 Berra joined
09:36 carlosda1 joined
09:38 warlock joined
09:39 adrian joined
09:41 pylbrecht joined
09:41 danvet joined
09:42 xall joined
09:43 Yuras joined
09:43 jaspervdj joined
09:48 <Jinxit> what's a good rule of thumb for deciding on a full DSL vs eDSL?
09:48 Gloomy joined
09:48 takle joined
09:48 <cocreature> Jinxit: I don’t think that’s a decision that you should make in general. it mostly depends on your specific application
09:49 <Jinxit> yeah that's why i'm asking for rule of thumb :p
09:51 <cocreature> Jinxit: one strong indicator that an eDSL might be the right choice is if you can embed arbitrary haskell functions in your language
09:51 <cocreature> but if you can’t do that, an edsl might still be nice :)
09:51 <cocreature> or at least sufficient and thereby not justify writing a parser and all that annoying stuff
09:52 <cocreature> syntax highlighting, …
09:52 <Jinxit> in my case the output is (simple) assembly, so that's no on haskell functions
09:52 <Jinxit> you could still use them compile-time
09:53 <cocreature> can you justify the cost of developing a parser, syntax highlighting and similar stuff that’s needed when you make it a separate language?
09:54 <Myrl-saki> cocreature: I'm making this for people, so they should be the one to handle that. /s
09:54 <Jinxit> for context this is a hobby project
09:54 <Jinxit> but you make a good point
09:55 gillesmajor joined
09:55 gillesmajor left
09:55 nighty-- joined
09:55 baldrick1 joined
09:55 <cocreature> I guess my rule of thumb is, go for an eDSL because it’s significantly less work unless there is a good reason not to do so
09:56 <Myrl-saki> cocreature: I need linear types. :D
09:56 <piyush-kurur> whatever happend to TH's stage restriction, I have been using lenses for some time and it seems to work fine with makeLenses in the same module where the type is defined?
09:57 boombanana joined
09:57 <cocreature> Myrl-saki: sure then that’s your good reason for not going for an eDSL
09:58 <cocreature> although you could still make your eDSL build up an AST and then typecheck that
09:59 <Myrl-saki> cocreature: I'm more concerned on how to track variable usage.
09:59 Guest72276 joined
09:59 fizruk joined
10:01 <cocreature> Myrl-saki: I don’t see how that changes if you use a DSL. you still need to have a function that given an AST, typechecks that using whatever algorithm you came up with. the main difference between implementing this as a DSL vs an eDSL is the fact that one requires that you have a separate parser that transform your syntax to your AST vs in an eDSL you use some Haskell functions to build up that AST
10:02 Domkratos joined
10:03 <Myrl-saki> cocreature: I kind of get your point, but might as well make an "actual" language than try to get clever with types.
10:03 epsilonhalbe joined
10:03 <Myrl-saki> cocreature: Especially if you want to make a Haskell-like language.
10:04 osa1 joined
10:04 osa1 joined
10:04 <cocreature> well if you are talking about a Haskell-like language that’s hardly a DSL anymore
10:04 mstruebing joined
10:04 <Myrl-saki> cocreature: Lmao. True.
10:07 silver joined
10:07 phyrex1an joined
10:08 Domkratos joined
10:09 edvorg joined
10:11 uuplusu joined
10:13 ebzzry joined
10:14 Kreest__ joined
10:16 azahi joined
10:17 Domkratos joined
10:18 shayan_ joined
10:18 tristanp joined
10:18 Welkin joined
10:19 fizbin joined
10:22 chrissl joined
10:24 Domkratos joined
10:26 teggi joined
10:30 dcoutts_ joined
10:31 SpinTensor joined
10:34 Domkratos joined
10:35 sbrg joined
10:38 sepp2k joined
10:39 SpinTensor joined
10:40 utdemir joined
10:41 merijn joined
10:41 dawehner joined
10:41 takle joined
10:42 <utdemir> Hey. It looks like TH does not support DEPRECATED and WARNING pragmas. Does anybody know if there's a reason for that, or should I open a feature request?
10:43 oish joined
10:44 <c_wraith> It is a little weird to dynamically generate deprecated code, but I can see reasons why it might occasionally be the right thing to do.
10:44 jaguar joined
10:44 <c_wraith> I suspect it wasn't supported because it's a bit weird as a first impression
10:44 <adarqui> is there a nubBy/nub for data.text anywhere?
10:46 <utdemir> c_wraith: I'm writing a TH function that creates Haskell datatypes from an API specification standard which has a deprecated flag. I thought it'd be better to put that into TH generated accessors that warns on usage.
10:46 <c_wraith> utdemir: yeah, I can see a few use cases, all along those lines.
10:47 chrissound joined
10:47 ph88^ joined
10:47 Ferdirand joined
10:48 fotonzade joined
10:49 gspia joined
10:53 slomo joined
10:53 slomo joined
10:53 castlelore joined
10:54 Wizek_ joined
10:54 wildlander joined
10:55 bennofs joined
10:56 jgt1 joined
10:58 ziocroc2 joined
10:58 firestart joined
11:00 Gurkenglas joined
11:05 Guest72276 joined
11:06 louispan joined
11:06 medicijnman joined
11:08 fizbin joined
11:13 Welkin joined
11:15 mehs joined
11:15 JuanMiguel joined
11:18 ebzzry joined
11:19 a3Dman joined
11:20 tauli joined
11:20 MindlessDrone joined
11:20 mstruebing joined
11:20 <kuribas> Is a string in ghcjs a list of characters?
11:21 wei2912 joined
11:22 <osa1> kuribas: it has to be, String is defined as [Char]. IIRC Text has a different representation in GHCJS though
11:23 nidzo_ joined
11:23 <kuribas> right, so Text is the way to go in ghcjs (and ghc as well probably)?
11:24 <osa1> kuribas: [Char] has its uses but yeah most of the time you actually need Text of ByteString
11:24 <osa1> s/of/or
11:26 <kuribas> Is there documentation for mixing ghc with ghcjs using ajax and json (or anything higher level)?
11:27 <kuribas> I suppose JavaScript-Ajax would work...
11:29 zcourts_ joined
11:31 castlelore joined
11:31 castlelore joined
11:31 mmn80 joined
11:36 Kundry_Wag joined
11:36 t0by joined
11:36 t0by joined
11:37 ksf joined
11:39 merijn joined
11:40 ksf left
11:41 leat joined
11:46 zcourts joined
11:46 Lord_of_Life joined
11:48 <shane> Does anyone know approximately when Backpack is scheduled to be released?
11:48 a3Dman joined
11:49 louispan joined
11:49 <phadej> nh2: pong
11:51 sdothum joined
11:52 lordcirth joined
11:59 mzf joined
11:59 ragepanda joined
12:02 jeltsch joined
12:04 epsilonhalbe left
12:05 hfn joined
12:06 AX3L joined
12:06 cyborg-one joined
12:06 e_svedang joined
12:07 hfn left
12:07 sanett joined
12:07 Welkin joined
12:08 presiden joined
12:09 xall joined
12:12 Denthir joined
12:16 danthemyth joined
12:16 kritzcreek_ joined
12:16 nick_h joined
12:20 Lord_of_Life joined
12:21 JeanCarloMachado joined
12:23 ner0x652 joined
12:23 ebzzry joined
12:24 _sg joined
12:25 fizbin joined
12:28 cdidd joined
12:28 forker joined
12:28 suppi joined
12:30 nilof joined
12:32 abhiroop joined
12:33 <cocreature> shane: it’s included in 8.2
12:33 <cocreature> shane: I think 8.2rc1 should be officially released tomorrow. source tarballs and some binaries are already out
12:33 moth joined
12:33 ahmedmeftah joined
12:34 johs joined
12:34 mizu_no_oto joined
12:36 ahmedmeftah joined
12:36 ahmedmeftah joined
12:36 <blocus> hello
12:37 <cocreature> hey blocus
12:37 <blocus> there is some one who play @ code jam ?
12:38 anuxivm joined
12:40 Guest91585 joined
12:40 merijn joined
12:40 <* redpoppies> say hello to everyone
12:41 <redpoppies> anyone willing to help with aeson-lens? don't know how to map/filter/fold an aeson array to obtain specific properties
12:42 <redpoppies> each doesn't seem to work
12:42 Supersonic112 joined
12:42 <redpoppies> I have r ^. key "myarrayprop" . _Array
12:43 thvu joined
12:44 <redpoppies> I tried r ^. key "myarrayprop" . (each _Object) . _Array but it doesn't work
12:44 <redpoppies> any advice?
12:45 <lyxia> what is the shape of r
12:45 <cocreature> an example of the output that you want to get might also be helpful
12:46 <redpoppies> let's say {"myarray": [{"a":1, "b":2}]}
12:46 cpennington joined
12:47 <redpoppies> I need to filter/reduce each object in myarray
12:47 <jchia_1> I'm using embedFile (https://hackage.haskell.org/package/file-embed-0.0.10/docs/Data-FileEmbed.html) in one my code base. Despite a successful build (using stack), this gives problems when I run ghci, which gets errors, I suspect because it's using a different path than during stack build. Since the file being embedded is part of my code base, I'm using a relative path. What can I do to make both "stack build' and ghci happy with the em
12:47 <jchia_1> bedFile? Is there some special 'token' I could put in the source code representing the package directory, so that I can use an absolute path?
12:47 <redpoppies> sorry, to be consistent it would be {"myarrayprop": [{"a":1, "b":2}]}
12:48 <jchia_1> I mean I think stack build and ghci are using different current-working-directory.
12:48 <redpoppies> or even better, with 2 entries {"myarrayprop": [{"a":1, "b":2}, {"c":3, "d":4}]}
12:49 <lyxia> and what is the expected output
12:50 <redpoppies> say [{"a":1}, {"c":3}]
12:51 <redpoppies> I am actually more interested to construct local types from these values
12:51 <redpoppies> like [A 1, C 3]
12:51 <redpoppies> but for that I need to be able to map/fold
12:51 <redpoppies> just don't know how
12:52 <redpoppies> I have trouble understanding that part of lenses
12:52 <redpoppies> traverseOf maybe?
12:52 <redpoppies> I just am not sure
12:52 <lyxia> key "myarrayprop" . _Array gives a view of the array
12:52 <lyxia> key "myarrayprop" . _Array . each gives a view of each element
12:53 <redpoppies> yes, which is a vector of hashmaps
12:53 <redpoppies> really?
12:53 <redpoppies> ok, will try that
12:53 <lyxia> key "myarrayprop" . _Array . each . to function maps whatever function :: Value -> a on each element
12:54 <cocreature> > "{\"myarrayprop\": [{\"a\":1, \"b\":2}]}" ^.. key "myarrayprop" . _Array . each . _Object
12:54 <lambdabot> error:
12:54 <lambdabot> • Variable not in scope:
12:54 <lambdabot> key :: [Char] -> b0 -> [Char] -> Const (Endo [a]) [Char]
12:54 <cocreature> well, that didn’t work :)
12:54 <redpoppies> so ".to" maps it?
12:54 <lyxia> oh yeah you can add an _Object inbetween
12:54 Ferdirand joined
12:55 <cocreature> but I did try it locally so that definitely works :)
12:55 <redpoppies> again please, complete working path
12:55 <lyxia> Just to be clear, it's associated as (...) . (to function)
12:56 blocus joined
12:56 <lyxia> key "myarrayprop" . _Array . each . _Object . to function where function :: HashMap Text Value -> a
12:57 HoierM joined
13:00 <redpoppies> ok, doesn't work form me but that got me started really well. thank you very much!
13:00 slacker joined
13:00 <redpoppies> the example from @cocreature works in my ghci so it's definitely my structure
13:00 <redpoppies> thanks again
13:00 <cocreature> redpoppies: if you show us your code we might be able to help you more :)
13:01 <cocreature> “doesn’t work for me” is sadly not a sufficient amount of information :)
13:01 sanett_ joined
13:01 <redpoppies> it's reading from Microsoft cognitive api on text reading
13:01 Welkin joined
13:01 <redpoppies> i have regions, that have lines, that have words
13:02 <redpoppies> I want to concat words into single lines
13:03 <sbrg> how does one import modules with lambdabot?
13:03 <cocreature> @import Control.Applicative
13:03 <lambdabot> Unknown command, try @list
13:03 <redpoppies> don't want to bother you with a large string dump, that's why I contracted the example. it seems that it's my ghci for the specific returned object, so I will work some more on that
13:03 <cocreature> hm I thought that worked
13:03 <sbrg> so did I :|
13:03 <redpoppies> really thanks, you saved me a lot of digging
13:03 <sbrg> :m +Control.Applicative
13:04 _sg joined
13:05 <redpoppies> @cocreature for instance, ior is the wreq response from cognitive api
13:05 <lambdabot> Unknown command, try @list
13:05 <redpoppies> ior >>= \r -> return $ r ^. responseBody . key "regions" . nth 0 . key "lines" . each . _Object
13:05 Kundry_Wag joined
13:05 <redpoppies> this lacks something, the error is
13:05 Paks joined
13:06 <redpoppies> Ambiguous type variable ‘a0’ arising from a use of ‘_Object’
13:06 <redpoppies> prevents the constraint ‘(AsValue a0)’ from being solved.
13:06 <redpoppies> Probable fix: use a type annotation to specify what ‘a0’ should be.
13:06 <redpoppies> and a bit higher: Ambiguous type variable ‘a0’ arising from a use of ‘_Object’
13:06 <redpoppies> prevents the constraint ‘(AsValue a0)’ from being solved.
13:06 <redpoppies> Probable fix: use a type annotation to specify what ‘a0’ should be.
13:06 <redpoppies> https://paste.gnome.org/ppyujndlg
13:07 <cocreature> redpoppies: what’s the type of "r"?
13:08 <cocreature> hm no ignore that
13:08 <cocreature> redpoppies: try using _Array between key "lines" and "each"
13:09 shainer joined
13:09 dgonzo joined
13:10 Wuzzy joined
13:10 <redpoppies> yup, missed that
13:11 <redpoppies> here is the result now, we are getting close
13:11 <redpoppies> https://paste.gnome.org/prn3whc6p
13:11 <cocreature> redpoppies: remove _Object
13:12 rios joined
13:12 dcoutts_ joined
13:12 _sg2 joined
13:12 <redpoppies> bounding box is a property String "20, 10, 15, 20"
13:13 <redpoppies> ok, cool, it gives me something like
13:13 eschnett joined
13:13 <redpoppies> "6,90,89,126,109,362,155,144,142,106,160,163,135,177,59,126,208,192,116,224,173,116,256,235,116,273,178,12"
13:13 <redpoppies> I guess it is using the monoid of _String to concatenate all boundingBox properties?
13:14 alasi joined
13:14 <cocreature> try using ^.. instead of ^.
13:15 <redpoppies> very cool, exactly what i need
13:15 <cocreature> great :)
13:15 dddddd joined
13:16 <redpoppies> thank you very much. should you ever come to romania i am personally in your debt with your favorite beverage :)
13:16 <cocreature> heh, I’ve no plans to go there in the near future so you’ll have to drink that beverage for me :)
13:16 <redpoppies> will do. where are you from?
13:16 <cocreature> germany
13:17 <redpoppies> cool. will drink a weissbeer for you this evening
13:17 <redpoppies> thanks again
13:18 <cocreature> yw
13:19 kapott joined
13:23 vektorweg1 joined
13:23 _sg2 joined
13:23 sepp2k1 joined
13:24 Ronnin joined
13:24 epsilonhalbe joined
13:24 kapott joined
13:24 epsilonhalbe left
13:27 blocus joined
13:32 pavonia joined
13:32 sanett joined
13:32 abhiroop_ joined
13:34 <kuribas> I get an error with ghcjs: uncaught exception in Haskell main thread: ReferenceError: h$criterion_inittime is not defined
13:35 c137 joined
13:36 dgonzo joined
13:38 <kuribas> bug in ghcjs?
13:38 eklavya joined
13:40 bbear joined
13:41 ubsan joined
13:41 <c137> Hello there! I'm a newbie and reading Learn You A Haskell now. Can someone please enlighten me why "Abrakadabra" < "Zebra" returns True?
13:41 <cocreature> c137: because 'A' < 'Z' returns True
13:42 shane84 joined
13:42 <c137> Oh, so it compares only the first characters?
13:42 <cocreature> c137: lists (and thereby also String) use lexicographic ordering
13:42 jespada joined
13:42 blocus joined
13:42 <cocreature> c137: it compares the first character, if those are equal it compares the second character and so on
13:42 blocus joined
13:43 <cocreature> but as soon as one of those comparisons does not return equal, that’s the final result
13:43 <c137> Got it, thanks for your answer cocreature!
13:44 _sg2 joined
13:46 c137 joined
13:46 <Jinxit> using stack, how can i tell ghc to give up after allocating a certain amount of memory?
13:46 <Jinxit> instead of completely killing my computer lol
13:48 takle joined
13:48 utdemir joined
13:50 Pilfers joined
13:50 WarmCookie joined
13:50 _sg joined
13:50 <ClaudiusMaximus> Jinxit: maybe the easiest would be with environment variable (instead of figuring out how to pass RTS options through nested calls): GHCRTS="-M1G" or similar
13:50 lithie joined
13:55 Welkin joined
13:59 theelous3 joined
14:00 utdemir joined
14:01 zcourts joined
14:02 nomicflux joined
14:02 moongazer joined
14:03 <bbear> Beside monads and functors what are they to learn in Haskell ?
14:04 fizbin joined
14:05 oish joined
14:05 Ch0c0late joined
14:07 <kuribas> bbear: Monoids, Foldables, Applicatives, Traversables
14:08 mda1 joined
14:08 <bbear> May I start here ? http://learnyouahaskell.com/functors-applicative-functors-and-monoids
14:10 Denthir joined
14:11 JeanCarloMachado joined
14:12 nagyf joined
14:12 sujeet joined
14:12 bollu joined
14:15 richi235 joined
14:15 phaji joined
14:17 <kuribas> bbear: sure, if it's not clear, read the previous chapters
14:17 Ch0c0late joined
14:18 cpup joined
14:21 tristanp joined
14:23 <ij> Trying to catch my first exception, but «catch (error "test") print» doesn't typecheck: http://sprunge.us/HPZX What's the deal?
14:24 <cocreature> ij: you need to add a type annotation to indicate which exception you want to catch
14:24 jaspervdj joined
14:24 <cocreature> so add a type annotation to "p"
14:24 <ij> Oh, it's not forall e. then, I guess.
14:25 <cocreature> if you want to catch all exceptions use SomeException
14:25 <cocreature> but that’s rarely a good idea
14:25 Fendor joined
14:25 <ij> I want to print it, but I don't want the application to die.
14:25 <ij> Isn't that a good idea?
14:26 <cocreature> if you catch all exceptions, you also catch things like ThreadKilled and UserInterrupt (ctrl-c)
14:27 <ij> I won't kill the thread, so I'm safe from that. If've a different main thread, so that'll get the ^C, perhaps?
14:27 <cocreature> yeah then you might be somewhat safe
14:28 <ij> Cool, thanks! Let's hope for the best.
14:29 zcourts joined
14:29 Lord_of_Life joined
14:31 magneticduck joined
14:33 aib joined
14:35 Yuras joined
14:38 <jchia_1> Is there a way to get the filename of the file being compiled as a string that I can use in the source code? Besides using CPP?
14:38 KongWubba joined
14:39 cyborg-one joined
14:40 sea_wulf joined
14:41 Guest72276 joined
14:41 <edwardk> jchia_1: what is wrong with CPP for this purpose?
14:41 <glguy> jchia_1: there's probably something in template Haskell
14:41 ChaiTRex joined
14:41 Khisanth joined
14:42 <kuribas> ugh, my ghcjs code is about 1000x slower
14:42 <edwardk> you can reifyModule thisModule and then maybe get out a name
14:44 fotonzade joined
14:44 Lord_of_Life joined
14:45 <edwardk> oh derp just get 'location'
14:45 <edwardk> and then read out loc_filename
14:45 <edwardk> :t Language.Haskell.TH.loc_filename <$> Language.Haskell.TH.location
14:45 <lambdabot> Language.Haskell.TH.Syntax.Q String
14:45 <jchia_1> edwardk: My code builds without CPP but gets a compilation error with CPP that I don't understand.
14:45 <edwardk> that will tell you the file name you are being spliced into
14:46 <jchia_1> edwardk: To be precise, I actually want the full pathname of the source file.
14:46 meoblast001 joined
14:46 <jchia_1> edwardk: Does this give the full pathname
14:46 <edwardk> no idea. probably not
14:47 <edwardk> might get you one relative though
14:47 <edwardk> but you can reconstruct the filename under reasonable assumptions from loc_module, etc.
14:48 Welkin joined
14:48 <Gurkenglas> When I have pieces data and a way to handle them, and the user is supposed to be able to replace it with other ways and possibly a morphism for the data, is that the Store pattern?
14:48 <kuribas> I exaggerated, it's only 200 times slower...
14:48 <Gurkenglas> *pieces of data
14:48 MitchellSalad joined
14:48 <Gurkenglas> *with another way and possibly provide a morphism :s
14:49 <jchia_1> glguy, edwardk: Thanks
14:50 yrdz joined
14:50 <edwardk> since you're in Q there you can bolt in IO actions to elaborate the relative path
14:50 <jchia_1> I get this error with CPP. What does it mean? The line reference is the first line of a multi-line string that I break using backslash.
14:50 <jchia_1> "lexical error in string/character literal at character 'F'"
14:50 <edwardk> guessing CPP is mucking with your multiline string literals
14:50 cobreadmonster joined
14:50 <edwardk> you could always use something like a multiline quasiquoter
14:51 e14 joined
14:51 <edwardk> https://hackage.haskell.org/package/heredoc-
14:51 <edwardk> i mean if you're going to have to invoke TH anyways for this then you can always just take the easier path
14:51 <geekosaur> jchia_1, oddly enough the C preprocessor expects C strings, not Haskell strings
14:52 breadmonster joined
14:52 <geekosaur> if you use the CPP extension then you get to limit yourself to that subset of code that is lexically valid in both C and Haskell
14:52 <breadmonster> It's been a while since I've used Haskell, I'll admit.
14:52 <jchia_1> I suppose the C preprocessor sees something that it thinks should be a string but then sees that it has problems, so I'm getting this error?
14:52 <breadmonster> Now I'm trying to parse some markdown.
14:52 <breadmonster> and I can't figure out how to get this to work, iirc it requires some flag. https://gist.github.com/anonymous/51a5eabb9ec0ed9def78657aa0482339
14:53 nh2 joined
14:53 <sm> breadmonster: add some top-level type signatures
14:53 MitchellSalad joined
14:53 <sm> well, one
14:53 <breadmonster> sm: Ideally, I'd like it to be as generic as possible...?
14:54 abhiroop joined
14:54 <sm> you can write a generic signature. But right now it's *too* generic for GHC
14:55 w3br47 joined
14:55 <w3br47> Hello
14:55 nomicflux joined
14:56 <* geekosaur> thinks the problem is upstream of that error, since inventing an s0 and m0 out of thin air implies it's disconnected itself from an s and m elsewhere?
14:56 aib joined
14:56 malakin1 joined
14:57 <w3br47> Hey any hacker ?
14:57 <WarmCookie> Is there a way to see the inference of all type variables listed during a type mismatch error and/or ambiguous type error?
14:57 <WarmCookie> Often those get renamed and despite being able to look at the line and figuring out what's wrong, I'd love the messages giving more context.
14:58 <sm> breadmonster: also, that parser isn't generic, it can only be bold :: Parser TaggedString
14:58 <geekosaur> w3br47, this channel is about the Haskell programming language, not hacking
14:59 <sm> well, I mean it can only return a TaggedString. And that's the simplest type sig to fix your error
14:59 <w3br47> Thanks i think am lost here do you knw a place for hackers?
14:59 significance joined
14:59 stef204 joined
14:59 <WarmCookie> w3br47: Try ##hackers possibly? There's 184 people in there.
14:59 <glguy> Sorry, this isn't a directory
15:00 <sm> breadmonster: also since you're just starting out, did you know about megaparsec
15:00 <w3br47> Thanks
15:00 <MitchellSalad> I'm a leet hacker. What'dya need
15:00 <* sm> facepalms
15:00 <breadmonster> sm: Really? I added a type signature and it compiled.
15:00 <breadmonster> sm: I had to use FlexibleContexts though.
15:01 utdemir joined
15:01 a3Dman joined
15:01 <breadmonster> sm: bold :: (Stream s m Char) => ParsecT s u m TaggedString
15:01 <sm> breadmonster: oh, which type sig did you use ?
15:01 <sm> ok, that's more generic indeed
15:02 <breadmonster> sm: Yeah, I'm going to need the full generality for this.
15:03 w3br47 left
15:03 <geekosaur> really? people use the state?
15:04 <sm> sure, I sometimes use the state
15:04 jmcarthur joined
15:05 <ij> Is bytestring-conversions a good package?
15:05 <vaibhavsagar> hey, can someone help my figure out why my test suite is using 400mb of heap memory?
15:05 <sm> ij: not on hackage, so I'm going to say NO
15:05 <vaibhavsagar> and how to reduce the amount of memory it uses?
15:05 <ij> without the s in the end!
15:05 <ij> sorry
15:05 richi235 joined
15:06 <sm> ij: looks good to me!
15:07 fizbin joined
15:07 <yushyin> ij: is Data.ByteString.Builder not good enough?
15:08 <sm> just needs a little more doc explaining when to use it instead of X
15:08 <ij> yushyin, This is the sort of answer I was waiting for.
15:08 codesoup joined
15:08 <ij> Yeah, looks like that might do.
15:09 MindlessDrone joined
15:09 <sm> yushyin++
15:10 ed1 joined
15:11 <Gurkenglas> Is there a way to gurantee on the type level that a container t Dynamic is homogenous?
15:14 bab joined
15:15 <breadmonster> I'm actually slightly unsure how to design this.
15:15 <breadmonster> sm: Can you help?
15:17 <ij> yushyin, Can I go from ByteString to Lazy.ByteString with this?
15:17 <Philonous> Gurkenglas, Dynamically you can extract the TypeReps from the Dynamics and compare them
15:17 <Philonous> Gurkenglas, Statically you'd need to know the type of the values, which defeats the point of Dynamic
15:17 <seequ_> Gurkenglas: Are you sure you want them to be Dynamic?
15:17 <breadmonster> The way I'm thinking of doing this is to hit a tag token, add it to a stack (that's the state) then keep going until I hit the end token
15:18 <geekosaur> Gurkenglas, at type level the only thing visible is Dynamic, that's the *point* of Dynamic
15:18 <breadmonster> pop it off the stack and do some fiddling to add it to the parse tree.
15:18 <breadmonster> but I'm not sure how to get this to work.
15:18 <ij> yushyin, Because it seems that the toLazyByteString's actually returning Data.ByteString.ByteString.
15:18 <glguy> Gurkenglas: You can make your own data type like dynamic
15:19 <ij> yushyin, wait, nope, sorry!
15:19 <Gurkenglas> seequ_, it's pieces of data and a way to handle them, where the user is supposed to be able to provide code at runtime to handle it elsewise and perhaps a morphism on the data
15:19 <glguy> Gurkenglas: data Dynamic1 t = forall a. Typeable a => Dynamic1 (t a)
15:20 <ij> yushyin, My module aliases were wrong.
15:20 <Philonous> glguy, But you'd need unsafeCoerce to get the values back, don't you?
15:20 <glguy> Philonous: no
15:20 <glguy> Philonous: That's handled for you by typeable
15:20 <Philonous> glguy, Oh? Interesting
15:20 <glguy> (just the same as Dynamic)
15:21 <glguy> In current GHC that's unsafeCoerce under the hood, in new GHC typereps are indexed by their types and it's less hacky
15:21 <glguy> but it's still the same as how Dynamic works either way
15:21 <Gurkenglas> glguy, but "forall a. Typeable a => Dynamic1 (t a)" would mean that I'd have to be able to deconstruct it into t of any Typeable a, right?
15:22 <Philonous> Yes, once you have singletons you can just use type equality to bring the type back into scope
15:22 <glguy> Gurkenglas: No, the "forall" is outside the constructor
15:22 <glguy> Gurkenglas: so it's using ExistentialQuantification
15:22 <MitchellSalad> in that context, "forall" should be read "exists" >_<
15:23 mac10688 joined
15:23 <Philonous> glguy, That "Typeable case" would have to be (Typeable a, Typeable b) -> a -> Maybe b , right? I can't seem to find it though
15:23 rcat joined
15:23 <glguy> :t Data.Typeable.cast
15:23 <lambdabot> (Typeable b, Typeable a) => a -> Maybe b
15:23 <Philonous> There we go, thanks
15:23 <Philonous> Even called case
15:24 <Philonous> cast
15:24 abhiroop joined
15:27 ubsan_ joined
15:29 futuristic joined
15:29 SimpleL joined
15:30 e14 joined
15:30 oisdk joined
15:30 eklavya joined
15:30 hydraz joined
15:31 JeanCarloMachado joined
15:31 alx741 joined
15:32 fizbin joined
15:34 drbojingle joined
15:34 Ferdirand joined
15:35 jdt joined
15:35 zero_byte joined
15:36 jbiesnecker joined
15:36 kotangent joined
15:36 a3Dman joined
15:37 trism joined
15:38 eazar001 joined
15:40 eacameron joined
15:41 <Philonous> I'm trying to load a project in intero/emacs, but all I'm getting it "OK, modules loaded: none". I've selected the correct target with intero-targets and tried intero-reload, what's going wrong?
15:41 yellowj joined
15:42 warlock joined
15:43 alx741 joined
15:47 happy0 joined
15:48 dima__ joined
15:48 dima__ left
15:49 aditsu joined
15:49 <ij> It seems that an error I called escaped my catch handler: http://sprunge.us/hbGS?haskell
15:50 <ij> Output's printed in the end.
15:50 EvilMachine joined
15:50 sanett joined
15:51 dimsuz joined
15:52 <aditsu> hi, n00b here, how can I add 1 to a Maybe Num and get a new Maybe Num?
15:52 <monochrom> fmap (1 +)
15:52 <glguy> ij: instead of forever . handle, why not handle . forever ?
15:53 <ij> I'd like it to keep going after a bad client.
15:53 thunderrd joined
15:54 <aditsu> monochrom: thanks
15:54 li4ick_ joined
15:54 <monochrom> ij: You are looking at lazy evaluation delaying an error.
15:55 <monochrom> And where the hell is main?
15:56 <ij> Main's elsewhere, but runRawSocket is called by main.
15:56 <monochrom> rawMessage is also relevant.
15:56 permagreen joined
15:57 <ij> ahhh, I'm starting to get it
15:57 <ij> hmm, but the stack shows my module
15:57 <ij> Oh, right — I don't understand how stack works over here or even if it exists.
15:58 <monochrom> A stack exists. But you haven't known what it does.
15:58 dimsuz joined
15:59 coltfred joined
15:59 e14 joined
16:01 urodna joined
16:01 utdemir joined
16:01 <glguy> ij: /error/ is for situations that shouldn't occur in your code, not for failure you intend to handle
16:02 <ij> You mean I can't catch it?
16:02 <dimsuz> hi all. got stuck while learning Reactive-Banana. I was translating example from Conal's Declarative Event Oriented Programming. It worked quite well until some point. Now I get 'thread blocked indefinetly on MVar' in runtime. My code is rather ugly I guess, but if anyone would take a look I'd be thankful: https://goo.gl/64vF1M
16:02 <ij> glguy, Because I don't intend to handle it.
16:02 <dimsuz> otherwise I'm not experienced enought to understand what I did wrong...
16:03 takle joined
16:03 <dimsuz> also it's quite complex, sorry. Asking just in case, I know I won't be able to fix it until i get at least 50% more clever :)
16:03 epsilonhalbe joined
16:04 abhiroop joined
16:04 <glguy> ij: You're here asking us how you can handle it and continue execution
16:04 dcoutts_ joined
16:05 takle joined
16:05 <ij> glguy, I don't expect it to continue working in the process, but rather return at "handle", go back to forever and start over.
16:05 justanotheruser joined
16:06 <glguy> ij: Well that's still "handling" it
16:07 <ij> Oh, I see the misunderstanding. I'm not handling it in process and I want process to come back to handle, then start over.
16:07 <ij> Isn't that doable with catch?
16:07 sanett joined
16:07 <glguy> (error "somestring") doesn't through any actual exception until it is evaluate
16:07 <glguy> d
16:08 <glguy> If you return that value from inside your catch and evaluate it outside the catch, the exception won't be caught
16:08 <ij> Ah, okay! Makes sense.
16:09 hoknamahn joined
16:09 markus1189 joined
16:11 zariuq joined
16:12 aib joined
16:12 ragepanda joined
16:14 takle joined
16:15 markus1199 joined
16:15 <ij> Can I traverse [Either String a] into Either String [a]?
16:15 <glguy> sequence
16:16 <edwardk> :t traverse id
16:16 <lambdabot> (Applicative f, Traversable t) => t (f b) -> f (t b)
16:16 <edwardk> :t sequence
16:16 <lambdabot> (Monad m, Traversable t) => t (m a) -> m (t a)
16:16 <edwardk> :t sequenceA
16:16 <lambdabot> (Applicative f, Traversable t) => t (f a) -> f (t a)
16:16 <edwardk> same thing
16:17 permagreen joined
16:17 futuristic joined
16:17 <glguy> Not just a good idea, it's the law!
16:17 <ij> It'll stop at the first one.
16:17 ccomb joined
16:17 <edwardk> if you want to concatenate all the errors then you can use Validation from the either package
16:18 <bennofs> :t catRights
16:18 <lambdabot> error: Variable not in scope: catRights
16:18 <edwardk> bennofs: sounds like something from PETA
16:18 <bennofs> :D
16:18 <bennofs> no cat rights in scope!
16:19 danthemyth joined
16:19 <monochrom> Copycats have copyrights.
16:19 <monochrom> or don't have, I don't know.
16:19 <ij> With Validation, will it still be with sequence?
16:20 mkoenig joined
16:20 <edwardk> ij: sequenceA or traverse, but yeah
16:21 <geekosaur> cats don't care about rights, they just do what they want :p
16:23 a3Dman joined
16:25 <ij> glguy, I made it propagate until top of `process', then failed to pattern match Left, before sending it into TBMChan.
16:25 <ij> Catch works then.
16:26 zargoertzel joined
16:26 NickHu[w] joined
16:26 vektorweg1 joined
16:26 Edith joined
16:27 safe joined
16:30 sanett joined
16:30 vydd joined
16:30 NickHu joined
16:33 pwnz0r joined
16:35 <breadmonster> Does `manyTill p end` consume the end token?
16:35 t7 joined
16:36 <EvanR> yes
16:36 <breadmonster> Okay.
16:36 thunderrd_ joined
16:36 <EvanR> you can also try it
16:36 <breadmonster> That's true, but it's a lot easier to ask.
16:36 <EvanR> classic
16:37 <EvanR> also the docs for parsec imply that the consumes the ending
16:37 <breadmonster> you know it's true.
16:37 <breadmonster> I know, I was just on IRC so I thought I'd ask.
16:37 Ch0c0late joined
16:37 <breadmonster> it's been so long since I've done this stuff, so like wtf is parsec3?
16:40 <hydraz> it's succ parsec2 :p
16:41 <geekosaur> parsec with support for Text and ByteString
16:42 <jasondockers_> haskell kind of feels like lambda calculus + FOL
16:42 <opqdonut> yes
16:42 <opqdonut> that's pretty much it, actually
16:42 steeze joined
16:42 <opqdonut> are you familiar with the curry-howard correspondence? types are propositions, programs are proofs
16:43 <jasondockers_> it's like the exact language I was wanting to make after learning about FOL and lambda calculus from a computation textbook, heh.
16:43 <jasondockers_> opqdonut, I am not aware of curry-howard correspondence, at least not by name.
16:43 abhiroop joined
16:43 jbiesnecker joined
16:44 jason85 joined
16:44 Guest72276 joined
16:47 eacameron joined
16:47 Apocalisp joined
16:47 <monochrom> breadmonster: "parsec3" is now simply known as "parsec".
16:47 sleffy joined
16:48 chbatey joined
16:50 ragepanda joined
16:52 boombanana joined
16:55 chrissound joined
16:56 abhiroop joined
16:56 gabluc joined
16:57 peterbecich joined
16:58 hamishmack joined
16:59 anuxivm left
16:59 futuristic joined
17:00 hamishmack joined
17:01 Lokathor_ joined
17:02 albertus1 joined
17:04 eacameron joined
17:04 martingale joined
17:04 iomonad joined
17:06 pera joined
17:07 utdemir joined
17:07 skeuomorf joined
17:09 Salih joined
17:10 eacameron joined
17:11 jbiesnecker joined
17:11 oish joined
17:16 eazar001 joined
17:17 eacameron joined
17:18 dan_f joined
17:19 <rdococ> ASSDF
17:21 MindlessDrone joined
17:21 xall joined
17:21 zivoni joined
17:22 sleffy joined
17:23 Goplat joined
17:24 des_ joined
17:24 eacameron joined
17:28 <Philonous> Can pattern synonyms not be infix?
17:29 abhiroop joined
17:29 USBoss joined
17:30 <cocreature> Philonous: their names need to start with a colon just like regular data constructors but apart from that it should work
17:30 <Philonous> Never mind, I was just missing the Language pragma ^_^
17:30 eacameron joined
17:31 abhiroop joined
17:33 calloc joined
17:33 ragepanda joined
17:33 BlueRavenGT joined
17:36 gawen joined
17:39 significance joined
17:40 kanbal joined
17:40 NickHu_ joined
17:40 medicijnman left
17:41 abhiroop joined
17:41 NickHu_ joined
17:42 RedNifre joined
17:45 Guest72276 joined
17:46 abhiroop joined
17:49 monochrom joined
17:49 chrissound joined
17:50 e14 joined
17:50 revprez_atlanta joined
17:50 <jasondockers_> opqdonut, oh, cool! now I'm aware of it
17:51 osa1 joined
17:51 osa1 joined
17:52 raycoll joined
17:53 BugsBunny__ joined
17:53 mfukar joined
17:54 <BugsBunny__> waddup
17:55 <BugsBunny__> i have the feeling all u guys are bots so im out.ciao
17:57 kanbal joined
17:57 <Jinxit> what's a good way to do a aequential map with a "working memory" along the list? foldr followed by reverse feels dumb
17:58 cpup joined
17:59 <mniip> has anyone ever thought about using Löb for an assembler?
17:59 <mniip> and/or linker
17:59 <mniip> e.g, say the branch instruction has multiple encodings depending on the size of the operand
17:59 kanbal left
17:59 <mniip> and the operand is the location of the invocation target, which ultimately depends on the size of the instructions inbetween
18:00 chaosmasttter joined
18:00 JuanMiguel joined
18:00 a3Dman joined
18:01 <cocreature> that reminds me, I still need to read quchen’s article about löb
18:01 <geekosaur> asm might work. linkers might be a bit too insane
18:02 jelleke joined
18:04 fotonzade joined
18:05 ragepanda joined
18:05 coltfred joined
18:05 fotonzade joined
18:06 <nshepperd_> Jinxit: traverse with State
18:07 <mniip> geekosaur, linkers sound exactly like a job for this
18:08 <Taneb> Jinxit, mapAccumL/R
18:08 <mniip> you can drop the big/medium/small data models and the like
18:08 <Taneb> (the most forgotten about functions in base)
18:08 utdemir joined
18:09 hybrid joined
18:10 abysslurker joined
18:12 dimsuz joined
18:13 e14 joined
18:13 ertesx joined
18:13 a3Dman joined
18:13 Ferdirand joined
18:14 <Jinxit> Taneb: perfect, thanks!
18:15 darkSeid_ joined
18:17 iqubic joined
18:17 gcross_ joined
18:17 <iqubic> Hello guys.
18:17 <cocreature> hey iqubic
18:17 <iqubic> Are there any build tools for Haskell programs. Something like CMake or Gradle?
18:18 <Taneb> iqubic, are Cabal and/or Stack what you're looking for
18:19 <opqdonut> there's also shake, which is a generic build system written in haskell
18:19 cyborg-one joined
18:19 <iqubic> Ah. I'll use Stack. I already have Stack.
18:19 danthemyth joined
18:19 <iqubic> Are there any Stack tutorials out there?
18:20 <opqdonut> https://docs.haskellstack.org/en/stable/README/#quick-start-guide
18:20 <cocreature> iqubic: https://docs.haskellstack.org/en/stable/README/#quick-start-guide
18:21 cchalmers joined
18:21 <iqubic> What's the difference between starting a ghci session with stack, and starting one without stack?
18:21 bbear joined
18:21 <srhb> iqubic: One has access to Stacks sandboxy-whatnot package db, the other does not, I think.
18:21 <cocreature> iqubic: starting it with stack will put the packages that your project depends on in scope and by default it will also load all modules that are part of your project
18:21 hoknamahn joined
18:22 <iqubic> Ah, I see.
18:22 <cocreature> it does just call ghci underneath so it’s only the convenience of having everything available automatically
18:22 bgamari joined
18:22 <iqubic> So it saves you the time and hassle of importing all the correct modules and loading your files?
18:23 <cocreature> setting up the right flags so you get access to your packages is probably more important actually
18:23 <iqubic> What does that mean?
18:24 <cocreature> iqubic: if your project depends on the package "text" and you run "stack ghci". stack ghci will automatically make the "text" package available and you can just run "import Data.Text"
18:24 <iqubic> Ah, that's cool.
18:25 <iqubic> Is that hard to do manually?
18:25 mkoenig joined
18:25 <cocreature> it’s not that hard. it’s just really annoying having to figure out where stack places your packages and figuring out all the right flags
18:25 <cocreature> iirc if you run "stack ghci --verbose" you can see the arguments stack passes to ghci
18:26 <cocreature> but apart from debugging stack itself there should be little reason to do so
18:26 <iqubic> How does one add a dependency to a stack build?
18:27 <cocreature> edit your cabal file and add it to the build-depends section
18:27 <iqubic> Is that explained in the stack tutorial you linked me too?
18:27 <iqubic> cocreature: I don't have cabal on my machine, just stack.
18:28 <cocreature> iqubic: stack still uses cabal project files
18:28 <iqubic> Why???
18:28 <cocreature> why not?
18:28 <iqubic> Because Stack and Cabal are different things.
18:28 <iqubic> That's why not
18:28 <cocreature> they’re closer than you might think
18:29 <iqubic> They are?
18:29 <cocreature> and the fact that they share the same project files means that you can use packages with both!
18:29 <iqubic> That must be why the Stack guide is just directly quoting stuff from the cabal guid.
18:29 jbiesnecker joined
18:32 JeanCarloMachado joined
18:32 zero_byte joined
18:32 dcoutts_ joined
18:34 pwnz0r joined
18:34 fakenerd joined
18:35 <lpaste> qmm pasted “cabal install lambdabot failure” at http://lpaste.net/354430
18:35 <qmm> if anyone has the time to help with a cabal install failure, i would greatly appreciate it
18:35 mazeinmaze_ joined
18:35 gugah joined
18:36 bgamari joined
18:36 EvanR_ joined
18:39 hc_ joined
18:40 SimpleL joined
18:40 sssilver joined
18:41 peterbecich joined
18:42 jbiesnecker joined
18:42 fizbin joined
18:42 Bob8989 joined
18:43 sigmundv joined
18:47 bollu joined
18:47 revprez_atlanta joined
18:51 sleffy joined
18:51 <geekosaur> qmm, what version of ghc do you have installed?
18:51 <geekosaur> that's a known OS X issue with older ghc
18:52 <qmm> geekosaur: 8.0.1
18:52 mbw joined
18:52 <geekosaur> ok, I think you want to upgrade to 8.0.2 for the fix
18:53 e14 joined
18:53 <qmm> doing that now. thanks geekosaur :)
18:54 bennofs joined
18:54 sagax joined
18:55 mda1 joined
18:55 <geekosaur> best anyone can tell, apple decided with sierra that everyone should live with the limitations of apple watches, so you need a ghc that handles libraries differently to fit within the limits of a device it doesn't run on >.>
18:58 chaosmasttter joined
18:58 abhiroop joined
19:04 masterjack joined
19:05 robotroll joined
19:06 zv joined
19:07 blocus joined
19:10 <lpaste> qmm pasted “lambdabot fails to install again, this time on ghc 8.0.2” at http://lpaste.net/354431
19:12 a3Dman joined
19:14 abhiroop joined
19:14 mojjo joined
19:14 <geekosaur> the actual error is somewhere before that paste, in the build for dependent-sum
19:14 CurryWurst joined
19:15 aarvar joined
19:16 USBoss joined
19:16 ragepanda joined
19:17 danthemyth joined
19:18 abhiroop joined
19:18 utdemir joined
19:19 slacker joined
19:19 masterjack left
19:23 fizbin joined
19:23 tristanp joined
19:24 mbw joined
19:24 fakenerd joined
19:24 merijn joined
19:25 <tsahyt> I'm getting the weirdest error here. foo = case sameNat (Proxy @3) (Proxy @(Gcd 3 6)) \\ gcdNat @3 @6 of Just Refl -> ()
19:25 abhiroop joined
19:25 <tsahyt> Gcd and gcdNat is from the constraints package
19:25 <tsahyt> this doesn't compile with an Inaccessible code error
19:26 mada joined
19:26 muesli4 joined
19:27 <tsahyt> does anyone have an idea what's going on here? the types should be equal after all. sameNat does runtime evaluation via comparing natVals, and through gcdNat I get the KnownNat instance for Gcd 3 6 in scope.
19:27 <mbw> Hello I have a question about writing polymorphic code. While it is possible to use maps and folds etc. in a straightforward manner, Stuff like scans or filters are not. For instance I was able to write a function which uses a list comprehension/filter internally and using OverloadedLists&Friends got this type signature: "makeNewClusters :: (Applicative f, Num (Item (t Word64)), Foldable t, Monoid (f
19:27 <mbw> (Cluster a)), Fractional a, Enum (Item (t Word64)), IsList (t Word64), MonadZip t) => t (PointSum a) -> f (Cluster a)". This can't be the way to go. On the other hand, lists and vectors for instance share a similar interface. What would be the most straightforward way to exploit this? Using a type synonym?
19:28 mmachenry joined
19:28 Xandaros joined
19:28 systemfault joined
19:29 <JuPaname> hi you need free shell account contact me PM =)
19:29 <cocreature> mbw: what do you need the IsList constraint for?
19:30 Wuzzy joined
19:30 jaguar joined
19:30 acarrico joined
19:30 a3Dman joined
19:30 <tsahyt> am I possibly even facing a compiler bug here?
19:31 <mbw> cocreature: This comes from the OverloadedList extension and something along the lines of f inp = zip [0..] (toList inp).
19:31 <cocreature> mbw: it seems like you are converting to a list anyway so just take a list as your input and leave it up to the caller to convert to the list
19:32 <cocreature> I don’t think IsList is really meant as a typeclass that you should parametrize functions over. it’s only there for overloading list syntax
19:33 <cocreature> tsahyt: could you post a complete example please?
19:33 <tsahyt> that is pretty much a complete example already. I'll put it together with the error message
19:33 <cocreature> tsahyt: I’m not too keen on figuring out the proper imports myself :)
19:33 <mbw> cocreature: The type signature I wrote above comes from Marlow's Book, specifically the kmeans problem. The original type signature was makeNewClusters :: Vector PointSum -> [Cluster].
19:34 <mbw> So I was just trying to make it a little more list/vector agnostic. Apparently it's not that easy outside the realm of Foldable/Traversable.
19:34 <cocreature> mbw: as a rule of thumb, don’t make your functions polymorphic if you explicitely have to convert your inputs or your outputs.
19:35 <cocreature> if the first thing you are doing to your input is calling "toList" on it than you can just accept lists
19:35 <cocreature> if you are calling "fromList" on your output then just return a list instead
19:35 <lpaste> tsahyt pasted “No title” at http://lpaste.net/354432
19:35 <cocreature> if you can actually avoid those conversions then by all means go ahead and make things polymorphic!
19:35 oisdk joined
19:35 <tsahyt> cocreature: ^
19:36 fractalsea joined
19:36 <tsahyt> this is the smallest example I could come up with that recreates the same error as in my larger file
19:36 <tsahyt> in the larger example I have type variables instead of 3 and 6
19:39 <mbw> cocreature: The main body consists basically of a zip&filter: makeNewClusters vec = [ pointSumToCluster i ps | (i,ps@(PointSum count _ _)) <- zip [0..] (toList vec) , count > 0 ]. This is the definition given in Marlow's book, the only difference being his use of "Vector.toList". Is there any way to make this kind of function polymorphic? My impression is yes (you can implement a filter with foldMap), but
19:39 <mbw> this bloats the type signature.
19:39 dmwit joined
19:39 abhiroop joined
19:40 <mbw> Your advice to just omit the toList and let the caller handle it, seems reasonable though.
19:40 <lpaste> qmm pasted “dependent-sum build failure” at http://lpaste.net/354433
19:40 dawehner joined
19:41 nbro joined
19:41 <nbro> hi
19:41 <qmm> geekosaur: build failures probably aren't interesting, so thank you for your help
19:41 <nbro> what’s the real purpose of kinds in Haskell?
19:42 <nbro> I understood that they are "types of data types"
19:42 <nbro> but why would I need to classify also the data types?
19:42 <JuPaname> you need free shell account ? contact me PM
19:42 <monochrom> I don't know about real purpose, but one thing it does is to tell me which types have values and which types need parameters, and what parameters.
19:42 <geekosaur> qmm, looks like you need to build it from git for ghc 8
19:42 was kicked by monochrom: JuPaname
19:43 <nbro> monochrom: I read that kinds is not just about tell you about the arity of types
19:43 <qmm> geekosaur: it = ghc 8.0.2 or dependent-sum?
19:43 <nbro> *telling
19:43 <geekosaur> dependent-sum
19:43 <tsahyt> nbro: for example you can then write types that only accept type parameters of a certain kind
19:44 <monochrom> That right nbro, "Either IO Int" is still legal because it is not true that IO::*
19:44 <monochrom> err, illegal!
19:44 <nbro> tsahyt: examples?
19:44 <tsahyt> nbro: using the DataKinds extension you can also lift types onto the kind level, i.e. types become kinds, their values become types in their own right
19:45 <monochrom> This is why I also said "and what parameters".
19:45 <cocreature> tsahyt: I’m not too familiar with the constraints package but iirc it doesn’t magically resolve this constraints. you need to explicitely pattern match on the appropriate axioms to get GHC to be happy
19:45 <monochrom> tsahyt, I don't think DataKinds makes things clearer.
19:45 <tsahyt> monochrom: I was writing this before nbro asked for an example
19:45 <monochrom> Ah OK.
19:45 <nbro> tsahyt: why would you want to make types kinds and values types?
19:46 <tsahyt> but an example would be type level natural numbers
19:46 zivoni left
19:46 <tsahyt> or something simpler like say, data Message (e :: EncryptionState) = ...
19:46 joe9 joined
19:46 <tsahyt> though of course you can get most of what you could do with that without the lifting
19:47 kritzcreek_ joined
19:47 <tsahyt> nbro: have you seen the servant library? the type level language defined by it makes some use of type level strings (Symbol)
19:48 iomonad joined
19:48 <joe9> need some advice, please? I am communicating with a socket using bytestrings. I am using cereal for the serialization of data. But, when deserializing, I find that the Data.Serialize.Get to be very limited and I want to use Attoparsec for just the parsing portion. I feel that I am doing something wrong as both cereal and attoparsec seem to be geared to similar functionality.
19:49 <joe9> I can use the Serialize.Get and .Put classes when writing or reading stuff from the socket. But, for the parsing, I want to use Attoparsec. Is that a good idea?
19:49 <nbro> tsahyt: what exactly do you mean by type level language and type level strings?
19:51 <tsahyt> nbro: it's a domain specific language, but on the type level
19:51 <joe9> tsahyt: why not use idris?
19:51 <tsahyt> joe9: why use idris?
19:52 <joe9> or, something geared for dependent types? it has more flexibility for dealing with types
19:52 Majiir joined
19:52 <tsahyt> none of these languages is suitable for production use at the moment imo
19:52 JuanDaugherty joined
19:52 <tsahyt> and idris has other things that I really don't want, e.g. eager evaluation by default
19:52 <nbro> tsahyt: by "domain specific language" one usually means that there’s a domain
19:53 <nbro> what’s the domain?
19:53 <tsahyt> nbro: web APIs
19:53 <monochrom> Yes, Idris is a better language for dependent types. Haskell's is just an encoding, and as with all encodings, cumbersome and fragile.
19:53 <tsahyt> nbro: example from their docs. type UserAPI = "users" :> QueryParam "sortby" SortBy :> Get '[JSON] [User]
19:53 <tsahyt> nbro: note the "users" in there. that is of kind Symbol
19:53 <mbw> Ok I should probably ask a more general question, which gives a clue about my motivation. Say I want to write some numerical code in Haskell. At places an array/vector is more suitable than a list. On the other hand, the latter may be more suitable to generate data lazily. However I probably won't know beforehand which representation is the right one for a specific kind of problem. So I might choose a
19:53 <monochrom> OTOH, sometimes you still use Haskell because you have other factors to worry about.
19:53 <mbw> specific one, say a vector and then maybe change it later-on. So the question is: Is there a way to "prepare" this kind of transition, taking into account that list/vector apis are similar and I would like to "change representations" in a minimally invasive way?
19:53 <tsahyt> or the "sortby". or the '[JSON] for that matter
19:53 <tsahyt> which is a type level list
19:54 <tsahyt> monochrom: or sometimes you use haskell just to see how far exactly you can push GHC. which is what I've been doing for the last couple of days
19:54 <tsahyt> the more I do this, the more I find myself longing for -XDependentTypes
19:55 Mysterious_Light joined
19:56 e14 joined
19:57 <nbro> tsahyt: honestly I still don’t understand what you mean by type level language, i.e. it’s a language at the level of types, but that’s the meaning of having a language at the level of types?
19:57 <nbro> *but what’s the meaning
19:59 <joe9> tsahyt: a word of warning, when I find myself dealing that with types, I am mostly doing something wrong. If the types are not clear, I find myself in the anti-pattern zone. this is imho.
20:00 <tsahyt> nbro: the meaning is that you have a language to express types. your API endpoint is a type. and by some typeclass magic you can have GHC derive routing and many other things for it.
20:00 <tsahyt> joe9: in response to what? the Gcd example I posted above?
20:01 <joe9> tsahyt: the type level list stuff. that would be a heterogenous list, correct?
20:01 <tsahyt> I think so, yes.
20:02 significance joined
20:02 <tsahyt> but it works out very well for servant
20:02 <glguy> a type level list is different
20:02 <nbro> tsahyt: so the language to express types is actually this kind system?
20:02 <glguy> one might use a type level list when implementing a"heterogeneous" list
20:03 <tsahyt> nbro: well the kind system makes sure that the API descriptions aren't just gibberish. for example the first parameter to QueryParam in the example above must be a string
20:03 <tsahyt> if you didn't have kinds, it could be anything
20:03 <glguy> but the type level list is a concept independent of that
20:04 <tsahyt> nbro: another very interesting kind are constraints. E.g. Eq a => ..., the Eq a thing is a constraint, and with the ConstraintKinds extension those do have their own kind.
20:04 <tsahyt> this leads to a situation where you can actually get an explicit dictionary out of it and pass that around
20:04 <tsahyt> see the constraints package for more on this
20:05 <glguy> type level lists themselves are homogenous, all their elements will have the same kind
20:06 <nbro> tsahyt: so if the kind system is not the language to express types, then what’s this language?
20:07 oish joined
20:07 <tsahyt> what do you mean with the language to express types
20:07 <nbro> tsahyt: you said "the meaning is that you have a language to express types"
20:08 <tsahyt> servant is a language to express very particular types. it's all still haskell. think of it like an embedded domain specific language, just on the type level rather than the value level.
20:09 <tsahyt> the "base language" is the very same that you use to write any other type as well
20:09 carousel joined
20:10 cchalmers joined
20:10 <joe9> glguy: sorry to bother you. I think you seemed well versed with binary serialization/deserialization. I am using cereal but I find that cereal does not have much functionality for parsing. I am thinking of using attoparsec just for parsing. Just want to check if it is a bad idea to use cereal (for serialization/deserialization wrappers) + attoparsec (for parsing only)
20:11 <nbro> tsahyt: so, it’s kind of an interpreter (written in Haskell) for a language to creaet web services
20:11 <nbro> the servant library
20:11 <tsahyt> well it gets interpreted by the compiler at compile time
20:12 <tsahyt> nbro: https://www.well-typed.com/blog/2015/11/implementing-a-minimal-version-of-haskell-servant/ this blog post implements a mini version of it and is rather accessible
20:12 fizbin joined
20:13 <Sornaensis> > 0.1 + 0.2 == 0.3
20:13 <lambdabot> False
20:13 <Sornaensis> QED
20:14 <glguy> joe9, I typically would use both but I don't think it's going to be that much of a problem if you do. what's keeping you from just using one?
20:14 <glguy> would not use
20:14 <nbro> :k Maybe Int
20:14 <lambdabot> *
20:14 <mauke> > 0.1 + 0.2 == (0.3 :: Rational)
20:14 <lambdabot> True
20:14 <Sornaensis> ;p
20:15 <nbro> so, from what I undestood, kinds are a way to categorize types
20:15 <Sornaensis> :k Maybe
20:15 <lambdabot> * -> *
20:15 <joe9> glguy: the data format that I am dealing with has fields separated by '\0' characters. using cereal, I find that i would have to write something similar to the takeWhile1 of attoparsec
20:15 <Sornaensis> :k Maybe Int
20:15 <lambdabot> *
20:15 <joe9> glguy: If I use attoparsec, I get takeWhile1 for free.
20:15 chbatey joined
20:16 <Sornaensis> Maybe is like a type function that takes another type of kind *
20:16 <nbro> and we can use kinds whenever we want to restrict the types
20:16 <joe9> glguy: not sure if I am missing something with cereal and if it has something similar that I am missing.
20:16 <nbro> but I’m still not visaulizing in which circumstances you want to do that
20:16 <nbro> in which real world cases a Haskell programmer would take benefit from it
20:16 <mauke> > Just 42 :: Maybe
20:16 <lambdabot> error:
20:16 <lambdabot> • Expecting one more argument to ‘Maybe’
20:16 <lambdabot> Expected a type, but ‘Maybe’ has kind ‘* -> *’
20:17 <mauke> that's a kind error
20:17 e14 joined
20:17 <nbro> it seems to me that kinds is just a way to solidify the type system
20:18 <nbro> since you use types but not kinds, you won’t face the need to generalize kinds
20:18 <glguy> joe9: then you might as well use attoparsec
20:18 tristanp joined
20:18 <tsahyt> nbro: well, you do. but that's getting into theoretical territory
20:18 <nbro> if people keep introducing new kinds, I guess at a certain point we’ll also need to categorize them
20:19 <joe9> glguy: ok, Thanks. just wanted to make sure that I am not missing something simple.
20:19 <glguy> joe9: builder is in bytestring already, you might not need cereal at all
20:19 <tsahyt> see the TypeInType extension for that
20:19 utdemir joined
20:19 <joe9> glguy: blaze-builder?
20:19 <tsahyt> nbro: kinds occur implicitly all over the place. for example the Functor class
20:19 <nbro> even though I have actually not a clear idea of what it means
20:19 JuanMiguel joined
20:19 <glguy> joe9: just the normal bytestring
20:19 <tsahyt> written explicitly, it'd be class Functor (f :: * -> *) where
20:20 <joe9> glguy: oh, ok. will check on that. Thanks a lot. good information.
20:20 ralu joined
20:20 <joe9> glguy: just builder + attoparsec then?
20:20 <tsahyt> nbro: when you try writing a functor instance for e.g. Text, which has kind *, GHC will give you a kind error
20:20 iqubic joined
20:21 <glguy> sure, that's general a good pairing
20:21 <glguy> generally*
20:21 <iqubic> What's the pairing?
20:21 <nbro> tsahyt: ok, it means Text can’t be an instance of Functor
20:21 <tsahyt> yes
20:21 <joe9> glguy: Thanks again. very relevant and helpful.
20:21 <tsahyt> because it has the wrong kind
20:21 <Sornaensis> kinds are wonderful, I wish I could have higher kinded types in e.g. rust
20:22 <nbro> tsahyt: because Text doesn’t require parameters?
20:22 <ralu> @djinn (a -> (b,c)) -> ((b -> a) -> c)
20:22 <lambdabot> -- f cannot be realized.
20:22 <mauke> nbro: correct
20:22 <iqubic> Whay can't Text be a functor?
20:22 <Sornaensis> @djinn forall a. a -> a
20:22 <lambdabot> f a = a
20:22 <glguy> :t fmap
20:22 <lambdabot> Functor f => (a -> b) -> f a -> f b
20:22 <glguy> what would it mean to use Text as f?
20:23 <Sornaensis> :k Text
20:23 <lambdabot> error:
20:23 <lambdabot> Not in scope: type constructor or class ‘Text’
20:23 <Sornaensis> :k Data.Text.Text
20:23 <lambdabot> *
20:23 <glguy> (a -> b) -> Text a -> Text b?
20:23 <Sornaensis> you can't apply Text to a type
20:23 e14 joined
20:23 <iqubic> What the heck does text even do?
20:23 <joe9> glguy: quick question, I am using this for the socket connection and interface https://hackage.haskell.org/package/connection-0.2.8/docs/Network-Connection.html
20:23 <mauke> iqubic: hi
20:23 <Sornaensis> iqubic: space efficient strings
20:23 <nbro> it looks to me that "Text a" requires a parameter "a"
20:24 <iqubic> Sure does.
20:24 <joe9> glguy: but, the Network.Connection uses Strict ByteStrings. Whereas, builder is using lazy bytestrings
20:24 <nbro> but why doesn’t it have a kind * -> *?
20:24 <mauke> nbro: huh?
20:24 <glguy> joe9 convert the lazy one to chunks
20:24 <glguy> send each chunk
20:24 <nbro> why doesn’t Text have a kind * -> *?
20:24 <geekosaur> what would that even mean?
20:24 <mauke> nbro: because it takes no arguments
20:25 <Sornaensis> @src Data.Text.Text
20:25 <lambdabot> Source not found. The more you drive -- the dumber you get.
20:25 fizbin joined
20:25 <joe9> glguy: ok, Thanks.
20:26 <nbro> mauke: I guess I’m confusing parameters with arguments, but isn’t "a" in "Text a" an argument that Text needs?
20:26 <mauke> nbro: where did you get 'Text a' from?
20:26 <glguy> Functor only makes sense for types that have parameters. Text doesn't have a parameter, so you can't make a functor instance for it
20:26 <Sornaensis> @djinn forall a b. (a -> b) -> Maybe a -> Maybe b
20:26 <lambdabot> f a b =
20:26 <lambdabot> case b of
20:26 <lambdabot> Nothing -> Nothing
20:26 <lambdabot> Just c -> Just (a c)
20:26 <Sornaensis> cool
20:26 <nbro> mauke: glguy wrote "(a -> b) -> Text a -> Text b"
20:26 <mauke> nbro: yes, as an explanation of why 'Functor Text' makes no sense
20:27 <mauke> it's supposed to be an error
20:28 coot joined
20:30 <glguy> Functor isn't the generalization of "container" , it's the generalization of parameterized types that use that parameter in only positive positions
20:31 <nbro> glguy: "positive positions"?
20:31 <nbro> what’s the meaning?
20:32 <nbro> it implies there are negative positions
20:32 <nbro> positions of what?
20:32 <* mauke> prepares for counting arrows
20:32 <nbro> there’s an order
20:32 <glguy> maybe someone can write more about it who isn't swyping on a phone?
20:33 eacameron joined
20:35 pwnz0r joined
20:36 agranero joined
20:36 louispan joined
20:37 Itkovian joined
20:38 <monochrom> Starting from the basic examples, in "X -> Y", X is in a negative position, Y is in a positive position.
20:39 Majiir joined
20:39 <nbro> monochrom: and in something like a -> b -> c?
20:39 anry joined
20:40 <monochrom> The fun begins with "(X -> R) -> R". The common convention of "two negatives make a positive" applies. X would be negative in "X -> R" if "X -> R" were alone. But "X -> R" in turn is negative in the whole "(X -> R) -> R". So overall X is under a double-negative and comes out as positive, overall.
20:40 <monochrom> A -> B -> C can be easily analyzed as A -> (B -> C).
20:41 jeltsch joined
20:41 <nbro> (B -> C) would be in a positive position?
20:41 int-index joined
20:42 <monochrom> Yes.
20:44 <agranero> Hi. Has someone tried to install wxHaskell?
20:45 ph88 joined
20:46 <ph88> hi guys, i don't quite understand this error https://bpaste.net/show/62784a97718f what is expected and what is actual ?
20:47 <mauke> ph88: what do you mean by "expected" and "actual"?
20:47 abhiroop joined
20:48 <ph88> mauke, well it says Couldn't match type ‘BaseBackend ()’ with ‘SqlBackend’ so i guessed that one of those types is the expected type and the other is the actual type
20:48 eazar001 joined
20:50 <agranero> Hi. I have tried to install wxHaskell and got:
20:50 <agranero> I have tried to install wxHaskell and got:cabal install wx
20:50 <agranero> Resolving dependencies...
20:50 <agranero> cabal: Could not resolve dependencies:
20:50 <agranero> trying: base- (dependency of wx-
20:50 <agranero> trying: directory- (dependency of wxcore-
20:50 kmein joined
20:50 <agranero> trying: wxdirect- (dependency of wxcore-
20:50 <agranero> next goal: process (dependency of wxdirect-
20:50 <agranero> rejecting: process-, process-, process-,
20:50 <ph88> agranero, are you using stack ?
20:50 <agranero> process-, process-, process-, process-,
20:51 <agranero> process- (conflict: wxdirect => process>=1.1 && <1.3)
20:51 <agranero> rejecting: process-, process-, process- (conflict:
20:51 <agranero> base==, process => base>=4.4 && <4.9)
20:51 <agranero> rejecting: process- (conflict: base==, process
20:51 <agranero> => base>=4.4 && <4.8)
20:51 <agranero> rejecting: process- (conflict: directory==,
20:51 <agranero> process => directory>=1.0 && <1.3)
20:51 <MarcelineVQ> stahp, freenode'll get mad :X
20:51 <agranero> rejecting: process-, process- (conflict:
20:51 <agranero> directory==, process => directory>=1.0 && <1.2)
20:51 <nbro> agranero: maybe you should paste this output on something like pastebin?
20:51 <MarcelineVQ> use a pastebin
20:51 <ph88> rejecting !
20:51 <agranero> rejecting: process-, process-, process-, process-,
20:51 <EvanR> too late
20:51 hoknamahn joined
20:51 <agranero> process-, process- (conflict: wxdirect => process>=1.1 && <1.3)
20:51 <agranero> Backjump limit reached (currently 2000, change with --max-backjumps or try to
20:51 <agranero> run with --reorder-goals).
20:51 <agranero>
20:51 <agranero> Stack gives better messages
20:51 <ph88> ok so try stack
20:52 <int-index> mauke, what's the type of 'app'? I suspect the problem is that 'pool' has type 'SqlBackend' and 'app' expects 'BaseBackend'
20:52 kmein left
20:53 <geekosaur> in any case what it's telling you is that it needs a version of the process library that is too old for the other dependencies to work (note that some of those dependencies come with ghc, so it's really telling you that you need an older ghc)
20:53 <mauke> ph88: is that the whole error?
20:53 <agranero> It recommends putting some dependencies in the yaml. Which I did. But in the end I gor: Error: While constructing the build plan, the following exceptions were encountered: In the dependencies for wxdirect- process- must match >=1.1 && <1.3 (latest applicable is
20:53 <monochrom> wxHaskell is probably too old and without an update for recent compilers and libraries.
20:53 zcourts joined
20:54 <int-index> oh I should've addressed ph88. sorry
20:54 <monochrom> The least effort to proceed is to use an old GHC.
20:54 <int-index> what's the type of 'app'?
20:54 <agranero> I had a similar problem in wxPython. But I just spent a week rewriting the build scripts and got it.
20:54 <monochrom> But the most ideal is you update wxHaskell :)
20:54 <agranero> But with Haskell I am completelly lost.I had just downloaded the last version. But I am using GHCi on Windows.
20:55 <agranero> wxHaskell I got the last version too.
20:55 <agranero> Just from sourceforge where it resides according to wxHaskell docs on haskell.org
20:55 <monochrom> You will have to know a thing or two about cabal, for example what do the *.cabal files mean.
20:56 <agranero> I tried a sandbox, but ...
20:57 zcourts joined
20:57 <agranero> I thought I could isolate the conflicting dependencies in a Sandbox but I could not get it to work.
20:57 <monochrom> And then we do have this convention that huge jumps in version numbers imply significant changes in APIs, so there may be some actual code you have to investigate and change accordingly.
20:57 JuPaname_ joined
20:58 darjeeling_ joined
20:58 <agranero> wx is complicated on any platform. With Python the scripts were a nightmare. I needed to rewrite everything, a lot o hardcoded paths a bad mix of python2 nd 3....really bad
20:58 was kicked by monochrom: Free_Shell
21:00 <ph88> mauke, yes that's the whole error .. there is more info in the error but that is just to tell the location .. in the second argument .. in the expression blabla
21:00 zcourts joined
21:01 <ph88> int-index, app :: SpockM () MySession MyAppState ()
21:01 graygoose124 joined
21:01 oish joined
21:01 jbiesnecker joined
21:01 <agranero> I think wx is very good. But I am thinking on using another GUI. But I had trouble even with things that were supposed to be simple as ncurses. But at leas t=in this case are two lacking c libraries. In Linux I bet it works. On wx case not even on Linux the thing goes on...
21:01 <monochrom> ncurses is not actually simple. (Unless you just mean installing.)
21:02 <int-index> ph88, this seems to be the problem. Follow the types. You need to change the first parameter of SpockM - it represents the type of db connection
21:02 <agranero> Yes I mean installing
21:02 <monochrom> Namely, the effort of binding ncurses to Haskell really shows how ncurses maximizes the unpredictability of mutable states.
21:02 acarrico joined
21:03 tripped joined
21:04 <agranero> I'm still in the install phase. I know on Windows things are a little more confuse. But my experience with wx on other languages is that is always complicated (except in C++).
21:04 <nbro> does the term actions only makes sense in the case of the IO monad?
21:05 Deide joined
21:05 <monochrom> You need a matchingly older GHC.
21:05 <nbro> i.e. IO actions
21:05 <agranero> Yep. Thought of that.
21:05 <ph88> int-index, good find, it worked right away !
21:05 oish joined
21:05 <monochrom> And back in those days, I also recall needing a matching version of wx itself.
21:05 t7 joined
21:05 Boomerang joined
21:06 <agranero> Maybe one a few years older. I just needed to know what version I should use. Can I install an older GHCi side by side with a newer? Won't cabal and stack get confused?
21:06 <monochrom> nbro: You can use it for all monads.
21:07 <monochrom> Actually I don't think people will mind if it's Applicative too.
21:07 jbiesnecker joined
21:08 Mysterious_Light joined
21:08 cchalmers joined
21:08 <monochrom> agranero: You can have multiple versions of GHC co-existing. cabal always do a test first ("ghc --version") and cope. I don't know about stack.
21:09 <monochrom> And there are two ways to co-exist.
21:10 <monochrom> The lazy way is you just install without thinking. Then you will find in /usr/local/bin a "ghc", a "ghc-8.0.2", and a "ghc-6.10.4" or something. "ghc" is a link to the one you most recently installed.
21:10 <monochrom> And you're on Windows so it is not really /usr/local/bin but it's the same idea.
21:11 <monochrom> There is a flag you can give cabal to specify "I really mean ghc-6.10.4".
21:11 eacameron joined
21:11 <nbro> monochrom: so what’s an action actually?
21:12 <nbro> I understood there are different types of actions
21:12 <nbro> it seems actions are related to monads
21:12 <monochrom> The eager way is to "./configure --prefix=this_directory_is_reserved_for_ghc_6-10-4" and play with PATH.
21:12 abhiroop joined
21:13 <monochrom> An action is a value of type "M A" where M is an instance of Monad or Applicative.
21:13 <agranero> monochrom: Ok. I will try that. I think is the way to go. I think I will also clean the mess I did with cabal, sandboxes, stack, etc. And make a clen install too.
21:13 <monochrom> If you see "xxx :: ReaderT blah blah blah" then you can say that xxx is an action.
21:13 <nbro> monochrom: or functor, too?
21:13 <agranero> monochrom: Thanks. I will let you know me progress if I see you again.
21:14 <monochrom> I don't think we have really thought about that. You seldom have a Functor-only type.
21:14 <ph88> how can i serve some static html with spock ?
21:14 <nbro> xxx is an action?! isn’t that the syntax for the signature of a function and xxx would be the name of the function?
21:15 <monochrom> OK look, if I say "Joseph was a carpenter", you wouldn't tell me "but Joseph is just a name", would you?
21:16 ph88 joined
21:17 t0by joined
21:17 t0by joined
21:17 <ph88> eh i got disconnected, anyone know how to server up a static html with spock ?
21:19 AdolphusGustavus joined
21:20 kattak joined
21:20 utdemir joined
21:20 significance joined
21:21 {emptyset} joined
21:21 AdolphusGustavus joined
21:21 skytp joined
21:22 <joe9> in attoparsec, what is the difference between sepBy and sepBy' : "The value returned by p is forced to WHNF." is what the docs say. Is it common to use sepBy?
21:22 AdolphusGustavus joined
21:22 <glguy> joe9: Are you asking what WHNF is?
21:22 <nshepperd> "xxx" is the name of the value. xxx is the value. the menu is not the meal :p
21:22 AdolphusGustavus joined
21:22 jbiesnecker joined
21:23 AdolphusGustavus joined
21:23 <joe9> glguy: WHNF == lazy?
21:24 AdolphusGustavus joined
21:24 Proteus joined
21:24 skytp left
21:24 <glguy> No
21:25 <joe9> ok, Thanks
21:25 <joe9> found this http://stackoverflow.com/questions/6872898/haskell-what-is-weak-head-normal-form
21:25 <monochrom> But you will need to know lazy evaluation to know what the sentence is talking about.
21:26 Micamo joined
21:27 <monochrom> If you do a simple "return (1+1)" it does not mean that the 1+1 there is evaluated immediately.
21:27 <nshepperd> hm. if you have a value x that is in WHNF, is that equivalent to knowing that x is not ⊥?
21:27 RonnieHolm joined
21:28 <monochrom> So take for example sepBy (char 'x' >> return (1+1)) (char ',')
21:28 <glguy> nshepperd: I don't think it's equivalent because I can know something is not bottom without it being in WHNF
21:28 <monochrom> You will get a list like [1+1, 1+1, 1+1] rather than [2, 2, 2]. sepBy' is the one who gives you [2, 2, 2].
21:29 <nshepperd> i suppose that is true. you could determine it by program analysis
21:29 <monochrom> Sometimes it matters, sometimes not. 1+1 is a simple case of not mattering, but that's only because 1+1 is so small.
21:30 e14 joined
21:31 <monochrom> I am not sure about equivalence, but the implication in the direction "is in WHNF => is not bottom" is true during run time.
21:31 Goplat joined
21:32 tristanp joined
21:32 <monochrom> Because during run time if you seq or case on something, and the program survives that test, then you still haven't run into a show-stopping bottom.
21:33 jbiesnecker joined
21:33 <Sornaensis> :t f :: (a -> b -> b) -> b -> [a] -> _
21:33 <lambdabot> error:
21:33 <lambdabot> • No instance for (FromExpr t1)
21:33 <lambdabot> Possible fix:
21:35 <monochrom> To anthropomorphize a running program, "I think, therefore the value exists".
21:35 <nshepperd> hah
21:36 <nshepperd> i suppose in liquidhaskell you can even write this in types? eg. ($!) :: ({x :: a | x ≠ ⊥} -> b) -> a -> b
21:37 splanch joined
21:37 <monochrom> w00t, Liquid Haskell knows about bottom?
21:37 <nshepperd> i remember something about it having totality checking...
21:37 <nshepperd> i don't really know though :p
21:37 JuPaname joined
21:38 <monochrom> Yeah but there is still a difference between "we bake totality into the semantics of ->" and "we let you say ≠ ⊥"
21:40 <nshepperd> oh, it looks like it doesn't
21:41 anuxivm joined
21:41 <monochrom> hehe
21:42 <joe9> monochrom: nshepperd Thanks a lot.
21:43 Sose_ joined
21:44 wroathe joined
21:45 gcross_ joined
21:45 SpaceGazebo2 joined
21:45 sssilver joined
21:46 <wroathe> Is there a way to list instances of a particular typeclass? For instance, "Which types are functors?"
21:47 <glguy> Use :info! Functor in GHCi
21:48 <wroathe> I suppose this would only be for the currently imported modules, right?
21:48 <wroathe> and thanks @glguy
21:48 <glguy> Use regular :info to restrict it to the loaded modules
21:48 meteo joined
21:49 eacameron joined
21:49 <wroathe> Great. Thanks!
21:52 electrocat left
21:52 hiratara joined
21:53 mda1 joined
21:54 serendependy joined
21:55 gawen joined
21:56 splanch joined
21:56 eacameron joined
21:59 JuPaname joined
21:59 EvanR_ joined
21:59 Guest72276 joined
22:00 acarrico joined
22:01 zero_byte joined
22:02 ludat joined
22:03 madjestic joined
22:03 eacameron joined
22:05 zariuq joined
22:06 tristanp joined
22:07 jbiesnecker joined
22:09 zargoertzel joined
22:10 abhiroop joined
22:11 eacameron joined
22:11 wraithm joined
22:11 epsilonhalbe joined
22:14 <bbear> hello
22:14 <bbear> If I want to read my input sequentially into an infinite loop, how can I do that ?
22:18 eacameron joined
22:19 jbiesnecker joined
22:19 fotonzade joined
22:19 bjz joined
22:20 Boomeran1 joined
22:20 utdemir joined
22:21 <ertes> bbear: what are you going to do with the input?
22:21 <bbear> parse them and create a list of coordinates
22:21 wroathe_ joined
22:21 <bbear> data Coord = C Int Int
22:22 <EvanR> an infinite list?
22:22 <ertes> bbear: that doesn't sound like an infinite loop
22:22 <ertes> unless your input is indeed infinite, in which case i need to ask what you're going to do with the coordinates as well
22:23 HugoDaniel joined
22:23 <EvanR> (would be nice if you didnt have to know all that )
22:23 <bbear> actually i'm playing a puzzle game where the game output a bunch of data at each turn
22:24 <bbear> there is no guarantee that the game ever termin so the input is not really infinite but I don't have clue about the length of the input data to parse.
22:24 <mac10688> gameincode?
22:24 <bbear> I suppose this could be interesting to know
22:24 <ertes> bbear: is the game's output easily delimitable? like line-by-line
22:24 <bbear> yes
22:24 <bbear> for each turn I know very well how the data looks like.
22:24 <ertes> bbear: in that case i recommend a streaming abstraction like pipes
22:25 <ertes> write the raw input from the game as a Producer, then write a Pipe that turns raw input into chunks of information (like lines)
22:25 <bbear> yes codingame
22:25 <bbear> ertes: thanks for your suggestion.
22:25 <mac10688> yeah codeingame, my bad. what's the name of the problem?
22:25 <bbear> it's thor / upper level
22:26 <ertes> (there is actually a better was to delimit input (pipes-group), but it has quite a learning curve unfortunately)
22:26 <bbear> i'm trying to get good at haskell, and haskell helps me back at being good at coding.
22:26 <ertes> s/better was/better way/
22:26 <bbear> but yeah, the learning curve.
22:26 <mac10688> Power Of Thor, easy mode?
22:27 <bbear> no hard mode
22:27 wroathe joined
22:27 <bbear> I already solved easy mode. I believe the proper way to learn haskell is to go back and forth from theory to problems to theory to problems, etc.
22:28 <bbear> I'm struggling with the monad concept
22:28 <bbear> maybe it requires a bit more of habit.
22:28 <bbear> Do you suggest to avoid syntactic sugar and go with (=<<) operators ?
22:29 <ertes> bbear: not necessarily, just be sure to know how the sugar is eliminated
22:29 <bbear> ok
22:29 <ertes> bbear: i have observed that the biggest mystery to many people is not "monads", but more: "that's it?"
22:29 <bbear> that's it ?
22:29 <bbear> what do you mean by that's it ?
22:30 <ertes> "monads are instances of this class with these laws"
22:30 fizbin joined
22:30 <bbear> yes that's it
22:30 <seequ_> I can attest to that. It took me so long to understand why they are so useful when they do so little.
22:30 <bbear> how to use it in actual programming is way more hard.
22:31 <bbear> I mean to know where and how to use it in programming.
22:31 <bbear> That's kind of the difficult part.
22:31 <bbear> for example, why monads ? I bet the ans
22:31 <ertes> that's why i like to compare them to monoids
22:31 <bbear> same thing for monoids, functors, any abstract construct actually.
22:31 <ertes> the two important points are: 1. there are at least two monoids, 2. you can abstract over them (e.g. foldMap)
22:31 hiratara joined
22:32 tristanp joined
22:32 <bbear> It is hard to build a meaning ful conception of them if you don't see real application in real problems (wow, a lot of the pupils I taught told me that. It's actually true in fact).
22:33 <bbear> what would be the type of a function reading for example stdin and returning a list of string ?
22:33 presiden joined
22:33 <bbear> readListOfInt :: Int -> [Int]
22:33 <ertes> it wouldn't be a function
22:33 <ertes> IO [String]
22:34 <bbear> you can't hide that internal deal with IO into the function ?
22:34 Achylles joined
22:34 <ertes> what do you mean?
22:34 <bbear> ok so it would be like readListOfInt :: IO [String] :: [Int]
22:34 <bbear> ok so it would be like readListOfInt :: IO [String] > [Int]
22:34 <EvanR> if it has observable side effects, does I/O, it has to be in the type
22:34 <bbear> ok so it would be like readListOfInt :: IO [String] -> [Int]
22:34 <bbear> okay
22:35 <ertes> bbear: that type doesn't make much sense
22:35 <ertes> it couldn't do anything with its argument (an IO action)
22:35 <EvanR> you arent taking any arguments
22:35 <bbear> let say you want to read n integers
22:35 <seequ_> bbear: Your program returns a single IO, which represents everything it'll do. Calling a function can't use it behind-the-scenes.
22:35 eacameron joined
22:35 <EvanR> youre not returning aynthing because its not a function
22:36 <EvanR> a function with no arguments is a constant
22:36 <ertes> bbear: first let's clarify what a function is: a function is a value of type (X -> Y) for some X and Y
22:36 <ertes> in other words, a function is something you can apply
22:36 <ertes> if you can't apply it, it ain't a function
22:36 <ertes> so getLine, for example, is *not* a function
22:37 <bbear> so what is it ?
22:37 <bbear> certainly not a constant
22:37 <ertes> it's an IO action
22:37 <ertes> yes, it is a constant
22:37 <EvanR> its a constant
22:38 <EvanR> its the command "get a line"
22:38 <bbear> oh ok
22:38 <exio4> waa
22:38 <ertes> remember that the *action* to get a line is not the same thing as the result of running the action to get a line
22:38 <exio4> welp, wrong channel :P
22:39 <bbear> `result of running the action to get a Line` would be with the IO monad either the content of the line or error -- (ok ?)
22:39 <ertes> bbear: do you use linux?
22:39 <EvanR> the result of executing an IO String is a String
22:39 <bbear> yes
22:40 <bbear> I use linux
22:40 <ertes> bbear: getLine corresponds to a line in the same way the "ls" program corresponds to a list of files
22:40 <EvanR> exceptions are an exception
22:40 <ertes> bbear: does that make sense?
22:40 <bbear> EvanR: and if you disk is disconnected when getLine is executed what happens ?
22:40 <EvanR> an exception
22:41 <bbear> what have exception to do with the IO monad ?
22:41 <EvanR> not that much
22:41 <EvanR> except that you can catch them in IO
22:41 <monochrom> I don't think it is useful to consider exception now.
22:41 <bbear> ok
22:41 <ertes> exceptions can make (>>=) for IO short-circuit
22:41 <bbear> ok
22:41 <EvanR> you can just assume exceptions never happen
22:42 <EvanR> learn haskell first
22:42 <ertes> no, please don't assume that… ever =)
22:42 <bbear> let say I want to define a new constant that is `execute 10 times the getLine command and return the result of those action into a single list`
22:42 <bbear> how would I do that ?
22:42 <ertes> replicateM 10 getLine
22:42 <ertes> :t replicateM 10 getLine
22:42 <lambdabot> IO [String]
22:42 <EvanR> another non-function
22:43 <bbear> does something like that would have anything meaningful ? `getline (=<<) getline (=<<) getline (=<<) getline (=<<) getline (=<<) getline (=<<) getline (=<<) getline (=<<) getline (=<<) getline`
22:43 <bbear> :t replicateM
22:43 <lambdabot> Applicative m => Int -> m a -> m [a]
22:43 <bbear> ok
22:43 <ertes> bbear: no, that's a type error
22:44 <ertes> (=<<) takes a function as its first argument, and as we have established, getLine is clearly not a function
22:44 <ertes> :t (=<<)
22:44 <lambdabot> Monad m => (a -> m b) -> m a -> m b
22:44 <glguy> 'getline (=<<) getline' is different from 'getline =<< getLine'
22:44 <geekosaur> also with the parentheses it is now a prefix function instead of an infix operator
22:44 <glguy> and 'getline' is different from 'getLine'
22:44 <ertes> oh, i didn't even catch that
22:45 <ertes> so yeah, it's a "not in scope" error then, unless you defined what getline is
22:45 jmcarthur joined
22:45 <glguy> I couldn't even manage to write 'getline' four times in a row. My fingers took over by the fourth
22:45 <bbear> glguy: i used teh python interpreter
22:46 <glguy> it's probably not too good for Haskell programming
22:46 <ertes> you can emulate python syntax to some extend in haskell though =)
22:46 <bbear> sum ["getLine =<< "]*10
22:46 <ertes> extent
22:46 <bbear> :t sum ["getLine =<< "]*10
22:46 <lambdabot> error:
22:46 <lambdabot> • No instance for (Num [Char]) arising from a use of ‘*’
22:46 <lambdabot> • In the expression: sum ["getLine =<< "] * 10
22:46 <bbear> ho ok
22:47 <bbear> to some extent
22:47 <bbear> but not for the brightest result.
22:47 darjeeling_ joined
22:47 <bbear> I am trying to map examples over type definitions
22:47 <ertes> > unwords (replicate 10 ["getLine =<<"])
22:47 <lambdabot> error:
22:47 <lambdabot> • Couldn't match type ‘[Char]’ with ‘Char’
22:47 <lambdabot> Expected type: [String]
22:47 <ertes> > unwords (replicate 10 "getLine =<<")
22:47 <lambdabot> "getLine =<< getLine =<< getLine =<< getLine =<< getLine =<< getLine =<< get...
22:48 <bbear> can you give me real world examples of what a (a-> m b) would be ?
22:48 <glguy> sum <$> replicateM 10 readLn :: IO Int
22:48 <ertes> bbear: putStrLn
22:49 <monochrom> Is it a good time to bring up my http://www.vex.net/~trebla/haskell/IO.xhtml ?
22:49 <bbear> :t putStrLn
22:49 <lambdabot> String -> IO ()
22:49 epsilonhalbe left
22:49 <glguy> monochrom: Is it about the real world?
22:49 <monochrom> No.
22:49 <glguy> oh :(
22:49 <dolio> Is it about the RealWorld?
22:50 <monochrom> RealWorld passing is beneath my dignity :)
22:50 <ertes> no
22:50 <ertes> it's about the RealWorld# though
22:50 <bbear> an IO tutorial is always a good idea.
22:50 fizbin joined
22:50 <bbear> so actually if putStrLn is doing IO, its more O than I.
22:51 <ertes> bbear: it's not really "doing" anything
22:51 <bbear> and then what would be the corresponding m a ?
22:51 <ertes> it's a function that, given a string, returns an action that writes that string to stdout
22:51 <monochrom> Be careful about "return" there. :)
22:51 <bbear> in the IO() monad, a and b are always the same ?
22:52 <ertes> IO () is not a monad
22:52 dawehner joined
22:52 <bbear> (and btw, are they always String ?)
22:52 <ertes> IO is a monad
22:52 <bbear> ok
22:52 <bbear> s/()//
22:52 <ertes> bbear: you should read monochrom's tutorial
22:52 <ertes> ignore that IO is a monad
22:52 <ertes> ignore "monad" for now
22:53 <monochrom> And I am still pondering on how to work "it is a recipe not the outcome" into my tutorial.
22:53 <bbear> Is this you : Albert Y. C. Lai ?
22:53 <monochrom> Yes.
22:54 <bbear> thanks
22:54 <bbear> would be nice to have an epub version
22:54 <EvanR> IO actions are either primitives or combinations of other IO actions into a larger blueprint
22:55 <EvanR> theres a few ways to combine them
22:55 <bbear> ha ok but you didn't tell me about that >>=
22:55 <EvanR> this pattern exists in many libraries
22:55 <EvanR> IO is just one example
22:56 <bbear> Why the monadic law defines only =<< but still >>= seems pretty useful ?
22:56 oisdk joined
22:56 <bbear> ok I forgot to forget about monads.
22:56 <EvanR> those are literally the same thing
22:56 <EvanR> just opposite order of argument
22:57 <ertes> monochrom: well, that's just an intuition, but it's a pretty safe one, so you might just put it at the beginning of the tutorial (to replace the "any sentence you think up now is wrong" part)
22:58 <bbear> what the foobar :: IO () means (I mean the parenthesis) ?
22:58 nomicflux joined
22:58 <ertes> bbear: () is a type with only one value: ()
22:58 <EvanR> in the end your entire program is a big blueprint, it only comes to life when you give it to the computer. and this is really not different from any toher language
22:58 a3Dman joined
22:59 <EvanR> sometimes you forget that in a floor of meta circular evaluation or dynamic runtime shenanigans
22:59 <bbear> ertes: but what's the meaning in the global expression ?
22:59 <EvanR> s/flood/
22:59 <ertes> bbear: IO actions, when executed, return a result (or throw an exception)… but some actions simply don't have any interesting result (like (putStrLn str)), so they just return (), an "uninteresting value"
23:00 <ertes> bbear: think of the () type as Bool without False
23:00 <bbear> okay
23:00 <bbear> so it is just a convenient way to say it.
23:00 <ertes> it's not a convenience
23:00 eacameron joined
23:01 SCHAPiE joined
23:01 <Sornaensis> > ()
23:01 <lambdabot> ()
23:01 <EvanR> use type () for uninteresting values, use type Void for impossible values
23:01 <ertes> bbear: if (c :: IO A), then c is an action that, when executed, returns a value of type A
23:01 <ertes> bbear: what is the type of the action that does nothing?
23:02 <ertes> and has no interesting result at all
23:02 <bbear> I was stuck at this sentence : `The second parameter wants a -> IO b, and we give it putStrLn :: String -> IO (). That matches up too, with b = ().` <-- I could say to monochrom that if his tutorial is beginner oriented, that part is kind of cryptic. (live tutorial analysis)
23:02 albel727 joined
23:03 jaguar joined
23:03 <bbear> may I reformulate ? (something is probably wrong here and i'm being chatty)
23:03 revprez_atlanta joined
23:03 louispan joined
23:03 <bbear> (>>=) is to bind getLine with putStrLn
23:03 sophiag joined
23:04 <bbear> (=<<) is to bind putStrLn with getLine
23:04 <bbear> :t (=<<)
23:04 <lambdabot> Monad m => (a -> m b) -> m a -> m b
23:04 <bbear> :t getLine
23:04 <lambdabot> IO String
23:04 <bbear> :t putStrLn
23:04 <lambdabot> String -> IO ()
23:04 <ertes> :t id
23:04 <lambdabot> a -> a
23:04 <ertes> > id (5 :: Integer)
23:04 <lambdabot> 5
23:05 eacameron joined
23:05 <bbear> maybe i'm too chatty and noisy sorry
23:05 <ertes> because id works for any type 'a', i just used it with (a = Integer)
23:05 <bbear> > id ()
23:05 <bbear> > id ()
23:05 <lambdabot> ()
23:05 <bbear> oky
23:06 SCHAPiE joined
23:06 <bbear> I go back to study the tutorial.
23:07 <Cale> bbear: The point of the thing you mentioned is that String -> IO () can be equal to a -> IO b when a = String and b = (), so it's possible to supply putStrLn as the second argument to (>>=)
23:08 takle joined
23:08 <ertes> bbear: also (=<<) is defined as: f =<< c = c >>= f -- so don't fixate on it so much… it's literally the same function as (>>=) with the arguments flipped
23:10 a3Dman joined
23:10 ali_bush joined
23:10 a3Dman joined
23:10 ali_bush joined
23:10 bjz joined
23:11 permagreen joined
23:11 <bbear> ertes: oh yeah
23:11 <bbear> I get it now
23:11 <bbear> IO is supposed to be a commutative monad.
23:12 <bbear> so the reverse is only defined for commutative monads. !
23:12 <bbear> Now I see (seemingly) some light
23:12 <ertes> no
23:12 <bbear> ok now i'm going back to my dark cave
23:13 <ertes> the light is an illusion unfortunately… the (=<<) thing is purely symbolic: whenever you find yourself writing (blah =<< blubb), you could just as well have written (blubb >>= blah)
23:14 <bbear> okay
23:14 <ertes> commutativity is a feature of *one* function… for example (+) for Integer is commutative: x + y = y + x, for all x, y
23:14 <ertes> if you defined (+-) as: y +- x = x + y
23:14 <ertes> this has nothing to do with the commutativity of (+)… you really just defined another function that is the same as (+) with the arguments flipped
23:15 <ertes> but you would find this: x +- y = x + y -- reason: because x +- y = y + x, and y + x = x + y (commutativity), you can infer: x +- y = x + y
23:16 nakal_ joined
23:16 featherlessbiped joined
23:16 markus1209 joined
23:16 markus1219 joined
23:18 <ertes> example: 5 +- 3 = 3 + 5, but 3 + 5 = 5 + 3, therefore also 5 +- 3 = 5 + 3
23:18 <bbear> ok
23:18 <bbear> thanks monochrom I read your tutorial up to the end.
23:19 <bbear> I'll try to do something without the do notatino
23:19 <bbear> Keep up to date
23:19 <glguy> separate from commutative functions you can find people talking about commutative monads, (it just isn't related to =<< / >>=)
23:19 <bbear> yes
23:20 <dolio> IO is not commutative, though.
23:20 theDon_ joined
23:20 EvilMachine joined
23:21 utdemir joined
23:21 revprez_atlanta joined
23:22 <glguy> I commute 5 times a week
23:22 takle joined
23:26 PennyNeko joined
23:26 <ij> Why doesn't «(\e -> [e] \\ [ThreadKilled])» typecheck, where «Exception e => e»?
23:27 <ertes> ij: the former doesn't make much sense
23:27 <ertes> oh, wait
23:27 <ij> :t (\e -> [e] \\ [ThreadKilled]) :: Exception e => e -> [e]
23:27 <lambdabot> error:
23:27 <lambdabot> • Couldn't match expected type ‘e1’
23:27 <lambdabot> with actual type ‘AsyncException’
23:27 <glguy> ThreadKilled has a specific type
23:27 <geekosaur> ThreadKilled is a type
23:27 <glguy> :t ThreadKilled
23:27 <lambdabot> AsyncException
23:27 <ertes> it was confusing… i thought they confused types and values there
23:27 <glguy> AsyncException is the type
23:28 <glguy> It's not whatever type you might want it to be
23:28 <geekosaur> ... right, whoops, it's multilevel
23:28 ed1 joined
23:28 <ij> But you input whichever type with an Eq a, and you'll get it back if «a /= ThreadKilled».
23:28 <glguy> :t (==)
23:28 <lambdabot> Eq a => a -> a -> Bool
23:29 <glguy> Notice that == is only defined on two arguments of the same type
23:29 <geekosaur> so the problem is that Exception e => e -> [e] doesn't tell you anything about e other than it supports the methods of the Exception typeclass
23:29 <glguy> so you can only compare values with type AsyncException to ThreadKilled
23:29 <geekosaur> it does not let you specify that e is AsyncException
23:31 cchalmers joined
23:31 <ij> Right. I think this should work, so I'll keep thinking and I've an idea.
23:31 <glguy> :t (\e -> [ e | Just ThreadKilled /= fromException e ])
23:31 <lambdabot> SomeException -> [SomeException]
23:31 <ertes> ij: Exception doesn't form a subtyping hierarchy, so you can't just use ThreadKilled among other exception types in a list
23:32 <glguy> :t (\e -> [ e | Just ThreadKilled /= fromException (toException e) ])
23:32 <lambdabot> Exception t => t -> [t]
23:32 <sophiag> i'm trying to parse lists using haskell-src-exts and it works fine in ghci, but when i run it in the repl i'm using for this dsl it throws an error that there are non-exhaustive patterns in the functino parseSlist here: http://lpaste.net/354437
23:33 <sophiag> (i get similar issues with the arrow in lambdas, but one thing at a time)
23:33 <monochrom> bbear: I guess instead of "wants" it is more precisely "needs type".
23:33 <lyxia> sophiag: all of these functions are obviously partial
23:33 <monochrom> But if you understood the previous sentence about the first parameter, then this sentence about the second parameter is of the same nature. It is checking types. Both are checking types.
23:34 <sophiag> lyxia: of course, but i get that even when parsing a list of lists
23:34 <ij> Huh… [1 | True] works — how odd.
23:34 <sophiag> it's not a warning in ghci, it's failing when i use it for io..
23:35 abhiroop joined
23:35 <sophiag> hence why i've never found that particular error message useful :/
23:36 ublubu joined
23:36 <bbear> :t (getLine >>= \x -> return (map (let foo bar = read bar::Int in foo) (words x)))
23:36 <lambdabot> IO [Int]
23:36 <lyxia> sophiag: print the parsed expression before passing it to parseList to check your assumption that you are parsing a list.
23:36 jgt1 joined
23:37 <ertes> > [ x | True, x <- [5,6] ]
23:37 <lambdabot> [5,6]
23:37 <ertes> ij: it's not that odd, especially if you consider how it's desugared
23:37 <ertes> > guard True >> [1]
23:37 <lambdabot> [1]
23:38 <sophiag> lyxia: that's something i was wondering...given the constructor used in the parameters do i need to pass it just the list? currently i'm passing the whole ast which contains other things
23:38 <bbear> do you have an opinion on why the last of my compilation errors are often parenthesis ?
23:38 <bbear> (it's true)
23:38 <monochrom> Yes, I means you're inexperience :)
23:38 <monochrom> d
23:39 <monochrom> Either that or you haven't memorized the whole precedence table.
23:39 variable joined
23:40 <glguy> bbear: As an aside note that (let foo bar = read bar::Int in foo) is (read :: String -> Int)
23:40 <glguy> and that instead of all that we can write (map read (words x) :: [Int])
23:40 <bbear> wow
23:40 <bbear> okay
23:41 <bbear> can we do \[x,y] ?
23:42 <monochrom> Yes. But do you know what it means?
23:42 <bbear> yes
23:42 <bbear> :t \[x,y] -> x
23:42 <lambdabot> [t] -> t
23:42 <monochrom> Can you come up with a test that falsifies your guess?
23:42 <bbear> no
23:42 <bbear> I'd say it's a function that takes a list of two elements as a parameter.
23:42 <monochrom> Then you still don't know, scientifically speaking.
23:42 <lyxia> sophiag: if you pass anything other than a list you get the exception you got.
23:43 <bbear> I don't know if this function would work on something else
23:43 <bbear> no scientifically speaking I don't a lot of things.
23:43 <monochrom> Can you come up with an experiment to find out?
23:43 <bbear> yes : firing up my ghci.
23:43 <bbear> I'm already doing that.
23:43 <monochrom> Then you haven't know but you will know.
23:44 chenshen joined
23:44 isovector joined
23:44 <isovector> is there a Generic2 typeclass?
23:45 <glguy> no
23:45 sigmundv joined
23:45 <isovector> :( for any theoretical reason? or just nobody had a use
23:45 <bbear> > let x = \[x,y] -> x in x [1,2,3]
23:45 <lambdabot> *Exception: <interactive>:3:9-19: Non-exhaustive patterns in lambda
23:45 <lyxia> isovector: nobody had a use
23:45 <monochrom> Yeah, like that.
23:46 <monochrom> Although, it is bad habit to have so many x's.
23:46 <isovector> i've got a use :)
23:46 <glguy> isovector: cool, you'll have to go implement Generic2 now!
23:47 <isovector> :'(
23:47 <isovector> who do i talk to?
23:47 <glguy> Maybe you don't actually need it. What are you trying to do?
23:47 <sophiag> lyxia: thanks. that was my suspicion. i don't understand why it works in ghci tho
23:47 <isovector> glguy: trying to write generic instances for `class CoEff f where comap :: (a -> b) -> Eff (f a ': r) x -> Eff (f b ': r) x`
23:48 <isovector> f :: * -> * -> *
23:49 skeuomorf joined
23:49 oconnorct1 joined
23:49 mrjake joined
23:50 <centril> If I have a (Rose) Data.Tree (Maybe Decoration) where Decoration could for example be Type decoration, and an AST with a 1/1 correspondence to the rose tree - how to I traverse these in conjunction in a neat way ?
23:50 <mrjake> http://lpaste.net/6453280966029869056 Can anyone confirm this bug?
23:50 <centril> I'm trying to do AST decoration out-of-tree with a rose tree
23:53 <glguy> isovector: Generic2 is going to be quite a project shoudl someone take it on, the current system isn't designed at all to handle it
23:53 <glguy> the :*:, :+:, M1, etc all have a single parameter (that is unused in Generic and used in Generic1)
23:54 <glguy> and there's some logic for supporting composition via :.:
23:54 <glguy> once you introduce a second parameter you'll need a few more cases like :.: for various combinations of composition
23:54 <glguy> as well as a new parameter for all the aforementioned Rep types
23:55 JoshS joined
23:55 <bbear> mmhhh
23:55 <centril> This was given to me as a suggestion by John Hughes - So I want something like: Traversal' s a -> Traversal' (Tree (Maybe Decoration), s) (Maybe Decoration, a)
23:55 <bbear> I have a question
23:55 <bbear> no I have two questions
23:55 <bbear> And a glass of red wine.
23:55 <centril> bbear: just ask ;)
23:57 <bbear> so, well, programming in an imperative fashion was just like doing carpenter work in those old days. Now with Haskell, it lost kind of the artisanal edge it had. It's more like solving complicated puzzles. What do you think of my statement ?
23:57 <bbear> my second question is more technical per se.
23:58 <bbear> you know what is the type of replicateM
23:58 <centril> bbear: if by "solving complicated puzzles" you are talking about (function) composition
23:58 <centril> :t replicateM
23:58 <lambdabot> Applicative m => Int -> m a -> m [a]
23:58 <bbear> yes
23:58 <bbear> but not only function but also all those typeclass
23:59 <bbear> let say I have a type data Coord = C Int Int
23:59 <bbear> and then I want to read from stdin 10 lines, each one containing a pair of integers.