<     May 2017     >
Su Mo Tu We Th Fr Sa  
    1  2  3  4  5  6  
 7  8  9 10 11 12 13  
14 15 16 17 18 19 20  
21 22 23 24 25 26 27  
28 29 30 31
00:00 <pikajude> lol
00:00 <pikajude> good old purity
00:00 alveric2 joined
00:00 infinity0_ joined
00:00 infinity0_ joined
00:02 thunderrd_ joined
00:02 markasoftware joined
00:02 <EvanR> let x = pureSleep 1000000 'c' will do nothing. if you look at x but cancel the computation, now x is permanently "Interrupted"
00:02 <EvanR> ok
00:03 <ReinH> good times
00:03 infinity0 joined
00:03 <EvanR> but if the pure sleep is deep inside another computation, its like some internal variables become permanently interrupted
00:03 <EvanR> i have to exit ghci completely
00:04 moet joined
00:06 infinity0 joined
00:06 <EvanR> ah
00:06 <EvanR> because it was part of a CAF
00:07 <EvanR> i turned the top level CAF from foo :: X to foo :: () -> X and it fixed
00:07 uglyfigurine joined
00:07 <EvanR> maybe i should move to ML
00:08 infinity0 joined
00:09 <Sheogorath> blasphemer
00:09 raof01 joined
00:09 <nshepperd> I guess when you interrupt it, it becomes InterruptedError `seq` x, basically
00:09 <nshepperd> or whatever the actual exception is
00:09 <EvanR> right
00:10 StoneToad joined
00:10 <nshepperd> and that will be ⊥ no matter how many times you try to evaluate it
00:10 <nshepperd> good fun
00:10 <EvanR> since the top level thing is infinite and growing, probably better to () -> it anyway, assuming that even works in general
00:11 Kaan joined
00:11 <EvanR> to make it recompute each place its used
00:11 infinity0 joined
00:12 chlong joined
00:12 <EvanR> the value is valueAtEndOfTime = NotBefore 1 (NotBefore 2 (NotBefore 4 (NotBefore 8 ( ...
00:13 <EvanR> with increasing pure sleeps thrown in to make it not 100% cpu if its forced inside another computation
00:13 dibblego joined
00:13 dibblego joined
00:13 WhiskyRyan joined
00:15 <Sheogorath> EvanR: here's the STM code I was bugging you about earlier. orElse and exceptions are tricky tho. http://lpaste.net/101465647430500352
00:18 <EvanR> heh, Time = Int
00:18 <EvanR> what could go wrong
00:18 aarvar joined
00:18 <Sheogorath> global variables and unsafePerformIO. isn't it wonderful?
00:18 <EvanR> right...
00:19 <EvanR> btw if youre serious, you want to do something like in the globals package to create that global
00:19 <EvanR> probably
00:20 <Sheogorath> not serious
00:24 ian-mi joined
00:24 <rightfold> @pl \f -> either ((stateErrors %=) . (:)) f <=< lift . unwrap
00:24 <lambdabot> (line 1, column 52):
00:24 <lambdabot> unexpected "u"
00:24 <lambdabot> expecting space
00:24 <lambdabot> ambiguous use of a right associative operator
00:25 dooml0rd joined
00:25 <rightfold> ah, so that's why pointfree.io crashes
00:25 sproingie joined
00:25 augur joined
00:26 <pikajude> maybe it shouldn't crash
00:26 <orion> A 500 error seems like a bad plan.
00:27 <rightfold> maybe it's better to keep this function pointful anyway
00:28 uglyfigurine joined
00:32 juanpaucar joined
00:33 mr_sm1th joined
00:34 Rodya_ joined
00:42 eschnett joined
00:48 Reshi joined
00:49 justinfokes joined
00:51 mjora7 joined
00:51 MP2E joined
00:52 ziyourenxiang joined
00:52 <Profpatsch> I need a function Map k v -> Map v [k]
00:53 <Profpatsch> So it should give me back for each value a list of keys that have this value.
00:54 <Profpatsch> Is there something like that?
00:54 <EvanR> youll have to sort by and group the key value list
00:54 <EvanR> then build a new map from that
00:55 juanpaucar joined
00:55 nomotif joined
00:56 xinming_ joined
00:56 nh2 joined
00:57 _ashbreeze_ joined
00:58 max3 joined
00:58 Jesin joined
01:05 revtintin joined
01:06 jsgrant_om joined
01:11 justinfokes joined
01:13 darjeeling_ joined
01:13 NoCreativity joined
01:14 moet joined
01:15 Supersonic112_ joined
01:15 <Younder> consolidation
01:15 <Younder> The internet, a common language, it is about consolidation
01:16 <Younder> We need to find a new place to live. That is our purpose. We are at our most fragile and altso our most powerful
01:16 <ChaiTRex> Profpatsch: http://lpaste.net/355466
01:16 <Younder> n Norway it is in the dead of night. I am just reflecting on my life and what has happened during my 50 years.
01:17 mbuf joined
01:17 <Younder> far as I can see. (admitting not that far). The only reason mankind is allowed to exist is because we have something the other animals don't. We can populate other stars.
01:17 <Younder> Something so valuable it is worth almost any cost.
01:17 <Younder> Even a 50% extinction of other animals. (For a while)
01:18 <Younder> For a while it was about creativity. Now it is about consolidation. Putting 'the lot' into play
01:18 justinfokes joined
01:18 hexagoxel joined
01:18 <dmj`> Profpatsch: could probably do it with foldrWithKey
01:22 <dmj`> @type M.foldrWithKey
01:22 <lambdabot> (k -> a -> b -> b) -> b -> M.Map k a -> b
01:22 juanpaucar joined
01:22 <dmj`> @type M.foldrWithKey (\k v m -> M.insertWith (++) v [k] m) mempty
01:22 <lambdabot> Ord k => M.Map a k -> M.Map k [a]
01:23 Big_G joined
01:24 <dmj`> > (M.foldrWithKey (\k v m -> M.insertWith (++) v [k] m) mempty) (M.fromList [(1,'a'), (2,'a')] )
01:24 <lambdabot> fromList [('a',[1,2])]
01:25 dejanr joined
01:25 <Profpatsch> dmj`: Yes, that’s my solutino M.foldlWithKey (\m k v -> insertWith (++) v [k] m) mempty $ M.fromList [(1::Int,2::Integer),(2,2),(3,2),(6,1)]
01:26 <dmj`> Profpatsch: legit
01:27 asmyers joined
01:28 Wizek joined
01:29 justinfokes joined
01:30 mjora7 joined
01:32 <Profpatsch> foldWithKey' of course
01:33 yamadapc joined
01:33 <Profpatsch> ChaiTRex: Thanks! I think with Map operations it’s a bit faster.
01:33 <dmj`> :t M.foldlWithKey'
01:33 <lambdabot> (a -> k -> b -> a) -> a -> M.Map k b -> a
01:34 <Profpatsch> It’s the strict version.
01:34 <Profpatsch> Is there any reason to use foldl anytimes
01:34 Noldorin joined
01:34 <Profpatsch> s/s/?$/?
01:34 <Profpatsch> It will always build up chunks, right?
01:35 xcmw joined
01:36 zv joined
01:36 <dmj`> yea, very chunky
01:37 <Profpatsch> Hm, to generalize this.
01:37 <lyxia> the laziness can be useful, but I don't have an example in mind
01:37 Noldorin joined
01:37 <Profpatsch> Now it’s List, is there a datatype that can do something like <> but also singleton?
01:37 <Profpatsch> like right now it’s (++) and [k]
01:38 <lyxia> pure + Alternative
01:38 <Profpatsch> Oh, right.
01:38 <Profpatsch> I thought (:[]) is pure
01:38 <Profpatsch> (<|>) and pure
01:39 Noldorin joined
01:39 <Profpatsch> Hm, the instances I can think about are [] and Set
01:40 <Profpatsch> Foldable can’t do singleton.
01:40 <Profpatsch> So maybe there’s no nice abstraction.
01:40 halogenandtoast joined
01:40 justinfokes joined
01:43 yamadapc joined
01:43 <Profpatsch> Ah, but for the map implementation I need (Ord k, Ord v)
01:43 mkoenig joined
01:44 <Profpatsch> Ah well.
01:44 <Profpatsch> Not easy
01:44 WhiskyRyan joined
01:45 fosterite joined
01:45 fosterite joined
01:47 <* hackage> servant-py - Automatically derive python functions to query servant webservices. https://hackage.haskell.org/package/servant-py- (erewok)
01:47 justinfokes joined
01:53 yamadapc joined
01:55 <Sgeo> https://gist.github.com/nkpart/8922083d3c18a8f777b8
01:55 <Sgeo> I get the joke for the most part, but what's ReadMe?
01:55 <Sgeo> Googling wasn't very helpful
01:56 <Sgeo> Oh derp
01:56 <Sgeo> I missed the part where it's defined right there
01:56 peterbecich joined
01:58 WhiskyRyan joined
01:59 lambdamu_ joined
01:59 dni joined
02:00 hucksy_ joined
02:03 jbarrow joined
02:05 kadoban joined
02:06 louispan joined
02:06 torgdor joined
02:09 jbarrow left
02:10 mbuf joined
02:11 beerdrop joined
02:12 Xanather joined
02:14 WhiskyRyan joined
02:14 Hithroc joined
02:15 exferenceBot joined
02:16 <nkpart> :)
02:18 Goplat joined
02:19 louispan joined
02:19 splanch joined
02:20 ertes joined
02:21 cef0l0 joined
02:26 juanpaucar joined
02:28 filterfish_ joined
02:28 exferenceBot joined
02:29 dhil joined
02:29 cpennington joined
02:31 sproingie joined
02:31 sproingie joined
02:32 meba joined
02:33 moet joined
02:33 hexagoxel joined
02:34 madknight joined
02:37 ChaiTRex joined
02:39 Pilfers joined
02:40 iqubic joined
02:43 sproingie joined
02:43 sproingie joined
02:44 Hunter1_ joined
02:48 exferenceBot joined
02:50 WhiskyRyan joined
02:54 tommd joined
02:56 sighingnow joined
02:58 koserge joined
03:00 javjarfer joined
03:00 wei2912 joined
03:02 revprez_atlanta joined
03:04 mjora7 joined
03:05 erisco joined
03:06 acertain joined
03:08 Destol joined
03:10 Argue_ joined
03:11 iqubic left
03:13 javjarfer joined
03:14 afarmer joined
03:14 Rodya_ joined
03:17 jchia_1 joined
03:17 pavonia joined
03:19 <* hackage> haven - Recursively retrieve maven dependencies https://hackage.haskell.org/package/haven- (abrar)
03:20 jchia_1 joined
03:21 halogenandtoast joined
03:21 aarvar joined
03:24 zv joined
03:24 <* hackage> Villefort - Villefort is a task manager and time tracker written in haskell. https://hackage.haskell.org/package/Villefort- (ChrisReuter)
03:27 tromp joined
03:29 max3 joined
03:29 hybrid joined
03:30 cschneid_ joined
03:30 juanpaucar joined
03:30 zero_byte joined
03:31 scottj joined
03:31 sproingie joined
03:32 iqubic joined
03:32 <iqubic> Hello
03:32 takle joined
03:34 cpennington joined
03:34 <* hackage> Villefort - Villefort is a task manager and time tracker written in haskell. https://hackage.haskell.org/package/Villefort- (ChrisReuter)
03:35 jbarrow joined
03:37 flatmap13 joined
03:40 hiratara joined
03:41 bruceadams1 joined
03:42 ctag_ joined
03:45 flatmap13 joined
03:48 xall_ joined
03:49 mzf joined
03:50 drewbert joined
03:52 [[[[[ExTRa]]]]] joined
03:52 nomeata joined
03:53 FreeBirdLjj joined
03:54 JeanCarloMachado joined
03:57 <iqubic> Is Hackage bot back up and running?
03:57 SrPx joined
03:57 <SrPx> why the parigot encoding is typeable with positive recursion and the scott isn't? the types are almost identical... is there any obvious intuition to determine when something is and isn't positive recursion
03:58 argent0 joined
03:58 takle joined
04:00 <EvanR> iqubic: theres a new hackage bot
04:02 ed-ilyin-lv joined
04:03 NeverDie joined
04:09 JeanCarloMachado joined
04:10 insitu joined
04:10 descender joined
04:10 takle joined
04:13 Beetny joined
04:13 infinity0 joined
04:15 drcode joined
04:16 Rodya_ joined
04:16 Argue__ joined
04:20 sleffy joined
04:21 sproingie joined
04:24 takle joined
04:28 <iqubic> Oh. Is it better than the old one?
04:30 <EvanR> > compare "hackage" "hackagebot"
04:30 <lambdabot> LT
04:31 kody joined
04:32 <jle`> > sort ["hackage","hackagebot"]
04:32 jmcarthur joined
04:32 <lambdabot> ["hackage","hackagebot"]
04:32 mbuf joined
04:34 WhiskyRyan joined
04:34 juanpaucar joined
04:34 eacameron joined
04:35 <nshepperd> any ghc rts experts here? it looks like I've got some virtual address space issues with the RTS vs nvidia opencl drivers
04:35 cschneid_ joined
04:36 <nshepperd> where they're both competing for the bottom of the address with the result that the driver won't load
04:36 <nshepperd> are there any secret flags i can tweak to change this behavior
04:37 moet joined
04:37 Big_G joined
04:37 <geekosaur> +RTS -xb and it's not secret
04:37 <geekosaur> it *does* require building with -rtsopts
04:38 scottj left
04:38 mulk joined
04:38 <geekosaur> (try "ghc +RTS --help" to see the rts flags available to non-debug/profiling builds, or https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/runtime_control.html#miscellaneous-rts-options ff. for all rts options
04:39 HappyEnte joined
04:39 <nshepperd> hm, -xb isn't listed anywhere
04:39 justinfokes joined
04:41 <geekosaur> hm, I see https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/runtime_control.html#rts-flag--xm in the manual but am not seeing -xb
04:42 kody joined
04:42 <geekosaur> but ghc (8.0.2) +RTS --help says: "ghc: -xb<addr> Sets the address from which a suitable start for the heap memory will be searched from. This is useful if the default address clashes with some third-party library."
04:42 <geekosaur> either -xm or -xb might be relevant for your situation
04:42 <geekosaur> this does seem to be a doc bug though
04:42 JeanCarloMachado joined
04:44 Sh4rPEYE joined
04:45 <Sh4rPEYE> Hello. I'm trying to write a Functor (and other) instances of Constant. In the docs the type signature of fmap look like this: fmap :: (a -> b) -> Constant * a a -> Constant * a b
04:46 ekasc joined
04:46 <geekosaur> uh. there's a haddock gotcha there; lclick through to the source to see a sane type signature
04:47 <glguy> The surprising * is due to an extension called PolyKinds.
04:47 <Sh4rPEYE> What does the asterisk mean there?
04:47 <geekosaur> (the * tells me it expanded a kind annotation)
04:47 <geekosaur> haddock formats kind signatures ... oddly
04:47 <glguy> For the purposes of your exercise you should completely ignore it
04:47 takuan joined
04:47 <nshepperd> geekosaur: thanks
04:48 prkc joined
04:48 <nshepperd> it doesn't seem to be helping though :(
04:48 <iqubic> :t sort
04:48 <lambdabot> Ord a => [a] -> [a]
04:49 JeanCarloMachado joined
04:49 <iqubic> is there a way to do sorting by providing your own comparison function
04:49 <geekosaur> nshepperd, you might need to ask in #ghc, and provide more information about the conflict. or ask on the glasgow-haskell-users list
04:49 <geekosaur> :t sortBy
04:49 <lambdabot> (a -> a -> Ordering) -> [a] -> [a]
04:49 <geekosaur> :t sortOn
04:49 <lambdabot> Ord b => (a -> b) -> [a] -> [a]
04:49 <iqubic> Cool.
04:49 <geekosaur> @hoogle sort
04:49 <lambdabot> Data.List sort :: (Ord a) => [a] -> [a]
04:49 <lambdabot> Data.List.NonEmpty sort :: Ord a => NonEmpty a -> NonEmpty a
04:49 <lambdabot> GHC.OldList sort :: (Ord a) => [a] -> [a]
04:50 <iqubic> Those are the methods I was looking for
04:50 <geekosaur> feh, of course it wastes the slots on dupes :/
04:50 <iqubic> LOL
04:50 <iqubic> Actually the NonEmpty on is not a dupe.
04:50 <nshepperd> unfortunately these drivers are all closed source so it's hard to get a handle on what exactly is going wrong
04:50 <iqubic> Is there actually a NonEmpty class in Haskell
04:50 <Sh4rPEYE> Ok, thanks. Well, I have some more question. If constant is data Constant a b = Constant {getConst :: a}, can I patter-match against it in functions?
04:51 <Sh4rPEYE> E.g. fmap f (Constant a) = f a or somethingalong those lines
04:51 <geekosaur> type, not class. if you;re still thinking OOP style then you will be confused
04:51 brynedwards joined
04:51 <geekosaur> and it's in more recent versions of base (4.9.x for ghc 8.0.x)
04:51 treaki__ joined
04:52 takle joined
04:52 <iqubic> How can you tell if something refers to a type or a class.
04:52 Argue_ joined
04:52 <EvanR> read :info on it in ghci
04:52 <iqubic> Like with Maybe a, I know that maybe is a type.
04:52 <EvanR> :info Maybe
04:53 <iqubic> But something like NonEmpty is less readily apparent to me
04:53 <geekosaur> it says NonEmpty *after* a =>
04:53 <geekosaur> classes only appear *before* a =>
04:53 <iqubic> Ah, right.
04:54 <geekosaur> (the exception is class and instance declarations, because they are class and instance declarations)
04:54 <iqubic> You only have type constraints in a fucnction, not data constraints.
04:54 tommd joined
04:54 <iqubic> If you want a parameter to be of type Maybe a, instead of a, then you write Maybe a
04:55 <iqubic> Data constraints are pointless.
04:55 <iqubic> What's the point of using Newtype instead of Data?
04:55 <jle`> mostly performance
04:55 <jle`> and sometimes semantics
04:56 <EvanR> if you can use newtype you probably should
04:56 <iqubic> I get that NewType forces you to have a single constructor only. Are there any other benefits?
04:56 <iqubic> s/NewType/newtype
04:56 <jle`> i...wouldn't call that a benefit
04:56 <EvanR> newtypes only exist at compile time
04:56 <EvanR> theres no runtime overhead
04:56 <iqubic> Oh.
04:56 <jle`> so at runtime, a 'Sum Int' is just an Int
04:57 <jle`> an 'Any' is just a Bool
04:57 <iqubic> What's the difference between newtype and a type synonym?
04:57 <EvanR> new type makes a new type
04:57 <EvanR> thats not the same as the original
04:57 Mibaz joined
04:57 <jle`> 'Sum Int' doesn't typechekc as an Int
04:57 vlatkoB joined
04:57 <iqubic> And type gives you another name for the same thing.
04:57 <jle`> newtype Foo = Foo Bool
04:58 eklavya joined
04:58 <jle`> you can't use `Foo` where you would expect a `Bool`
04:58 <jle`> the type system will yell at you
04:58 <jle`> but for type Foo = Bool, you can use Bool where you expect Foo and vice versa
04:58 <jle`> it's basically just a lexical alias
04:58 <EvanR> so you can get more type safety this way
04:58 <iqubic> if I write type elephant = (int, int) then elephant type checks as (int, int)
04:58 <iqubic> Is that right?
04:58 bjz joined
04:58 <jle`> yes you can give an Elephant wherever an (Int, Int) is expected
04:59 <iqubic> This is the thing I was referencing.
04:59 <iqubic> http://stackoverflow.com/questions/43525193/how-can-i-re-assign-a-variable-in-a-function-in-haskell
05:00 <iqubic> He uses an elephant there. But I was refering to the accepted answer.
05:00 <iqubic> I love that post on SO.
05:00 <iqubic> It's the best
05:00 wwizwiwiz joined
05:01 xormor joined
05:02 <iqubic> Why don't more people use Haskell, if Haskell is so great?
05:02 <EvanR> fear uncertainty and doubt
05:02 <wwizwiwiz> what is the difference between haskell and a typed lisp/clojure
05:03 <xormor> some guy called me a nerd for trying to learn Haskell. Haskell is difficult to learn to me.
05:03 JeanCarloMachado joined
05:03 <iqubic> You can write simple programs in haskell with out using lists.
05:03 takle joined
05:04 <iqubic> Lisp requires lists for every thing.
05:04 <iqubic> LISP = LISt Processing
05:04 <wwizwiwiz> so... better memory layout?
05:04 <nshepperd> that seems like a pretty big question
05:04 <nshepperd> there are so many differences. all the differences, in fact
05:05 <wwizwiwiz> yeah, it's a conversation starter,... and i'm not finding a great article on the topic
05:05 <EvanR> and im not sure what typed lisp slash clojure is
05:05 <jle`> wwizwiwiz: it might be good to ask what you think the *similiarities* are
05:05 <EvanR> so its not that specific
05:05 <jle`> i can probably only name a couple of things that are similar
05:05 <jle`> and literally every other aspect is a difference
05:06 <wwizwiwiz> there are typed lisps
05:06 <jle`> i am sure that typed lisps exist
05:06 <iqubic> What are the similarities jle`? I can't thing of any.
05:06 <jle`> (1) they are both (presumably) programming languages
05:07 <iqubic> LOL
05:07 <wwizwiwiz> (2) they are both functional programming languages,...
05:08 <jle`> that also only tells you slightly little more than (1) tells you
05:08 <iqubic> I didn't think that Lisp was a functional language.
05:08 fishythe1 joined
05:08 <jle`> saying that something is a functional programming language doesn't tell you too much about a language
05:08 <wwizwiwiz> they are both garbage collected
05:08 <jle`> there is so much variation among functional languages and approaches to functional programming
05:08 <peddie> 3) has lambdas 4) special syntactic form for linked lists 5) garbage-collected
05:09 <jle`> just like how there is a lot of variation among programming languages in general and approaches to programming
05:09 fishythe1 left
05:09 <wwizwiwiz> ok, but i don't really know enough to identify major discriminating factors
05:10 <jle`> do you know what functional programming is?
05:10 <wwizwiwiz> maybe not
05:10 <jle`> think of everything else, and that's what is a discriminating factor
05:10 <iqubic> I mean Prolog is a complete paradim shift from imperative and and functiol programming altogether.
05:10 {emptyset} joined
05:10 <jle`> it's easier to talk about what is similar about functional programming languages...and literally everything else about them is different, heh
05:10 <wwizwiwiz> functional programming seeks to try to avoid mutable state and define programs in terms of pure functions which have specific inputs and outputs
05:11 <jle`> it's like talking about disriminating factors between animals
05:11 <jle`> some have, like, lets
05:11 <jle`> *legs
05:11 takle joined
05:11 <jle`> wwizwiwiz: not a bad start :)
05:12 <iqubic> Others have fins. Some have wings. Others slither about.
05:12 <iqubic> Animals are weird
05:12 <wwizwiwiz> which is a good practice with imperative programming anyway
05:12 <nshepperd> 'Others have fins. Some have wings. Others slither about.' <- programming languages :)
05:14 <jle`> wwizwiwiz: note that i'm not really even talking about variations between different types of functional programming (of which there are many)
05:14 <wwizwiwiz> so then ... differences begin with "handling mutable state, io etc"?
05:14 <jle`> i'm just talking about variations between languages
05:14 <jle`> in general
05:14 <jle`> like, 99% of language design choices
05:14 <jle`> module system, syntax
05:14 <wwizwiwiz> syntax is superficial
05:14 <EvanR> syntax of comments
05:14 <wwizwiwiz> module system also is superficial, like build system, etc
05:15 <wwizwiwiz> i wouldn't really call those things properties of the language
05:15 <orzo> Prefered module for 'fix'? Is it Data.Function or Control.Monad.Fix ?
05:15 <jle`> Data.Function
05:15 <orzo> how can i remember that? I'm always forgetting
05:15 <jle`> it...doesn't really have anything to do with monads, lol
05:15 <iqubic> Why do people use fix?
05:15 <iqubic> What's the point of that?
05:16 <EvanR> it does give you an anonymous loop
05:16 <EvanR> sometimes you dont want to come up with a name
05:16 <iqubic> It does???
05:16 <iqubic> How??
05:16 <EvanR> @src fix
05:16 <lambdabot> fix f = let x = f x in x
05:16 <jle`> fix f = f (fix f)
05:16 <EvanR> or that
05:16 Rodya_ joined
05:16 xall_ joined
05:17 <jle`> iqubic: you can parameterize a recursive function by the recursive call
05:17 ninedotnine joined
05:17 <iqubic> so how could you use fix to write a factorial function?
05:17 WhiskyRyan joined
05:17 <EvanR> you should try it
05:17 <jle`> iqubic: so you would write a normal fatorial function like: `fac n = if n == 0 then 1 else n * fac (n - 1)`
05:17 <nshepperd> > fix (\loop i -> i : loop (i + 1)) 0
05:17 <lambdabot> [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,2...
05:18 <jle`> so, you can make it "anonymous" by parameterizing it on the recursive fac call
05:18 <nshepperd> ^^ there, a loop that counts up using fix
05:18 <iqubic> jle`: Can I see that in action?
05:18 <jle`> fac n recursiveFacCall = if n == 0 then 1 else n * recursiveFacCall (n - 1)
05:19 <nshepperd> > fix (\loop acc i -> i : loop (acc * i) (i + 1)) 1
05:19 <lambdabot> <Integer -> [Integer]>
05:19 <nshepperd> > fix (\loop acc i -> i : loop (acc * i) (i + 1)) 1 1
05:19 <lambdabot> [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,...
05:19 <jle`> instead of actually calling fac itself again, we can parameterize it by the thing i want to re-call
05:19 <nshepperd> oh wait
05:19 <jle`> @let fac n recursiveCall = if n == 0 then 1 else n * recursiveCall (n - 1)
05:19 <lambdabot> Defined.
05:19 <jle`> er
05:19 <jle`> @undefine
05:19 <lambdabot> Undefined.
05:19 <jle`> @let fac recursiveCall n = if n == 0 then 1 else n * recursiveCall (n - 1)
05:19 <lambdabot> Defined.
05:19 <nshepperd> > fix (\loop acc i -> acc : loop (acc * i) (i + 1)) 1 1 -- factorials
05:20 <jle`> fac id 3
05:20 <lambdabot> [1,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600,6227020800,...
05:20 <jle`> > fac id 3
05:20 <lambdabot> 6
05:20 emotions joined
05:20 <jle`> iqubic: now, to get the original factorial, you pass in fac back into itself
05:20 <iqubic> jle`: can you use fix to write that?
05:20 <jle`> (fac (fac (fac (fac (fac ...)))))
05:20 <jle`> that's what fix is
05:20 <jle`> fix f = f (fix f)
05:21 xormor joined
05:21 <iqubic> Oh. So when does it terminate?
05:21 <jle`> fix fac = fac (fix fac) = fac (fac (fix fac))
05:21 <jle`> = fac (fac (fac (fix fac)))
05:21 <iqubic> I see.
05:21 <jle`> = fac (fac (fac (fac (fix fac)))
05:21 <iqubic> ANd it goes on and on
05:21 <jle`> etc.
05:21 <jle`> > fix fac 10
05:21 <lambdabot> 3628800
05:21 <iqubic> Oh. So when does it terminate?
05:21 <jle`> whenever 'fac' doesn't use 'recursiveCall'
05:21 <jle`> then it will just ignore its argument
05:22 Destol joined
05:22 <EvanR> it may not terminate
05:22 <jle`> so `fac (fix fac) 0` will ignore its (fix fac) argument
05:22 <EvanR> see nshepperd's examples
05:22 <jle`> so (fix fac) won't ever expand
05:22 <jle`> fac (fix fac) 0 = 1
05:22 <jle`> w/o ever needing to expand fix fac
05:22 <iqubic> > fix fac 0
05:22 <lambdabot> 1
05:22 <iqubic> > fix fac -1
05:22 <lambdabot> error:
05:22 <lambdabot> • No instance for (Typeable t0)
05:22 <lambdabot> arising from a use of ‘show_M617544506980072183829121’
05:23 <iqubic> right, that produces an endless stream of function calls.
05:23 osa1 joined
05:23 osa1 joined
05:23 <jle`> yeah, since each function call will require (fix fac)
05:23 <jle`> so it'll go on forever
05:23 <jle`> but `fix fac 0` is just `fac (fix fac) 0`, which is just 1
05:23 <jle`> since fac _ 0 = 1
05:23 <jle`> laziness to the rescue ~
05:24 <EvanR> iqubic: you almost always need (-1) in parentheses
05:24 JeanCarloMachado joined
05:24 <iqubic> > fix fac (-1)
05:24 <lambdabot> *Exception: stack overflow
05:24 <iqubic> Right. That is to be expected.
05:25 <EvanR> i wasnt expecting that
05:25 flatmap13 joined
05:25 osa1_ joined
05:25 <jle`> fix fac (-1) expands for ever, since there `fac recursiveCall n` will use recursiveCall in every case, if n is negative
05:25 <iqubic> I was.
05:25 <jle`> i'll admit that it is surprising to me as well
05:25 <EvanR> yeah well youd get that in a regular language
05:25 <EvanR> in haskell you really gotta try to get stack overflow
05:25 <iqubic> because it call fac of n-1 forever and ever until n = 0
05:26 <jle`> yes, but it shouldn't be a stack overflow
05:26 <EvanR> > last [1..] --see
05:26 <lambdabot> mueval-core: Time limit exceeded
05:26 <jle`> hm i get a stack overflow on ghci too
05:26 <iqubic> but if you start with a negative number and continue subtracting 1, you never reach 0
05:26 <jle`> i expected lambdabot to timeout
05:26 <jle`> since the implementation of 'fix' is constant space
05:26 <EvanR> > minBound - 1 * maxBound :: Int
05:27 <lambdabot> 1
05:27 <ChaiTRex> lambdabot's just not fast enough to get last [1..] in time.
05:27 <EvanR> > minBound - 1 * maxBound - 1 :: Int
05:27 <lambdabot> 0
05:28 <jle`> EvanR: mueval imposes some restrictions to the runtime i believe
05:30 [[[[[ExTRa]]]]] joined
05:30 <Mibaz> I'd like to do IO in some random other monad, but there isn't a transformer available. Is it impossible?
05:30 <jle`> it depends on what you really want to do
05:31 <jle`> if your monad is an instance of MonadIO, then you can just use 'liftIO'
05:31 <jle`> MonadIO m => IO a -> m a
05:31 <jle`> :t liftIO
05:31 <lambdabot> MonadIO m => IO a -> m a
05:32 <Mibaz> jle': Well shoot, it is.
05:32 <jle`> hooray :D
05:32 <jle`> usually if it's *possible* to sequence IO with a monad, the monad should offer a MonadIO instance
05:32 <jle`> since MonadIO is a part of base
05:32 takle joined
05:33 <jle`> the monad itself would have to actually support this, of course
05:33 <Mibaz> jle' Ok awesome, that makes this easy. I knew I had to be missing something easy. Thanks
05:33 <jle`> no problem!
05:35 caumeslasal joined
05:35 oish joined
05:36 <supki> j
05:37 JeanCarloMachado joined
05:39 juanpaucar joined
05:40 <SrPx> lol
05:40 <SrPx> the calculus of constructions is literally just the lambda calculus
05:40 <SrPx> with a system for applying arbitrary terms to functions on compile time
05:40 <EvanR> there are many lambda calculi
05:40 justinfokes joined
05:41 osa1 joined
05:41 <SrPx> it is literally just that, `λ (t : *) -> λ (s: t -> t) -> λ (z : t) -> (s (s (s (s z))))`
05:42 <SrPx> the first thing it does is creating a value called t and applying it to the top level lambda
05:42 <SrPx> λ (s: t -> t) -> λ (z : t) -> (s (s (s (s z))))
05:42 <SrPx> then it creates a function that receives t and returns t and applies that to it
05:43 JeanCarloMachado joined
05:43 <SrPx> λ (z : t) -> (λ t . t (λ t . t (λ t . t (λ t . t z))))
05:43 <SrPx> same again
05:43 <SrPx> (λ t . t (λ t . t (λ t . t (λ t . t t))))
05:43 <SrPx> so all functions that need a t are applied to a t so that checks
05:43 <SrPx> I mean my syntax got a little confusing but seriously that's all a type system does
05:43 <SrPx> everything else is just that
05:44 <SrPx> types are a lie
05:44 <SrPx> there is no magic
05:44 <MarcelineVQ> you were the magic all along
05:45 <EvanR> pay no attention to the man behind the currying
05:45 {emptyset} joined
05:45 <SrPx> basically `λ (var : TYPE) -> BODY` just means "hey make a mock value TYPE at compile time, and apply to this otherwise untyped function at compile time"
05:45 SenpaiSilver joined
05:46 butterthebuddha joined
05:46 <SrPx> and logic, what logic even is
05:46 <SrPx> nothing makes sense
05:47 ludat joined
05:49 <SrPx> so if types are theorems and programs are proofs
05:49 <SrPx> and since we just determined clearly types are just mocks
05:50 <SrPx> then theorems are just mocks
05:50 <SrPx> every single mathematical question ever is just asking: "is there a program to which we can apply this mock value to"
05:50 <SrPx> that was so stupid wasn't it
05:50 <SrPx> i'm tired
05:51 <glguy> OK, goodnight
05:51 <SrPx> ):
05:51 takle joined
05:53 benl23 joined
05:53 <nshepperd> the real magic was the type checking we did along the way
05:54 <SrPx> the type checking we did along the way?
05:57 NyanCatMeow joined
05:58 <EvanR> is there a way to get threads with higher priority
05:59 hurkan joined
05:59 mrkgnao joined
06:00 <mrkgnao> is there a way to pattern match on the Nats from GHC.TypeLits?
06:00 <mrkgnao> I have my own little data N = Z | S N type that I can convert to and fro, but I'd rather not
06:01 fosterite joined
06:02 sproingie joined
06:02 sproingie joined
06:04 <jle`> mrkgnao: you can pattern match on them already
06:04 <jle`> the patterns are 0, 1, 2, etc.
06:05 JoshS joined
06:05 <jle`> that is their structure
06:05 <jle`> there structure is not inductive peano nats
06:05 <jle`> s/there/their
06:06 <jle`> you can do things like (n + 1), depending on what you want to do, though
06:06 connrs joined
06:06 zariuq joined
06:07 <EvanR> heh you call that structure?
06:08 hurkan left
06:08 <jle`> i mean, it's like Bool
06:08 <jle`> except with more than two constructors
06:09 <EvanR> ex a primitive String type has such structure "foo", "bar", etc
06:09 <mrkgnao> jle`: so is that type to avoid the high efficiency usually associated with unary Nats? :)
06:09 takle joined
06:09 <mrkgnao> s/to/meant to/
06:10 <jle`> it's not really meant to be a "naked" interface
06:10 <jle`> i think it's meant to assume as little as possible
06:10 <jle`> so that other libraries can take it and extend it
06:10 zariuq joined
06:11 <jle`> GHC.TypeLits is sort of meant to be a low-level API that other libraries are supposed to hook onto and provide useful high-level interfaces
06:12 <jle`> so all it really "offers" is the literals, and the reifiers/reflectors
06:12 jutaro joined
06:12 <jle`> and some basic type families
06:14 <mrkgnao> interestingly, I have a recursive typeclass that sort of accumulates a list in its last parameter
06:14 Croniamental joined
06:14 tromp joined
06:14 <mrkgnao> something like class Foo a b c | a b -> c
06:15 <mrkgnao> and I have a variable of type Foo a b c => Proxy c
06:16 zariuq joined
06:16 <mrkgnao> and *every* time I try to inspect it (either with :t or by trying to print it) it takes a couple seconds, and the time taken does not change on successive attempts
06:17 <mrkgnao> b is a Nat, and the time grows linearishly with b :)
06:17 Rodya_ joined
06:18 takle joined
06:19 heurist joined
06:20 revprez_atlanta joined
06:20 conal joined
06:22 kritzcreek joined
06:22 WhiskyRyan joined
06:23 insitu joined
06:29 zargoertzel joined
06:31 dni joined
06:32 saurabhnanda joined
06:33 SkyPatrol_ joined
06:33 meba joined
06:34 castlelore joined
06:34 castlelore joined
06:35 tefter joined
06:37 takle joined
06:40 eacameron joined
06:40 xanadu_ joined
06:42 dfordivam joined
06:42 saurabhn_ joined
06:43 raichoo joined
06:43 [[[[[ExTRa]]]]] joined
06:44 justinfokes joined
06:44 fizruk joined
06:46 Hunter1_ joined
06:47 takle joined
06:49 <* hackage> hdo 0.5 - A Digital Ocean client in Haskell https://hackage.haskell.org/package/hdo-0.5 (abailly)
06:51 <* hackage> atlassian-connect-descriptor - Code that helps you create a valid Atlassian Connect Descriptor. https://hackage.haskell.org/package/atlassian-connect-descriptor- (RobertMassaioli)
06:53 eklavya joined
06:54 tommd joined
06:59 mohsen_ joined
06:59 <mniip> interesting
06:59 doomlord joined
07:00 <mniip> so it turns out that LR is *all* about comparing item sets for equality and turning the grammar tree into a graph
07:00 {emptyset} joined
07:01 <mniip> because once you try to construct an LR parser without comparing nonterminals for equality (think, e.g, an applicative parser with unlabelled recursion)
07:01 <mniip> surprise surprise, you get an LL parser
07:05 plutoniix joined
07:05 plutoniix joined
07:06 alanxoc3 joined
07:07 fotonzade joined
07:08 takle joined
07:12 juanpaucar joined
07:13 ski joined
07:13 funrep joined
07:14 vlatkoB_ joined
07:16 robotroll joined
07:16 systadmin joined
07:17 <Lokathor> so here's a thing
07:17 <Lokathor> is there a way to specify that a given function can only be called from main, and then have GHC track that?
07:18 <Lokathor> like, any action built with it is also poisoned, and at the very top it will warn you when you're sending such a thing off via forkIO?
07:18 Rodya_ joined
07:18 <Lokathor> "from the main thread", i should say
07:19 filterfish__ joined
07:24 muesli4 joined
07:25 <MarcelineVQ> trying to keep calls on one thread for a c lib?
07:25 <Lokathor> exactly that use case
07:26 <MarcelineVQ> I don't have anything useful to add to that, just clarifying since it seems like it'd be a popular topic
07:26 dni joined
07:26 FreeBirdLjj joined
07:26 ccomb joined
07:26 <Lokathor> rust has Send and Sync
07:27 <Lokathor> but still not quite, as far as i know, a way to ensure that code is only called from the main thread
07:28 <cocreature> hm that’s an interesting question. sadly I don’t know of a way to do that
07:28 <MarcelineVQ> it doesn't need the main thread right, just a consistent thread? like if you did all your work from a single forkOS you'd be in shape yeah?
07:28 <Lokathor> MarcelineVQ, in the case of the GLFW library for C, the C docs claim that particular functions must only be called from the main thread.
07:29 <MarcelineVQ> but that's just to be consistent isn't it? "However, forkOS creates a bound thread, which is necessary if you need to call foreign (non-Haskell) libraries that make use of thread-local state, such as OpenGL (see Control.Concurrent)."
07:30 <mrkgnao> Lokathor: could you not use some kind of ST-like trick here, where the functions need to be polymorphic in what thread they're called from, and then main does something like a runST?
07:30 <mrkgnao> That was vague, I suppose, because there's no way to guarantee that bit.
07:30 <Lokathor> mrkgnao, someone much smarter than me could do that perhaps >_<
07:31 <Lokathor> MarcelineVQ, what you're suggesting is probably true
07:31 conal joined
07:31 <Lokathor> without knowing the precise details of GLFW I can't really say if they've hardcoded anything somehow
07:32 umren joined
07:32 <Lokathor> http://www.glfw.org/docs/3.1/intro.html there's a "thread safety" section there
07:32 stoopkid joined
07:33 <cocreature> mrkgnao: I think the problem with that is that you can’t prevent other threads from using runST
07:33 takle joined
07:33 <cocreature> or your runST replacement
07:33 LHoT10820 joined
07:34 <mrkgnao> cocreature: could I not somehow use a thread "tag" of some sort as the s type?
07:34 <Lokathor> cocreature, prevention in an absolute sense isn't necessarily necessary. GHC telling you that you probably screwed up in big letters when you compile is probably enough in this case
07:34 ragepandemic joined
07:34 <mrkgnao> that would involve some form of talking to the RTS and pushing that into a type .. uh.
07:35 <cocreature> mrkgnao: the problem is that if you are going to run it in main, there needs to be some conversion to an "IO a". and once you have that I don’t see how you can stop me from using that inside of forkIo
07:35 <mrkgnao> https://ghc.haskell.org/trac/ghc/wiki/UnpackedSumTypes -- omg, my eyes
07:36 <mrkgnao> cocreature: the conversion could turn the static check into a dynamic one, which would not be triggered if it were called from the main thread, but would panic otherwise (i.e. if you did something like main = forkIO FakeMain.main)
07:37 <mrkgnao> but you're probably right about this, I think
07:37 <cocreature> yeah a runtime check might be possible
07:37 <cocreature> although I’m not sure how you check if you’re running on the main thread but I assume it’s possible :)
07:38 <Lokathor> I really think that warnings are enough for this situation :P
07:39 <Lokathor> cocreature, also, for example, the "unwrap the action into IO" function can itself be tagged as a poisoned function
07:39 <Myrl-saki> :t (>>-)
07:39 <lambdabot> error:
07:39 <lambdabot> • Variable not in scope: >>-
07:39 <lambdabot> • Perhaps you meant one of these:
07:39 <Myrl-saki> Eh.
07:39 <cocreature> Lokathor: but you want compile time warnings, right? that’s the thing that’s tricky about it
07:39 <mrkgnao> there should be some accursedUnutterableUnsafeGetThreadId function somewhere in the bowels of GHC.*, I guess?
07:39 <cocreature> mrkgnao: it’s just called myThreadId :)
07:39 <Myrl-saki> Oh whoops. It was defind in the source itself.
07:39 <Lokathor> mrkgnao, you can always get your own threadId
07:39 <cocreature> right you can just run it once at the beginning to get the one of main and then compare it
07:39 <cocreature> that’s a lot easier than I thought
07:40 justinfokes joined
07:40 <Lokathor> ah, hmm, type MainOnlyOrCrash a = MonadReader ThreadID a ?
07:40 <* mrkgnao> would've liked that made statically checkable, but meh
07:41 mjora7 joined
07:41 <mrkgnao> cocreature: oh.
07:41 <cocreature> mrkgnao: if you can come up with a solution for checking it statically, let me know :)
07:41 <Myrl-saki> @pl (\return_ -> \a -> return_ (k a))
07:41 <lambdabot> (. k)
07:42 <cocreature> it’s slightly annoying to have to pass the ChreadId of the main thread through your program. maybe there is a way to get it directly
07:42 <mrkgnao> is there an amITheMainThread function, then?
07:42 <cocreature> that’s what I’m trying to figure out :)
07:43 <mrkgnao> the point is, with enough reflection-ish stuff, it's highly probable that this can be done
07:43 <mrkgnao> you could generate some typeclass instance and the Reifies constraint could probab
07:43 <mrkgnao> *probably do the threading around for you
07:43 <cocreature> then I still need to carry that typeclass constraint around everywhere
07:44 <mrkgnao> Yeah, it's just replacing a MonadReader by a Reifies. No point to that, right.
07:44 <mrkgnao> But the ST replacement could have a constraint in the constructor, GADT-style...
07:44 <Lokathor> @pl (\act -> bracket GLFW.init (const GLFW.terminate) $ \initWorked -> when initWorked act)
07:44 <lambdabot> bracket GLFW.init (const GLFW.terminate) . flip when
07:45 <mrkgnao> so pattern-matching gives you that constraint, but no explicit carrying around would be necessary
07:45 <mrkgnao> does that sound right?
07:45 teggi joined
07:46 <Lokathor> i'm not sure that making the use of bracket into a CAF really matters in this case
07:47 verement joined
07:47 nickolay_ joined
07:48 xcmw joined
07:48 <MarcelineVQ> Lokathor: are you making your own bindings? are GLFW-b and bindings-GLFW no good for windows?
07:49 takle joined
07:49 <Lokathor> MarcelineVQ, I'd like to add a "safety layer" over top GLFW-b is all. They work on windows with GHC 8.0.2 or later
07:49 <Lokathor> (but not in previous GHCs, because of a bug with Msys2 or something like that)
07:49 <MarcelineVQ> ah, nothing wrong with more safety
07:50 <Lokathor> related to the "am i the main thread?" there's also "did you try to call me in a reentrant way?"
07:50 gehmehgeh joined
07:50 <Lokathor> which i think haskell /really/ has no answer to
07:51 <Lokathor> at least, not a practical one
07:51 <Lokathor> "MonadReader ThreadID a" is silly, but not the worst thing in the universe
07:52 danvet_ joined
07:54 <jle`> (?myId :: ThreadId) => ...
07:54 pyx joined
07:55 <Lokathor> jle`, never seen a ? in a constraint before
07:55 <jle`> it's an implicit parameter
07:55 <jle`> it means that whoever is using the value must have a variable named myId in scope at the usage site
07:55 <jle`> of type ThreadId
07:56 <Lokathor> hmm
07:56 phyrex1an joined
07:56 <Lokathor> sounds like it'd make things easy to factor out of the middle of big blocks into their own sections
07:56 <Lokathor> neat
07:56 <jle`> it's "yet another solution" to the configuration problem
07:57 <jle`> which MonadReader, Reader, and reflections are also sometimes used to solve
07:57 <jle`> @let impar :: (?x :: Int) => String; impar = show ?x
07:57 <lambdabot> Defined.
07:57 <jle`> > impar
07:57 <lambdabot> mueval-core: internal error: PAP object entered!
07:57 <lambdabot> (GHC version 8.0.2 for x86_64_unknown_linux)
07:57 <lambdabot> Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
07:57 <jle`> oh
07:57 <jle`> i did not expect that
07:58 <Lokathor> hoiseted by your own pitard
07:58 <jle`> @let impar2 :: (?defineMe :: Int) => String; impar2 = show ?defineMe
07:58 flatmap13 joined
07:58 <lambdabot> Defined.
07:58 <jle`> > impar2
07:58 <lambdabot> mueval-core: internal error: PAP object entered!
07:58 <lambdabot> (GHC version 8.0.2 for x86_64_unknown_linux)
07:58 <lambdabot> Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
07:58 <jle`> > let defineMe = 10 in impar2
07:58 nachoman joined
07:58 sternmull joined
07:58 <lambdabot> mueval-core: internal error: PAP object entered!
07:58 <lambdabot> (GHC version 8.0.2 for x86_64_unknown_linux)
07:58 <lambdabot> Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
07:58 <jle`> i wish this worked
07:59 caumeslasal joined
07:59 <Lokathor> like most things in programming
07:59 <Lokathor> it might work in 10 years instead
08:00 <jle`> > let ?defineMe = 10 in impar2
08:00 <lambdabot> "10"
08:00 <jle`> ah
08:00 <Lokathor> ah ha
08:01 <ChaiTRex> ah hahaha
08:02 <jle`> > "ah " : fix ("ha" ++)
08:02 <lambdabot> error:
08:02 <lambdabot> • Couldn't match type ‘Char’ with ‘[Char]’
08:02 <lambdabot> Expected type: [[Char]]
08:02 <jle`> > "ah " ++ fix ("ha" ++)
08:02 <lambdabot> "ah hahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahaha...
08:03 fosterite joined
08:03 <Lokathor> :t fix
08:03 <lambdabot> (a -> a) -> a
08:03 <Lokathor> i still never understand where the first 'a' comes from with fix
08:04 conal joined
08:04 coot____ joined
08:04 <jle`> it comes from itself ~
08:04 <jle`> it's basically the result of an extra call to fix
08:04 <Lokathor> i'm going back to the FFI
08:04 <Lokathor> where things make sense
08:04 <jle`> fix f = f (fix f)
08:04 <jle`> so f is given (fix f)
08:05 <Lokathor> jle`, how do you feel about do-blocks?
08:05 <jle`> so fix ("ha" ++) = "ha" ++ fix ("ha" ++)
08:05 <jle`> = "ha" ++ "ha" ++ fix ("ha" ++)
08:05 <jle`> etc.
08:05 <Lokathor> oh lazyness, it's so fun
08:05 takle joined
08:05 <jle`> do blocks are a neat thing
08:05 conal joined
08:05 <jle`> but yeah, in haskell, the story of fix is simple; the function is just given the result of (fix f); fix f = f (fix f)
08:06 <Lokathor> > fix error
08:06 <lambdabot> "*Exception: *Exception: *Exception: *Exception: *Exception: *Exception: *Ex...
08:06 systadmin joined
08:06 <Lokathor> the robot knows that'd be too easy if it let us get away with that
08:06 <jle`> it tried
08:06 <sternmull> i play around with "stack script" and wonder why it takes around 200ms to execute a file that does nothing more than 'main = putStrLn "Howdy!"'. Even calling ghc and then executing the program is much faster (takes 70ms). Any tips to speed it up?
08:06 <jle`> it probably has to set up the stack environment
08:07 <jle`> which itself is a haskell program
08:07 <Lokathor> sternmull, stack itself checks the state of the world, which can be a huge time sink when you're down to those small fractions
08:07 <jle`> that has overhead to start up
08:07 <jle`> so you're getting the 70ms overhead from your putStrLn "howdy" program
08:07 <Lokathor> on a raspberry pi you can actually feel the difference between stack exec foo and foo, because disk IO is that bad on a pi
08:07 <jle`> as well as another 70ms overhead from stack itself
08:07 <jle`> since stack is a haskell program
08:08 <sternmull> is there a way to reduce this overhead? I am interested in replacing python scripts with haskell. But with 200ms overhead per script execution this could get problematic.
08:08 <Lokathor> sternmull, call your program directly instead of executing it via stack
08:09 <jle`> well, if you batch-run several scripts, you can just write the batch script in haskell instead
08:11 <sternmull> Lokathor: I want that "script" to be managed with other sources and handled like an ordinary script. If i rely on compiling it before it is run then it loses its script-like property which the python scripts have.
08:11 <mniip> hmm
08:11 <mniip> how would I arrange this
08:12 <mniip> I have a list of values, which I want to evaluate in parallel, and see which one computes first, and then terminate the computation of all others
08:12 <Lokathor> sternmull, you can also use "runhaskell"... but if you're using stack you probably have to invoke that via stack
08:12 <sternmull> Lokathor: That would be nice. But the calling processes are no haskell programs. They are buildsystems and other scripts that are implemented in different languages.
08:12 <mniip> the latter is critical because otherwise I'll run out of memory
08:12 takle joined
08:12 <Lokathor> mniip, https://hackage.haskell.org/package/async- ?
08:13 <Lokathor> or something built upon it?
08:13 <mniip> hmmm
08:13 <mniip> interesting
08:13 babu` joined
08:14 <MarcelineVQ> interesting that there isn't a Racing type like there is a Concurrently
08:14 <sternmull> Lokathor: "stack runhaskell" is even slower than calling the haskell script.
08:14 tromp joined
08:15 cschneid_ joined
08:15 <Lokathor> sternmull, what do you mean "calling the haskell script"? that *is* how you run a haskell file as a script. Otherwise you're compiling it and running a binary (which you said you didn't want to do)
08:16 juanpaucar joined
08:16 <MarcelineVQ> stack has a 'script interpreter' mode Lokathor
08:16 <sternmull> Lokathor: No. I can put "#! /usr/bin/env stack" in the first line of a haskell-source file and then run it like a shell script.
08:16 <MarcelineVQ> https://docs.haskellstack.org/en/stable/GUIDE/#script-interpreter
08:16 dm3 joined
08:17 <MarcelineVQ> it's true that it does compile the script though
08:17 <MarcelineVQ> or at least it seemed to when I used it, so that it didn't need to build it twice
08:17 dni joined
08:18 sproingie joined
08:18 sproingie joined
08:18 jutaro joined
08:18 watom joined
08:19 <Lokathor> well now i'm the hoisted one
08:19 Rodya_ joined
08:19 <Lokathor> sternmull, can you talk more about what this script is doing that it needs to stay as a "script" and not be something that you just recompile from time to time?
08:21 <mniip> Lokathor, I wonder if it's safe to call race from a race
08:21 <mniip> like foldr ((either id id .) . race)
08:21 <sternmull> Lokathor: There are multiple things where the script-like behavior is desirable. One of them is a script that contains "project definitions" and is run during the build process to generate the project files. Others generate source files during the build.
08:21 oish joined
08:21 <Lokathor> mniip, it should be fully safe. you'd create some sort of cons-cell-like Either result at the end
08:22 <Lokathor> though you'd have to make it as a balanced tree i expect, or the uneven forking would make the "a" thread at the top always beat the "b" and all its children being made
08:22 moongazer joined
08:23 <sternmull> It would make things really difficult if i had to ensure a "compile scripts" action to be run before any of the scripts is executed. With stuff like python i could avoid that complexity because startup time was no problem.
08:23 <Lokathor> it's built using withAsync, which is safe to nest as much as you like. Note that *too much* withAsync might kill your call stack, since it's using bracket, so it's not tail call eliminated
08:23 justinfokes joined
08:24 <Cale> Lokathor: but there isn't a call stack...
08:24 <mniip> Lokathor, don't worry, the computations themselves are much longer than forks
08:25 <mniip> and if they are short then it doesn't matter which finishes first
08:25 <mniip> such is the context of the task
08:25 simukis_ joined
08:25 castlelore joined
08:25 <Lokathor> then you can go down the list i guess, and then unpack the Either layering of the result to find the index of what action finished first and its value
08:26 entuland joined
08:26 <mniip> see 'either id id .'
08:26 <mniip> I don't care about the index
08:27 <Lokathor> :t foldr ((either id id .) . Control.Concurrent.race)
08:27 <lambdabot> error:
08:27 <lambdabot> Not in scope: ‘Control.Concurrent.race’
08:27 <lambdabot> No module named ‘Control.Concurrent’ is imported.
08:27 <Lokathor> :t foldr ((either id id .) . Control.Concurrent.Async.race)
08:27 <lambdabot> error:
08:27 <lambdabot> • Couldn't match type ‘IO (Either a b)’ with ‘Either (IO b) (IO b)’
08:27 <lambdabot> Expected type: IO a -> IO b -> Either (IO b) (IO b)
08:28 <xormor> is Haskell the programming language for me? I know the basics of C, C++, x86 assembly and amd64 assembly.
08:28 <mniip> hmm
08:28 <mniip> sprinkle with some fmaps
08:28 dm3 joined
08:28 <mniip> xormor, depends. Depends not on what you know but on what you want to do
08:28 <Lokathor> xormor, haskell is for you if you want a general purpose memory managed langauge with lots of static / compile-time support
08:28 <mniip> and whether you are eager to learn a lot
08:30 takle joined
08:30 <Lokathor> Cale, what I mean is that.. well i'm not a GHC expert, but... okay well i guess it's just slightly more memory overhead and you'd alraedy be making thousands of threads anyway so you probalby don't care..
08:30 <Lokathor> hmm
08:31 bigos joined
08:31 <sternmull> xormor: And don't expect the performance of C/C++ from haskell. Its more like a super fast statically typed python. At least in the sense that it allows a high level of abstraction and lots of libraries. Of course a Haskell program looks much different from a python program, its not just different syntax.
08:31 <moongazer> What does the <- operator do in python?
08:31 <Athas> Also if you are patient.
08:32 <Athas> moongazer: less-than-negation.
08:32 <Athas> x<-y
08:32 <Lokathor> sternmull, Haskell runs circles around python speedwise >_>
08:32 mjora7 joined
08:32 <MarcelineVQ> when it comes to speed, as with all languages, it really depends on what you're doing and how you're doing it
08:32 <sternmull> Lokathor: Yes. Thats what i wrote.
08:33 <Lokathor> sternmull, sorry, let me restate my question, "why would you compare haskell to python in particular in the first place?"
08:35 tsahyt joined
08:35 <sternmull> Lokathor: I was looking for a highlevel language that is statically typed and could replace my python scripts. So far haskell is the only thing that looks like it could do that job. Thats the reason i measure haskell against python.
08:36 pratch joined
08:36 tsahyt joined
08:36 lep-delete joined
08:36 <Lokathor> sternmull, if startup time differences measured in ms are a major concern, I think that Rust is what you want, but you can't run a foo.rs file as a script, you have to compile the binary
08:36 sssilver joined
08:37 <Athas> sternmull: I am a Haskell programmer, but I still use Python for "scripts", where a "script" is a small (single-file) program that operates on partially-structured data.
08:37 <Athas> Especially if the script mostly just orchestrates various libraries.
08:37 <Athas> And doubly especially if I can just stick with Python's standard library, or close.
08:37 <Athas> It's just more convenient. Haskell scales better, but I find it more awkward for small things.
08:38 <Lokathor> sternmull, perhaps I should ask, why can't you compile a haskell program that reads a config from the disk somewhere? I'm assuming "the script changes often" is part of why you currently want it to be a script and not compiled
08:38 <sternmull> Lokathor: Well... i had an eye on rust in its early stages. But today it looks less attractive to me. Its much more low level compared to haskell and python. Also it has not settled on a concurrency library and some other things.
08:38 <Lokathor> Athas, if you install a bunch of packages into your global project with stack, haskell turns out well with small stuff too
08:39 <bjz> sternmull: What do you mean by 'a concurrency library'?
08:39 mmn80 joined
08:39 <* hackage> base-feature-macros 0.1 - Semantic CPP feature macros for base https://hackage.haskell.org/package/base-feature-macros-0.1 (HerbertValerioRiedel)
08:39 <Athas> Lokathor: yes, that might help.
08:39 uglyfigurine joined
08:40 <mniip> Lokathor, weird
08:40 <sternmull> bjz: Python has asyncio (which i do not relly like, but its ok), Haskell has forkio (and more abstract stuff that is based on it), rust does not really have a mature solution for that.
08:40 <mniip> it's like 'race' takes ~0.2 seconds to fork
08:40 sssilver_ joined
08:40 <Lokathor> mniip, ?
08:41 <bjz> sternmull: indeed. But it seems like things are converging around tokio.
08:41 <Lokathor> Athas, https://github.com/Lokathor/scratch/blob/8fc907ca5b531b25d83438051ddfdcac4cf2084a/src/EOConvert.hs here's a "sript" i did a few weeks ago that I would have written in python a decade ago
08:41 <Lokathor> bjz, oh boy is tokio not ready for prime time if you're not a super rust expert
08:42 <bjz> Lokathor: agreed :(
08:42 <Lokathor> mniip, how many forkings are you trying to do exactly?
08:42 <Athas> Lokathor: that doesn't really use any libraries or awkward data structures (JSON...), so it's a very nice fit for Haskell.
08:43 <bjz> Lokathor: Hopefully will be different a year from now
08:43 <mniip> up to about 200-ish
08:43 <Athas> Just today I wrote a Python script that reads a bunch of JSON files with benchmark result data and produces graphs of the results (using Matplotlib). I'm not sure that would be much nicer in Haskell.
08:43 <sternmull> Athas: I am not sure if haskell will be able to replace my python scripts. But i want to try. One reason are the multiple time when i messed up a python script (typo in a variable, front arguments for functions, invalid operations on objects, ...) that a compiler would have told me about before i messed up in action.
08:43 <Lokathor> bjz, i spent an afternoon asking how to write an IRC bot in tokio, because almost all docs are server oriented. no one could really explain or help much. Then I just did it with a bare TCP socked cloned into 2 threads
08:44 <Lokathor> "that's crazy talk! how unsafe!" they cried, "but it runs at all!" i cried back
08:44 <bjz> Lokathor: :P
08:44 <Athas> sternmull: how big are these scripts?
08:45 <Lokathor> Athas, perhaps my secret is that i don't know enough python to know what sweet libraries i'm missing out on
08:45 biglama joined
08:47 <Athas> Lokathor: man, I don't either. All my Python programming involves taking some older program of mine and modifying it; perhaps stretching back to some mythological ur-hello-world.
08:47 <Lokathor> that's how my cabal files go
08:47 <Athas> Does Haskell have anything that could replace Matplotlib? Most of my Python ends up havin to interact with that thing.
08:47 <Athas> Also every LaTeX file ever.
08:48 takle joined
08:48 <sternmull> Athas: Some of them have grown to a size where i wish i could compile/typecheck them before trying them out because it is hard to consider all uses of variables/classes/functions. Many of them are actually definitions of interfaces/projects that are processed to produce files.
08:48 <Lokathor> I've thankfully moved from LaTeX to boring old github markdown
08:50 <Athas> sternmull: if you start having data structures and internal interfaces more complex than hash tables, then Haskell can probably help you.
08:50 <Athas> It depends on what you consider a "script".
08:50 insitu joined
08:51 moet joined
08:51 <sternmull> Don't get me wrong, i like python. Its standard library has so much to offer that all the stuff i did in the last decade barely needed any extra packages. That is really cool. Also it is easy to read and write and the error reporting (stack straces on exceptions) are fantastic. But i don't like it for more complex programs. At some point i simply miss static typing (and if its only for documentation purposes).
08:53 <Athas> Agreed. I don't mind Python for what it is.
08:53 <Athas> Just like how I don't mind Haskell for what it is, but probably wouldn't use it for high-performance computing.
08:54 <moongazer> Lol
08:55 <moongazer> What does the <- operator do in *Haskell*
08:55 tommd joined
08:55 <moongazer> I mean I have used it in list comprehensions
08:55 <moongazer> But still
08:55 <Athas> It's not an operator, it's a piece of syntax that can mean different things.
08:56 <Athas> It's always a binding construct of some sort.
08:56 <Athas> Monadic bind, list comprehension bind, or pattern guard bind.
08:57 merijn joined
08:58 entuland joined
08:58 connrs joined
08:58 <mniip> Lokathor, apparently all that was needed was +RTS -V0
08:59 <Lokathor> neat
08:59 <Lokathor> what's -V0
08:59 <sternmull> Athas: I agree. Years ago i gave haskell a try and compared it to my numeric-heavy C++ code of that days. Of course haskell lost. Today i have lots of use for a good high level language where reliable and maintainable programs are more important than performance as long as it is around the speed of python. Thats where haskell got attractive to me again.
09:00 justinfokes joined
09:00 <mniip> Lokathor, disable the ticks
09:01 <Lokathor> sternmull, Haskell is doing "not so bad" in high performance computing if you're willing to get specialized about it with CUDA and stuff
09:01 nachoman joined
09:01 <Athas> Lokathor: do you have any examples?
09:01 <Athas> I have been looking for them for years.
09:02 <Athas> There's lots of PoCs, but I can't find anyone who really uses it.
09:02 <Lokathor> i'm afraid i don't have an actual example
09:02 <Lokathor> as with most things Haskell, it's more like "Well you could if you wanted to" territory
09:02 moet joined
09:03 soniku joined
09:03 fosterite joined
09:04 <Athas> I'm not sure it's particularly easy with Haskell. It's inherently not built for performance, and the HPC libraries tend to be a little awkward.
09:04 im0nde joined
09:05 <sternmull> Lokathor: Back then i was interested in efficiently messing around with lots of 3D-vectors, matrices and quaternions for my OpenGL stuff. I think its quite difficult to get Haskell to compete with C++ and Eigen in that area.
09:05 <Lokathor> it depends on if what you're doing can be run in parallel or not, yes
09:06 <Lokathor> because haskell makes parallel trivial, but if you're not using that then it's useless after all
09:06 <Lokathor> oh my it's 3am
09:06 <Athas> Haskell makes *correct* parallelism trivial, but it's still not very fast.
09:07 ph88_ joined
09:07 <Lokathor> http://chimera.labs.oreilly.com/books/1230000000929/ch05.html
09:07 <Lokathor> heres's a full chapter on it, if you haven't read it
09:07 t7 joined
09:07 <Lokathor> anyway, i gotta sleep
09:07 <sternmull> but at least Haskell has lightweight threads. Something that rust announced in its early days and then abandoned.
09:07 fotonzade joined
09:08 <Athas> Repa is OK, but it's a little restricted.
09:08 takle joined
09:08 entuland joined
09:08 <Athas> And the type machinery is heavy.
09:08 <Lokathor> Athas, the next chapter is the accelerate package, if you like that better :P
09:08 <Athas> Accelerate is also restricted (flat), still has type craziness, and is not very fast.
09:08 <Athas> But it's pretty convenient.
09:09 rcat joined
09:11 conal joined
09:12 HoboKing joined
09:13 sproingie joined
09:13 fendor joined
09:13 sproingie joined
09:13 <HoboKing> When using stack, I'm getting a nonsensical error when trying to build my package.
09:13 <HoboKing> The really odd thing is that it works in stack ghci, but not in stack build
09:13 Xanather joined
09:13 <HoboKing> The error is simply a complaint that I use <- outside of a do-block, which isn't true.
09:14 funrep joined
09:14 <cocreature> HoboKing: can you show us the code?
09:15 <HoboKing> How do I do that in IRC?
09:15 <Lokathor> Athas, just skimming the benchmarks from http://www.cse.unsw.edu.au/~tmcdonell/papers/TrevorMcDonell_PhD_submission.pdf
09:15 <Athas> HoboKing: put it on hpaste.org.
09:15 laplacian joined
09:15 <Lokathor> it seems to be "sufficiently fast" to me
09:15 tromp joined
09:15 <Lokathor> though still more like "java and C++ faster" rather than "c and rust fast"
09:16 marr joined
09:16 <Athas> Lokathor: sure, Accelerate is (much!) better than straight Haskell, but it's far from what it could be.
09:16 <lpaste> HoboKing pasted “The offending part” at http://lpaste.net/3846518731148623872
09:17 <Athas> (I do functional GPU programming myself, and Accelerate is my main inspiration/competitor/reference.)
09:17 <cocreature> HoboKing: try indenting that line 2-5 by 2 more spaces
09:17 <Lokathor> gotta send those patches back upstream :P
09:17 <Athas> For example, the N-body benchmark can improve by at least 2x by doing block tiling; a nontrivial optimisation.
09:18 justinfokes joined
09:18 <Athas> It may of course also be that Accelerate was tuned for older GPUs than what I tested on.
09:18 fizruk joined
09:18 <HoboKing> cocreature: Same thing.
09:19 <HoboKing> Again, WHY would it compile in stack ghci but not in stack build?
09:19 entuland joined
09:19 Rodya_ joined
09:20 juanpaucar joined
09:20 <Athas> HoboKing: I've also found that ghci sometimes parses slightly differently.
09:20 <cocreature> how exactly are you trying to use that in stack ghci? do you just paste this code in ghci or do you let stack ghci compile the modules for you?
09:20 filterfish__ joined
09:20 <HoboKing> I let stack ghci compile the modules for me
09:20 <Athas> It's definitely the mis-indentation of the do-body.
09:21 <MarcelineVQ> idk about parses differently, but if a module isn't listed in your cabal file some part of the build system may ignore it, so you won't see an error
09:21 <cocreature> also it’s a standalone "let". that’s not valid Haskell (although it is valid in ghci)
09:21 <HoboKing> It was in a do-block
09:21 <cocreature> it would be helpful if you could show us the complete file
09:21 <HoboKing> The complete file is over 1000 lines long
09:21 <cocreature> or at least some part that’s valid haskell
09:22 fizruk joined
09:23 foton joined
09:23 <cocreature> then show us at least the complete binding in which you use this
09:24 <lpaste> HoboKing revised “The offending part”: “The offending part” at http://lpaste.net/3846518731148623872
09:24 <cocreature> you still haven’t indented the do block
09:25 <cocreature> line 17-20 and line 22-25 need to be indented
09:25 takle joined
09:26 <HoboKing> wait,something's weird with the way I pasted it
09:26 <lpaste> HoboKing revised “The offending part”: “The offending part” at http://lpaste.net/3846518731148623872
09:27 nullifidian_ joined
09:27 gawen joined
09:27 <HoboKing> cocreature: I don't understand. It looks indented to me.
09:28 <cocreature> HoboKing: it needs to be indented more than the name of the let binding, i.e. until2
09:28 <HoboKing> but it is?
09:29 <HoboKing> Wait, am I even seeing the same thing as you?
09:29 <MarcelineVQ> the reason the lines mentione need to be indented farther is that as they are now they belong to the 'let' instead of the do
09:29 entuland joined
09:29 <HoboKing> OH
09:29 <cocreature> HoboKing: pl starts in the same column as until2
09:29 <HoboKing> huh
09:29 revtintin joined
09:30 <HoboKing> Alright, yeah now it works. I didn't realize you needed to indent twice; once for let, and another for do.
09:30 Kreest__ joined
09:32 <HoboKing> Now it finally compiles. Thanks for the help!
09:32 <cocreature> np
09:32 <Athas> The wonders of the layout rule!
09:35 hariel joined
09:36 xcmw joined
09:37 dan_f joined
09:37 hackebeilchen joined
09:38 Wizek_ joined
09:42 takle joined
09:42 BartAdv joined
09:44 angelos joined
09:45 acidjnk22 joined
09:46 <MarcelineVQ> I do wonder if -XNondecreasingIndentation was making things odd with ghci
09:46 <Athas> I have definitely seen ghci sometimes be more lenient about layout rule violations.
09:47 <Athas> I was very confused too.
09:47 mivael_ joined
09:50 connrs joined
09:50 osa1 joined
09:51 leat joined
09:51 gwn joined
09:52 ludat joined
09:52 watom left
09:53 centril joined
09:53 takle joined
09:53 PennyNeko_ joined
09:54 justinfokes joined
09:56 dan_f joined
09:58 thc202 joined
09:58 ADG joined
10:00 <ADG> how to write this in haskell
10:00 <ADG> https://github.com/adityagupta1089/Project-Euler/blob/master/src/problems/P023.java
10:00 <ADG> given that I have getAbundantNumbers in Haskell already made
10:00 takle joined
10:01 kuribas joined
10:02 Cooler joined
10:03 <Cooler> does cabal update update cabal to the latest version?
10:03 beanbagula joined
10:03 <phadej> Cooler: cabal update only updates the package database information (apt-get update vs. apt-get upgrade)
10:03 <phadej> and there isn't `upgrade` variant in cabal
10:03 bjz joined
10:04 <phadej> (because it's not package manager in a sense apt is)
10:04 conal joined
10:04 saurabhnanda joined
10:04 yellowj joined
10:04 <Cooler> so do you have to manually download and install the latest version?
10:04 fosterite joined
10:04 mk-61 joined
10:04 Gurkenglas joined
10:05 Icewing joined
10:05 caumeslasal joined
10:06 <phadej> Cooler: nope; you can do cabal update; cabal install cabal-install; yet that's the thing you will get into cabal hell
10:06 <phadej> Cooler: ATM; I'd suggest using `stack install cabal-install-versionnumber`; or then a bit more tricker cabal new-build variant
10:07 a3Dman joined
10:07 <phadej> Cooler: yet downloading the binary from https://www.haskell.org/cabal/download.html is probably most easy way
10:07 gmcabrita joined
10:07 <Cooler> where does cabal install stuff?
10:08 <Cooler> can ghc find it when i build?
10:08 <phadej> Cooler: libraries or executables_
10:09 <Cooler> phadej, libraries
10:09 takle joined
10:10 entuland joined
10:10 <phadej> Cooler: ghc has a notion of "package-db" and there are few default databases ("global" and "user") where it looks for. "user" databases is where `cabal install` *registers* packages. Yet it's shared database and I'd advice to *never* install anything into "user" package database.
10:10 osa1 joined
10:10 <phadej> Alternatives are: cabal sandboxes, stack or cabal new-build
10:11 <Cooler> i just did cabal install fgl
10:11 <Cooler> i think thats a global install
10:11 <phadej> It is global. (yet it installs into your user package database, not system wide "global" db)
10:11 <Cooler> well its in appdata
10:12 <phadej> and it's bad because it's very hard to update the version of fgl (and packages depending on fgl)
10:12 <phadej> so, just newer `cabal install`
10:12 <phadej> as cabal new-build is still experimental, use stack
10:12 <phadej> especially on windows
10:12 fotonzade joined
10:12 justinfokes joined
10:12 <Cooler> do you use sublime text?
10:13 <phadej> nope
10:13 <phadej> s/newer/never/
10:13 <phadej> stack solves problems you will eventually run into if you `cabal install` stuff
10:14 <Cooler> cabal is also a build system right?
10:14 <ertes> Cooler: if you're on linux, you could just use your system's package manager for cabal-install
10:15 <phadej> cabal is build system; package management is "also" part
10:15 <ertes> Cooler: cabal is a simple build/deployment system, and cabal-install is a command line interface to it
10:15 <* hackage> acme-cofunctor - A Cofunctor is a structure from category theory dual to Functor https://hackage.haskell.org/package/acme-cofunctor- (JasperVanDerJeugt)
10:16 <Cooler> hehe acme
10:16 <ertes> Cooler: keep in mind that these are separate… upgrading cabal amounts to upgrading GHC, but cabal-install can be upgraded separately
10:16 saurabhnanda joined
10:17 <ertes> personally i just use the system package manager for GHC and cabal-install
10:20 Rodya_ joined
10:21 rockfordal joined
10:21 revprez_atlanta joined
10:23 splanch joined
10:25 meoblast001 joined
10:26 heurist joined
10:26 Cooler joined
10:27 Snircle joined
10:27 oisdk joined
10:27 Kuros` joined
10:28 <ertes> can one see stack heaven, if one can't see cabal hell? or is it more the other way around? is it only when you clearly see cabal hell that you understand that stack heaven does not exist?
10:28 gwn left
10:32 justinfokes joined
10:32 insitu joined
10:32 connrs joined
10:33 henriksod joined
10:33 <Cooler> anyone use hsdev?
10:33 <Cooler> http://hackage.haskell.org/package/hsdev
10:33 <torstein> say I have a non-recursive product data structure: data DB = ID Versions Files; what would be the best way to convert it to and from string, assuming it's elements are showable?
10:33 juanpaucar joined
10:34 <Cooler> i get an error trying to install hsdev
10:34 <Cooler> https://hastebin.com/mobufojoha.tex
10:34 pranitbauva1997 joined
10:34 <Cooler> doing cabal install hsdev
10:34 <mrkgnao> torstein: is the default derived Show instance not suitable?
10:34 <torstein> mrkgnao, I want newlines between elements
10:34 <mrkgnao> hey, it seems my ten minutes of finally messing around with cgroups has worked
10:35 <ertes> torstein: Read doesn't expect the format to match *exactly*… use your own Show instance and the auto-derived Read instnace
10:35 <ertes> instance
10:35 meba joined
10:35 <mrkgnao> well, then you probably have to write the Show instance yourself. is that infeasible for some reason?
10:36 <Cale> Don't make it a Show instance
10:36 <mrkgnao> ertes: I doubt torstein is expecting to do a Read for that, though. :)
10:36 <mrkgnao> Pretty-printing
10:36 <Cale> Show instances probably shouldn't ever generate newlines
10:36 simendsjo joined
10:37 <ertes> it's a bit late to define how Show instances should behave =)
10:37 <mrkgnao> Protolude enforces this by not exporting the class, afaik. It's infuriating but good for you.
10:37 <Cale> I think that's going too far
10:37 <ertes> yeah, me too
10:37 <Cale> Sometimes you'll want to write a Show instance for data structures such as Set
10:37 <ertes> i define custom Show instances a lot
10:38 <Cale> which have very different internal structure from what they expose to their users
10:38 <Cale> However, I think show ought to produce valid source code for reconstructing the structure, as often as possible.
10:38 <ertes> instance Show BlahId where showsPrec d = showsPrec d . fromBlahId
10:38 <ertes> turn "BlahId 500" into "500"
10:38 <torstein> Maybe my approach is a bit sideways. I want to save a data structure consisting of an int and a map (int->string) to file, and load it from file. I know for certain that the data structure won't be extended so I'm looking for a simple approach
10:38 <mrkgnao> I just wish GHCi let you use some other class which didn't have the problems with Show -- Read being a way to execute arbitrary stuff and so on (right?)
10:38 <ertes> torstein: use aeson
10:40 <ertes> torstein: aeson will write FromJSON and ToJSON instances for you automatically (unless you give explicit definitions), and then you can go to and from JSON very easily
10:40 <torstein> okay that sounds good
10:41 bshelden joined
10:42 oisdk joined
10:42 <Cooler> cabal install keeps stopping after several dependencies and reporting "openFile: does not exist"
10:42 <Cooler> https://hastebin.com/mobufojoha.tex
10:43 <torstein> seems aeson uses bytestring. Will the output be human readable? I want the file to be human readable; json is fine, binary is not
10:43 <Cooler> also why the hell are there so many dependencies
10:43 <ertes> torstein: it's human-readable
10:43 sgflt joined
10:44 <ertes> torstein: it uses ByteString mostly to be fast and to abstract the encoding away
10:45 <phadej> ertes, torstein: see also http://hackage.haskell.org/package/aeson-
10:45 <Cooler> semigroupoids, cofunctors, comonads, wth
10:45 <phadej> encodeToLazyText = LT.decodeUtf8 . encodingToLazyByteString . toEncoding
10:45 connrs joined
10:45 <Cooler> profunctors, bifunctors, what....
10:46 hc joined
10:46 <* hackage> cryptonite-openssl 0.6 - Crypto stuff using OpenSSL cryptographic library https://hackage.haskell.org/package/cryptonite-openssl-0.6 (VincentHanquez)
10:47 yellowj joined
10:47 <Cooler> this can't be right, theres no way they use even half of these
10:48 <Rembane> Cooler: They do.
10:48 <phadej> Cooler: "they"?
10:48 <phadej> most likely they do
10:48 <Rembane> Cooler: Have you pasted the whole error message?
10:49 <Cooler> well i just ran "cabal install hsdev" over and over again
10:49 <Cooler> seems to resume where it left off
10:50 <Rembane> Cooler: You could use stack instead. It might give you a better experience.
10:50 <Cooler> well heres the new error
10:50 <Cooler> https://hastebin.com/usizakurip.sql
10:50 mrkgnao joined
10:50 <phadej> that what I said.
10:51 filterfish__ joined
10:51 <phadej> wipe~/.cabal and ~/.ghc (not sure what they are on Windows); and start fresh with stack
10:51 <Rembane> Now that's an error to write home about.
10:51 <Rembane> Cooler: Do what phadej says.
10:52 <phadej> `cabal install` will make your head hurt (already did; it seems)
10:52 greynix joined
10:53 <Cooler> does everyone use stack? i see mentions of cabal only on github repos
10:53 <ertes> Cooler: i don't use stack
10:53 <Rembane> Cooler: I use both.
10:53 <Cooler> they all say cabal install <package_name>
10:56 <phadej> Cooler: I do use both; stack is way more beginner friendly; cabal is more flexible (but harder to use)
10:56 <ertes> Cooler: cabal-install is fine, and if it doesn't work, stack will not help you either… the only real advantage of using stack is to get per-package -foptions
10:56 <ongy> It's a bit mixed. Stack is a bit like debian, can be behind a bit, but it's more stable. Cabal is more flexible, up to date. But breaks a bit more often (especially when someone doesn't follow best practice)
10:57 <phadej> ertes: don't confuse beginner, if you don't want to explain how new-build or sandboxes work
10:57 <phadej> and why they exist etc.
10:57 <ertes> phadej: what?
10:57 <ongy> new-build :) when will that go into a stable release?
10:58 <phadej> ongy: it's quite usable in 2.0 which will be released with GHC-8.2
10:58 <phadej> but not ready still :/
10:58 <Rembane> Sandboxes are good though.
10:58 <ongy> phadej: I do use it already, but I had to manually upgrade cabal, and I prefer things to be in my repos
10:59 <phadej> ongy: in hvr-ppa there is cabal-install-2.0 package already
10:59 <phadej> which is build from 2.0 branch
10:59 <Cooler> what is Cale who uses Sublime text?
10:59 <Cooler> was it*
10:59 <phadej> ertes: sorry, my IRC client did something weird for me
10:59 <Cooler> anyone use this? https://github.com/SublimeHaskell/SublimeHaskell
11:00 <ongy> I'd need a PKGBUILD in the aur, which I did think about creating, but never did that before and the build process was a bit unstable when I looked into it (there's an issue on github somewhere about the buildscript from then)
11:01 <Cooler> or you guys on emacs?
11:01 mrkgnao joined
11:02 wilornel joined
11:02 <phadej> ongy: IIRC you should be able to build cabal-install-head/cabal-install-2.0 with cabal-install-1.24
11:02 <ertes> Cooler: i'm on emacs
11:02 <wilornel> How could I tell `stack setup` to use an already downloaded ghc-8.0.2.tar.bz2 file?
11:02 <phadej> wilornel: you cannot AFAIK
11:02 wictory[m] left
11:02 <wilornel> darn, that's a bummer
11:02 <wilornel> `stack setup` won't terminate
11:03 <wilornel> it won't finish the download
11:03 <wilornel> I'll try again
11:03 <ongy> phadej: I think that's what I did then, but having a build-depend that will be replaced by what's build is a bit annoying, and from how I understand it, the script should bootstrap from ghc alone, which I would highly prefer for a PKGBUILD (but it had some problem picking the right version, which made things fail)
11:04 <phadej> ongy: hmm. there's bootstrap.sh indeed, and I hope it should work, as it's tested on Travis
11:05 <wilornel> oh I know, I'll try to redirect the url to local
11:05 laplacian joined
11:06 <wilornel> where does it download the file from?
11:06 soniku joined
11:06 <phadej> wilornel: run stack setup -v; it should tell
11:07 <ongy> phadej: https://github.com/haskell/cabal/issues/4365 this one was created back then, I have no idea if it's actually fixed yet. I'll give it a try in chroot, wanted to do that for a while either way
11:07 mmn80 joined
11:08 justinfokes joined
11:08 <phadej> ongy: I see
11:10 sheogorath joined
11:10 <phadej> Is there some basic archlinux-docker images?
11:11 ed-ilyin-lv joined
11:11 <phadej> with basic build tools
11:11 <ongy> doubt it, there's no stable releases, so images would generally be a pain (there's even problems when upgrading from to long ago)
11:11 <phadej> :S
11:12 <ongy> pacman checks package signatures, but the public key are a signature, and if you don't update for to long, it can't check the package that will give new keys =.=
11:12 jtobin joined
11:12 <ongy> erm, public keys are a package
11:12 <wilornel> well, that didn't work. Can't setup a virtualhost for github.com
11:12 bigos joined
11:14 funrep joined
11:14 <* ertes> . o O ( just use cabal-install… )
11:15 <ongy> I love that my log has "just use stack" and "just use cabal-install" in less than 100 lines from each other
11:15 <ertes> stack questions always seem to be related to some problem that stack created by itself
11:16 <ertes> and i still don't quite understand what problem it solves
11:16 <wilornel> ertes, I am reading about Yesod
11:16 alhariel joined
11:16 <wilornel> and I thought I should use stack
11:16 <wilornel> ongy: hahah
11:16 <ertes> wilornel: stack is by the same people who created yesod, so of course they would want you to use stack =)
11:17 agjacome joined
11:18 <Cooler> i don't understand how you have that many dependencies
11:18 ziocroc joined
11:18 <wilornel> I do?
11:18 max3 joined
11:18 <wilornel> I am just trying to do `stack setup`
11:18 <wilornel> It's strange that it won't let you use a custom file
11:18 <wilornel> It doesn't have a cache?
11:19 Itkovian joined
11:19 Levex joined
11:20 sampuka joined
11:21 <ertes> perhaps you can tell it to use your system's GHC
11:21 Rodya_ joined
11:21 <ertes> --you-suck-at-being-a-package-manager-so-please-just-use-my-system-ghc
11:21 Mon_Ouie joined
11:21 <Cooler> so s....l....o...........w
11:22 <ertes> Cooler: what?
11:22 <wilornel> ertes that flag would save me
11:22 <ongy> if lens is in there somewhere, that pulls in half of hackage (only slightly exaggerating)
11:22 <Cooler> cabal is stuck at building hlint
11:22 <ertes> does new-build have a binary cache option?
11:23 <cocreature> wilornel: https://docs.haskellstack.org/en/stable/yaml_configuration/?highlight=system%20ghc#system-ghc
11:23 <Cooler> ongy, yes it contains lens
11:23 insitu joined
11:23 <phadej> ongy: about the same amount as aeson
11:23 <ongy> ertes: what would that be in the context of new-build? for the build applications?
11:23 <Cooler> and it contains aeson too
11:24 <phadej> ertes: what you mean by binary-cache?
11:24 <phadej> ertes: new-build is a sandbox where you never reinstall packages
11:24 xcmw joined
11:24 <ertes> ongy: well, since it's inspired by nix, it might also have the option to prebuild packages on a hackage-side server, so users don't need to compile everything from scratch
11:24 <phadej> ertes: ah that kind; not really
11:25 <phadej> ertes: yet it's possible to make
11:25 <Cooler> how is it taking longer to build than it took to download
11:25 <ertes> i understand that such an option would turn new-build into basically-nix =)
11:25 <phadej> ertes: and it would be killer feature for travis CI jobs
11:26 <phadej> as matrix.hackage.haskell.org does build packages
11:26 <ertes> Cooler: you can speed up the build by passing -j
11:26 <phadej> (and that you could trust as a source, a bit like hydra in nix world)
11:26 <cocreature> ertes: that would be quite fragile I think, given that cabal doesn’t track C dependencies or any other system dependencies
11:26 <ertes> Cooler: if you have multiple cores
11:26 justinfokes joined
11:26 <phadej> cocreature: but not in e.g. travis usecase
11:26 <ertes> cocreature: yeah, that's why i said it would turn new-build into basically-nix, because then it would need to track all of that
11:27 ed-ilyin-lv joined
11:27 <phadej> as c dependencies come from the default ubuntu apt-get repositories
11:27 <Cooler> ertes, passing -j to cabal install? well its too late now
11:27 <Cooler> its just stuck at building
11:27 <cocreature> phadej: in my experience they often don’t, even on travis, because travis is horribly out of date sometimes
11:27 <ertes> Cooler: if you abort and restart it, it will continue where it left off, except that you will restart the current package
11:28 <phadej> cocreature: well, they are upgrading to trusty (sarcastic yey)
11:28 <cocreature> phadej: I know but even that is old :)
11:28 <Cooler> ertes, what does building mean? its just compiling the sources with ghc right?
11:28 <cocreature> good luck getting LLVM 4 from the official apt repos of trusty
11:28 <ertes> Cooler: yeah
11:29 <Cooler> so is ghc slow?
11:29 <phadej> cocreature: you are thinking about specifics, but for testing of majority of libraries it's enough
11:29 <cocreature> phadej: sure but then it’s still a fragile system. it just happens to work in most cases
11:29 <ertes> Cooler: it's slow and uses a lot of memory, but keep in mind that one line of haskell can have much more meaning than one line of most other languages
11:30 <phadej> cocreature: yep; using nix or docker or something would be way simpler
11:30 nachoman joined
11:30 <cocreature> phadej: also since travis introduced caching, building dependencies is rarely a problem ime
11:30 <ertes> Cooler: you can make it a lot faster by disabling optimisation, but i strongly recommend not doing that =)
11:30 plutoniix joined
11:31 <phadej> cocreature: yes and no; when say some package at the bottom of hierarchy is updated; e.g. bifunctors or semigroups; then virtually every repository have to rebuild everything
11:31 <Cooler> well when you use a 100 different packages as dependencies i guess it takes a while to compile
11:31 <phadej> cocreature: it's amortized time per repository (bifunctors aren't updated often); but O(n) in amount of repositories
11:32 <phadej> especially visible when new GHC version is released
11:32 <cocreature> phadej: sure but that’s more a problem for travis not for users of travis. as a user I don’t care a whole lot if the builds for my repo take a bit longer every once in a while
11:33 <ertes> Cooler: what's your level of haskell?
11:33 mr_sm1th joined
11:33 <phadej> cocreature: from my pov (as (co-)maintainer of many packages) it's a problem; not big one; but a problem.
11:33 <cocreature> fair enough
11:33 <Cooler> ertes, 0?
11:35 ed-ilyin-lv joined
11:36 <ertes> Cooler: ok… there is a way to avoid all of that waiting, but i will not tell you right now… wait until level 2, "intermediate" or "advanced beginner" or perhaps the "i'm now ready to learn more about tools" level =)
11:36 <ongy> phadej: The build went through with the bootstrap.sh this time (I simply set up a fresh arch in a chroot). Do you by chance know the arguments to tell bootstrap.sh to install into /usr/bin instead of /root/.cabal/bin when run as root?
11:37 Beetny joined
11:37 <Cooler> ertes, well you can tell me now and i will understand later
11:37 <Cooler> usually how it works
11:38 <ertes> Cooler: trust me, it really wouldn't help you right now (there is a setup cost)
11:38 <Cooler> are you talking about cabal sandbox?
11:39 <ertes> that is also helpful, but it solves a different problem =)
11:39 <ongy> sandboxes make this worse, not better, since packages are installed into sandboxes...
11:39 <ertes> won't reduce your waiting time
11:40 balor joined
11:41 Cooler joined
11:41 ed-ilyin-lv joined
11:41 hucksy joined
11:41 Wuzzy joined
11:42 juanpaucar joined
11:42 <phadej> ongy: would look into the source; iirc it's not overly complicated script
11:43 <torstein> the functions readFile and writeFile from System.IO and ByteString.Lazy should automatically close handles, right? I'm getting "file is locked" but perhaps it's because I'm running from GHCi
11:43 cpennington joined
11:43 <ertes> torstein: windows?
11:43 <torstein> linuxæ
11:44 <ertes> hmm… locking a file on linux doesn't actually prevent you from writing to it (as far as i know)
11:45 quobo joined
11:45 Levex joined
11:45 <torstein> ByteString.Lazy.writeFile gives me: openBinaryFile: resource busy (file is locked) after creating said file with IO.writeFile
11:46 <torstein> in GHCi though, I dont know if that matters
11:46 <ertes> it shouldn't matter
11:46 xcmw joined
11:46 <cocreature> torstein: they only close the handles after they’ve read all input. that’s why they’re Lazy
11:47 <cocreature> torstein: if you can, you probably want to use the strict versions instead or if you want to stream io, use some streaming library like pipes or conduit
11:47 balor joined
11:47 <ertes> ah, lazy
11:47 michaelw joined
11:47 <torstein> cocreature, ofc, that makes sense
11:47 <ertes> but it shouldn't matter anyway
11:48 <Gurkenglas> If Data.List exported sort's merger of ascending lists, "map head $ group $ sort [x+y | x <- asc, y <- asc, x<=y]" could be constant space. (Assuming space required by free variables doesn't count)
11:48 <ertes> the error message doesn't really make sense to me
11:49 sdothum joined
11:49 Cooler joined
11:51 acarrico joined
11:52 ed-ilyin-lv joined
11:53 filterfish joined
11:55 silver joined
11:55 <Cooler> error: parse error on input `type'
11:56 <Cooler> type Table = Map.Map (Int, String) String
11:56 <Cooler> in ghci
11:57 <Cooler> why is that
11:58 <wilornel> cocreature: I'd like to install 8.0.2, so I would need to be able to specify the .tar.bz2
11:59 <cocreature> wilornel: I missed the beginning of this discussion. what problem are you having with the standard way stack downloads ghc?
12:01 <wilornel> First of all, when I do `stack build yesod-bin-1.4.11 .` , I get : "Compiler version mismatched, found ghc-8.0.1 (x86_64), but expected minor version match with ghc-8.0.2 (x86_64) (based on resolver se"
12:01 <cocreature> use stack setup
12:01 <wilornel> It says "Try running "stack setup" to install teh correct GHC"
12:01 <wilornel> so that's why I do
12:01 <wilornel> but then the download hangs
12:02 <wilornel> I was able to download the file through my browser
12:03 <cocreature> I think you can just unpack it and move it to ~/.stack/programs/x86_64-linux/ghc-8.0.2
12:03 justinfokes joined
12:03 <cocreature> and create ~/.stack/programs/x86_64-linux/ghc-8.0.2.installed with the content "installed\n"
12:04 <wilornel> hmm I see!
12:04 <wilornel> How did you figure that out? Where is the source for stack setup?
12:04 saurabhnanda joined
12:04 <cocreature> I haven’t actually verified that this works. I just looked at how stack set up the GHCs I installed :)
12:05 <cocreature> but it seems likely that this works
12:05 <wilornel> tring!
12:05 <wilornel> ah, I still need to make and/or install
12:05 <cocreature> I don’t think so
12:06 fosterite joined
12:07 Prutheus joined
12:07 <wilornel> it's weird... http://paste.ubuntu.com/24566958/
12:07 <cocreature> where have you gotten GHC from?
12:07 <wilornel> ah, I might have gotten it from the wrong location. From here: http://downloads.haskell.org/~ghc/8.0.2/ghc-8.0.2-x86_64-apple-darwin.tar.xz
12:07 <wilornel> let me check where stack gets it
12:08 dm3 joined
12:08 <cocreature> stack setup --verbose tells you that
12:08 <cocreature> stack setup --verbose tells you that
12:08 <wilornel> I followed this link from :
12:08 <cocreature> ups sry
12:08 <wilornel> yes
12:09 <wilornel> great, 2 hours left
12:09 <wilornel> these could bedistributed using torrents
12:10 <wilornel> github is not friendly sharing this file with me. I downloaded as much much quicker before
12:10 <wilornel> oh, and now it hangs. Thanks github (https://github.com/commercialhaskell/ghc/releases/download/ghc-8.0.2-release/ghc-8.0.2-x86_64-apple-darwin.tar.bz2 )
12:11 <wilornel> every time I try to start using haskell I get some issues with these cabal and stack
12:12 paolino joined
12:12 psychicist__ joined
12:13 rigel_ joined
12:17 NoCreativity joined
12:17 tromp joined
12:18 netheranthem joined
12:19 ed-ilyin-lv joined
12:20 sproingie joined
12:20 coot____ joined
12:21 bollu joined
12:21 justinfokes joined
12:21 Cooler joined
12:21 <bollu> why is the categorical limit the same as the solution to (forall a. f a)?
12:21 <bollu> jle`: I think you were the one who told me the limit f = (forall a. f a) ?
12:22 Rodya_ joined
12:23 <ertes> wilornel: you don't *have to* use stack… or yesod for that matter… in fact, if your goal is to learn haskell, yesod is probably the worst possible choice to start with
12:24 entuland joined
12:24 <ertes> wilornel: i suggest to install GHC and cabal-install through the standard mechanism of your OS, then start with a simple web framework (if you want to do web stuff) like scotty
12:26 fredmorcos joined
12:27 ed-ilyin-lv joined
12:27 <* hackage> data-dword - Stick two binary words together to get a bigger one https://hackage.haskell.org/package/data-dword- (MikhailVorozhtsov)
12:28 <Cooler> does emacs have good haskell support?
12:29 ed-ilyin-lv joined
12:29 fosterite joined
12:30 <byorgey> Cooler: yes
12:32 <byorgey> Cooler: http://haskell.github.io/haskell-mode/
12:32 NoCreativity joined
12:32 <wilornel> ertes: The reason I went with Yesod is because the haskell website listed the book "Developing Web Applications with Yesod and Haskell"
12:33 laplacian joined
12:35 Big_G joined
12:35 <Cooler> uh somethings wrong, fgl uses Data.Graph
12:35 Hunter1_ joined
12:35 ed-ilyin-lv joined
12:35 takle joined
12:36 takle joined
12:36 meba joined
12:39 lambdabot joined
12:39 lambdabot joined
12:39 justinfokes joined
12:39 mooooooooo joined
12:40 mooooooooo left
12:42 <lpaste> ongy pasted “boostrap.sh error” at http://lpaste.net/355472
12:42 int-e joined
12:42 <ongy> this is interesting, on a fresh system boostrap.sh worked, but when I try it on my normal pc, something fails to work
12:42 <ongy> phadej: ^
12:42 <phadej> ongy: do you have something in global package db
12:42 takle joined
12:42 <phadej> i.e. what ghc-pkg list says to you
12:43 akaralar joined
12:46 <lpaste> ongy pasted “ghc-pkg list” at http://lpaste.net/4474412365361709056
12:46 Reshi joined
12:46 juanpaucar joined
12:47 <ongy> that's my daily use system, so: a bunch of stuff
12:47 zariuq joined
12:47 <phadej> that's probably a problem
12:47 <phadej> and why you shouldn't cabal install stuff :)
12:48 <ongy> what else should I do? :o
12:48 pgiarrusso joined
12:49 <ongy> I have that weird usecase, where I want to install something packages on hackage
12:49 akaralar joined
12:51 <cocreature> ongy: install in sandboxes
12:52 <ongy> cocreature: and that gets into PATH how? or does the `cabal install` in a sandbox still install into ~/.cabal/bin (I hope not)
12:52 <phadej> ongy: copy it out into ~/.cabal/bin
12:53 <cocreature> I just copy binaries manually around
12:53 <phadej> ^ :+1:
12:53 <cocreature> it’s not great but it’s better than having a broken system
12:53 zariuq joined
12:54 <ongy> to be honest, when cabal is installed, it's probably better to use cabal to build instead of the bootstrap.sh either way, so this isn't that much of a problem here
12:55 theelous3 joined
12:55 <ongy> I'll do that when new-build arives. currently I don't like sandboxes, since it duplicates a bunch of stuff (and I don't want to have a windows-esque programs dir around....)
12:57 cschneid_ joined
12:57 chlong joined
12:58 <phadej> ongy: make single sandbox from where you install stuff
12:58 <phadej> yet, that's a bit what stack (kind of) automates for you
12:59 <phadej> i.e. not sandbox per program
12:59 <ongy> hm, that sounds more sane (and then I could just add the bin dir of that sandbox to $PATH)
13:00 <* hackage> websockets-snap - Snap integration for the websockets library https://hackage.haskell.org/package/websockets-snap- (JasperVanDerJeugt)
13:01 splanch joined
13:01 Levex joined
13:07 oish joined
13:08 flatmap13 joined
13:08 fizruk joined
13:10 tusj joined
13:11 insitu joined
13:12 spaceloop joined
13:12 xall_ joined
13:13 fizruk joined
13:13 darlan joined
13:14 funrep joined
13:16 justinfokes joined
13:16 bjz_ joined
13:16 ania123 joined
13:16 <Cooler> is & a operator?
13:17 <ertes> wilornel: it does?
13:17 <ania123> is here latex expert?
13:17 <cocreature> Cooler: yes
13:17 <Cooler> what is it
13:17 <cocreature> @src (&)
13:17 <lambdabot> Source not found. stty: unknown mode: doofus
13:17 <cocreature> it’s flipped function application
13:17 <cocreature> x & f = f x
13:17 truelean joined
13:18 <Cooler> cocreature, https://hastebin.com/dihupanafe.hs
13:18 <Cooler> thats in fgl
13:18 <cocreature> well that’s a different operator
13:18 <ertes> wilornel: ah, yeah, i see… i think that entry is in the wrong category, because learning haskell and learning yesod are pretty orthogonal
13:18 <torstein> How to import Merge from Map in containers? Have tried Data.Map.Strict.Merge and Data.Map.Merge.Strict but neither works (Data.Map.Strict does work)
13:19 <cocreature> I was talking about https://hackage.haskell.org/package/base-
13:19 <Cooler> so does it override?
13:19 <ertes> torstein: note that Merge is a rather new feature
13:19 <ertes> torstein: make sure your version of containers is recent enough
13:19 <phadej> Cooler: they clash if both are imported
13:19 <cocreature> in particular, the version of containers included in stackage does not support it
13:19 <ongy> hm, nuking ~/.ghc allows the bootstrap to build... But I have no idea which other things just broke :)
13:20 <Cooler> phadej, why did they do this then
13:20 <phadej> Cooler: because you seldom need both at the same time
13:20 <Cooler> i mean fgl is pretty old, the paper is from 2000
13:20 <torstein> okay that explains it
13:21 <phadej> ongy: the binaries which use data-files etc.
13:21 <Cooler> so is the application flip operator & new?
13:21 <phadej> Cooler: it's new in base, but old in lens
13:21 <phadej> yet lens is newer than fgl, but fgl is less used than lens...
13:22 <Cooler> & is a very simple symbol very likely to be used a lot
13:22 Rodya_ joined
13:23 <phadej> Cooler: it is, e.g in Clay http://hackage.haskell.org/package/clay-0.12.1/docs/Clay.html
13:24 <Cooler> phadej, what happens when Data.Graph.Inductive.Graph.& is imported
13:24 <phadej> "operator controllin entity"
13:24 <phadej> there isn't such
13:24 <Cooler> does it override the applicative flip
13:24 Elish joined
13:24 <Cooler> application*
13:24 <phadej> no; if you use (&) GHC will report ambiguity error
13:25 <phadej> so you'll need to use fully qualified name to disambiguate
13:25 <phadej> (or short name; if you import the module qualified)
13:26 <phadej> Note, that (&) from base isn't imported by default; so if you only use fgl imports; there are no problems
13:26 <phadej> (i.e. don't import Data.Function ((&)) )
13:26 <Cooler> nide
13:26 <Cooler> nice*
13:27 kirillow joined
13:27 <phadej> I encourage you to just try; if you encounter a GHC error you don't understand, you can ask here about it here
13:28 <phadej> there is no reason to be afraid of things you don't ever see
13:29 <phadej> but trying to write perfect code from scratch won't work
13:29 <phadej> (so you'll see errors, and you'll have to learn understand what they mean)
13:29 systadmin joined
13:31 <phadej> that's why I still recommend to use stack; you'll see less irrelevant (especially at the beginning) errors
13:32 Prutheus joined
13:33 xcmw joined
13:34 justinfokes joined
13:34 acarrico joined
13:35 <wilornel> ertes: Hmmm, I thought starting off with web would be nice
13:35 <wilornel> That's how I started learning other languages as well
13:35 <wilornel> Then I think I should go with the more lightweight option you suggeste
13:36 <ertes> wilornel: just learn haskell, then you can pick up any framework you like
13:36 itihas joined
13:36 <wilornel> What should I use ? cabal? stack? I'm having a lot of trouble with the package managers...
13:36 <phadej> wilornel: stack
13:36 <wilornel> ertes: And to learn I shall start working on some projects
13:36 <wilornel> phadej: It doesn't bloody work!
13:36 <ertes> wilornel: cabal
13:36 <phadej> also learning Haskell by learning Yesod, is a bit like learning Ruby by leanring Ruby-on-Rials
13:36 <wilornel> well, I need to do `stakc setup` but that doesn't finish the download
13:36 <wilornel> hahaha
13:37 <phadej> ertes: :)
13:37 <wilornel> phadej: agreed
13:37 <wilornel> so it doesn't matter what do I use?
13:37 <ertes> wilornel: (in other words cabal vs. stack is like emacs vs. vim)
13:37 <phadej> wilornel: have you reported the issue?
13:37 <wilornel> no, where do I do this?
13:37 <wilornel> it's essentially just very slow to download the file
13:37 <phadej> wilornel: https://github.com/commercialhaskell//stack
13:37 LustOmar^ joined
13:37 <wilornel> It's some cloud host that's being slow
13:38 <wilornel> Oh now it's done in 12 mins!!
13:38 <wilornel> it might work this time
13:38 yellowj joined
13:38 <phadej> cloud was too high
13:38 oish joined
13:38 <phadej> </bad joke>
13:39 levex_ joined
13:40 <wilornel> :-)
13:40 yellowj joined
13:40 eacameron joined
13:41 Mon_Ouie joined
13:41 Cooler joined
13:42 kirillow joined
13:44 LustOmar^ joined
13:44 raichoo joined
13:44 obadz joined
13:48 jsoo joined
13:48 <Cooler> does emacs have syntax highlighting?
13:48 alx741 joined
13:48 zeroed joined
13:48 obadz joined
13:49 Snircle joined
13:49 <Cooler> the syntax highlighting in sublime text 3 is lacking
13:49 <ertes> Cooler: of course
13:49 <Cooler> obviously it has it, i mean how good is it
13:50 <ertes> Cooler: haskell-mode is an extra package though… you need to install it first
13:50 zeroed joined
13:50 <ertes> Cooler: it's fairly comprehensive… i don't think i've ever seen an artifact
13:50 juanpaucar joined
13:52 yellowj joined
13:52 justinfokes joined
13:52 <Cooler> ertes, does it have repl in the editor?
13:53 <ertes> Cooler: yes, it has full GHCi integration
13:53 obadz joined
13:53 <ertes> it's optional, but i highly recommend it
13:54 <wilornel> Ah... here comes debugging `stack`: http://paste.ubuntu.com/24567535/
13:55 obadz joined
13:56 dm3 joined
13:57 pgiarrusso_ joined
13:57 dm3 joined
13:58 balor joined
14:01 <wilornel> Why does it configure and build 26 items when I try `stack setup `again?
14:01 <wilornel> Should it not cache it?
14:01 <wilornel> I feel like stack is not mature enough
14:01 <hpc> stack mature: rated R for reproducible
14:02 <ertes> hahaha
14:02 <wilornel> hahah nice
14:02 <wilornel> is it really more reproducible than cabal?
14:02 <wilornel> less state?
14:02 <hpc> stack uses cabal, but the reproducibility comes from controlling the exact build environment
14:02 obadz joined
14:02 <hpc> what versions of packages to use, what version of ghc to use, etc
14:03 <hpc> stackage even includes foreign libraries
14:03 <wilornel> why not just use `cabal sandbox`?
14:03 ogrady joined
14:03 <ertes> wilornel: that's what i've been telling you…
14:03 <hpc> a cabal sandbox gives you some of that control, but is designed for isolation going the other way
14:03 <hpc> protecting the host machine from the build environment, not the build environment from the host machine
14:04 <ezyang> wilornel: you should use new-build instead :)
14:04 <Cooler> ertes, does emacs show errors in the code?
14:04 Boomerang joined
14:04 <ertes> Cooler: yes
14:04 oish joined
14:05 <ertes> Cooler: if you choose to use haskell-interactive-mode, development goes a bit like this: edit, load, edit, load, edit, load, jump to error, fix, load, etc.
14:05 <Cooler> sublime text popsup a thing next to the line where the error is and you can navigate b/w errors with F4
14:05 <ertes> Cooler: yes, you get basically the same thing
14:05 <Cooler> nice
14:06 jdnavarro joined
14:06 ArchaicLord joined
14:08 <wilornel> darn it, I want the host and the build environment to be separate, bot hways
14:08 <wilornel> I'll have to go with cabal, because stack is too much trouble
14:08 jer1 joined
14:08 <wilornel> darn! but then that also does not work, I still need to do some setup
14:08 sproingie joined
14:08 sproingie joined
14:08 <ertes> learning haskell the yesod way, day 1: fix stack
14:09 <ertes> day 2: fix stack
14:09 <wilornel> hahaha
14:09 <wilornel> exactly, and you don't even know what you are fixing
14:10 justinfokes joined
14:11 <phadej> i'd recommened going to the local haskell meetup and grab someone to do the initial setup with someone
14:11 <phadej> it will save a lot of time for everyone
14:11 <wilornel> `rejecting: todo-, todo-, todo- (constraint from user`. Why does it do that? I tell it my current package will be todo version 0.0.1
14:12 <wilornel> phadej: Good idea, I'll try something similar to this
14:12 <wilornel> Getting started with haskell step 1. Why does it end up like this? Python has it simple with virtualenv imo
14:12 <phadej> wilornel: cabal sandbox is virtualenv
14:12 <ertes> this is ridiculous… in python it's like install and go
14:12 <geekosaur> http://hackage.haskell.org/package/todo
14:13 <Cooler> why is Graph a typeclass? https://hackage.haskell.org/package/fgl-
14:13 <ezyang> wilornel: This is from cabal?
14:13 <ertes> and it's the same fucking way with haskell, if you don't insist that stack is the way to go
14:13 <wilornel> ezyang: I'm following http://adit.io/posts/2013-04-15-making-a-website-with-haskell.html
14:13 systadmin joined
14:13 <wilornel> ertes: I see!
14:13 <wilornel> What do they to in prod? cabal or stack?
14:13 <ertes> seriously, i hate this stack fanboyism
14:14 <ezyang> yeah, that's not the relevant error here
14:14 <wilornel> It doesn't matter in prod right? Since you can do whatever
14:14 <ezyang> it's just saying, "You have a local package named todo, so I'm gonna use that"
14:14 acidjnk22 joined
14:14 <wilornel> http://paste.ubuntu.com/24567646/
14:14 <wilornel> ooh yes, it did get it right, sorry
14:15 <wilornel> so I need base
14:15 <phadej> ertes: stack is better for something than cabal; and imho is better for beginners
14:15 <ertes> wilornel: base comes with GHC
14:15 <phadej> wilornel: you need to allow base-4.9
14:15 <wilornel> no way it's better for beginners
14:15 <ezyang> Perhaps the big problem is using a tutorial from 2014
14:15 <phadej> indeed
14:15 <phadej> if tutorial used stack it would just work
14:15 <wilornel> which one
14:16 <wilornel> phadej: its in build-depends. How do I allow it?
14:16 <ertes> phadej: based on everything i have experienced, including workshops i have run myself, i have to disagree… stack is a layer of complexity that doesn't solve an actual problem, and forces everything to go the stack way
14:16 pratch joined
14:16 <phadej> wilornel: rejecting: base-
14:16 <wilornel> seems like base does not come with my ghc
14:16 <wilornel> let me check
14:16 <phadej> you have base 4.9
14:16 <wilornel> yes
14:17 <wilornel> "Resolving dependencies..."
14:17 caumeslasal joined
14:18 <phadej> it won't work.
14:18 <phadej> persistent==1.3 is ancient
14:19 <phadej> http://matrix.hackage.haskell.org/package/persistent
14:19 <wilornel> yes! it didn't work but this time because of monad-logger
14:19 <phadej> well, or monad-logger; and just bumping them will most-likely introduce compile errors (i.e. the body of the tutorial isn't updated for GHC-8)
14:20 <wilornel> arg, alright moving on
14:20 <Cooler> need some help with fgl
14:20 mganesh_ joined
14:20 <Cooler> how do you make a function that takes a Graph? Graph is declared as a typeclass
14:20 <phadej> wilornel: I must recommend http://haskellbook.com/
14:21 <ertes> wilornel: this will be my last remark: if you just go with scotty, you will have your hello-world web app up and running in 10-15 minutes =)
14:21 <Cooler> i need to make table_from_states :: StateGraph -> Table
14:21 <Cooler> where type StateGraph = Graph.Graph ItemTree ()
14:21 roconnor joined
14:21 <Cooler> but that doesn't work since Graph.Graph is a typeclass
14:21 <phadej> it makes choices for you, (e.g. stack) but at least it guides holding your hand
14:21 <ertes> haskellbook.com is a stack sales pitch
14:21 <phadej> ertes: not really, first drafts were using cabal
14:22 <phadej> ertes: but it turned out that explaining the technicalities isn't productive
14:22 <wilornel> If I need to work with stack, I think I'll have to uninstall GHC and all dependencies and then start from the ground up and then fix stack and then work on the book
14:23 <geekosaur> "but you must do that because stack is the way and the truth and the life"
14:23 revprez_atlanta joined
14:23 <ertes> yes, you do believe in cabal hell, right? because you must do so to believe in stack heaven
14:23 Rodya_ joined
14:23 <phadej> ertes: cabal without new-build is hell
14:23 <geekosaur> ...this past while is just what "cabal" hell looks like when it's stack instead of cabal
14:23 <phadej> but new-build isn't ready for be used by beginners
14:24 <ertes> phadej: i disagree
14:24 etehtsea joined
14:25 <phadej> ertes: well, just today ongy run with problems by using `cabal install`
14:25 <phadej> (or if you disagree that new-build isn't ready, it isn't there isn't new-install for example)
14:25 <ertes> phadej: you're making three mistakes here: 1. you're assuming that one must use a deployment solution immediately, 2. you're assuming complexity about cabal-install that simply isn't there, 3. you think stack would solve the problems that ongy ran into, but it doesn't
14:25 <ongy> phadej: is that a problem with cabal install, or the cabal bootstrap process when another cabal version is installed?
14:26 <ertes> it's not a cabal problem, it's a dependency probalem!
14:26 <ertes> *problem
14:26 rcschm joined
14:26 electrostat joined
14:26 tromp joined
14:28 <orion> In a monad transformer, why is IO usually the base by convention?
14:28 pranitbauva1997 joined
14:28 justinfokes joined
14:28 <phadej> ertes: it's started with a tutorial; if it was using stack; then it would work; wilornel would get and old GHC, but it would work. No "now I need newer base" problem. How cabal packages work is not trivial, and cabal-install doesn't hide the complexity; it's both pro and cons. And if ongy used stack install to install executables, the user-db won't be polluted with packages
14:29 <wilornel> what old GHC, I can't do `stack setup`
14:29 <wilornel> stack told me I needed to do `stack setup` for 8.0.2
14:30 <ertes> phadej: polluted?
14:30 <ongy> phadej: to be honest, I think this is a problem with the bootstrap process, being troubled by the user-db. I don't think that makes much sense
14:30 zeroed joined
14:30 <ertes> phadej: here is how my workshops go: install GHC (5-10 minutes for everybody to get up and running), fire up GHCi and go straight into learning haskell… if i had to explain how to set up a pseudo-project, and explain why "stack ghci" works and "ghci" doesn't, and why all that bullshit is even necessary, it would take the first evening
14:30 <Cooler> help https://hastebin.com/akuvebenex.coffeescript
14:31 obadz joined
14:31 <phadej> ertes: that works; but it breaks when you start adding dependencies
14:32 <phadej> (i.e .if you cabal install them)
14:32 <ertes> phadej: no, because i explain how to set up a cabal project and a sandbox for it
14:32 <ertes> but that's day 2
14:32 <* hackage> hpc-coveralls 1.0.10 - Coveralls.io support for Haskell. https://hackage.haskell.org/package/hpc-coveralls-1.0.10 (killy971)
14:32 filterfish joined
14:32 <wilornel> FINALLY!
14:33 <wilornel> "Hello World!" with scotty!
14:33 rockfordal joined
14:33 <ertes> wilornel: =)
14:33 <wilornel> Going to bed now, thank you all, have a good day/night/lunch/dinner/evening/breakfast/walk/shower/commute/socializing/etc
14:33 <wilornel> ertes: thanks!
14:33 <phadej> that indeed work. But e.g. if *someone* need to proceed with old tutorial (which only lously specifies dependencies), it might or might not work
14:34 <phadej> e.g. you might need old GHC to start with
14:34 <Cooler> help https://hastebin.com/akuvebenex.coffeescript
14:34 mganesh` joined
14:34 <wilornel> phadej and every time stack would be able to set me up?
14:34 <ertes> phadej: yes, in other words: there is a small percentage of people who might actually benefit from stack, and those people will know it
14:35 <wilornel> It was not able to download that file. It really should allow me to specify a file I have locally / cached, and these files should be served with torrents
14:35 <ertes> for everybody else it's just a waste of time
14:35 <phadej> thanks to hvr-ppa getting old GHC on ubuntu (actually having multiple GHC's) is easy; but on windows it's a pain
14:35 <Cooler> ertes, whats happening
14:35 <wilornel> in any case, both stack and cabal were not as easy to deal with
14:35 oisdk joined
14:35 <Cooler> why am i getting that error
14:35 rcschm joined
14:35 <ertes> Cooler: sorry, could you paste to lpaste.net? i can't see the paste there
14:35 revprez joined
14:36 <Cooler> http://lpaste.net/355474
14:36 <phadej> or macOS; a bit simpler; but still not easy
14:36 revprez joined
14:37 hybrid joined
14:39 carlomagno joined
14:39 jsoo joined
14:39 sedeki joined
14:40 jsgrant_om joined
14:40 revprez joined
14:40 <phadej> luckily you can specify compiler and index-state in cabal.project files (new-build); so you can guarantee much stronger reproducibility
14:41 zeroed joined
14:41 JoshS joined
14:42 <Cooler> someone help
14:42 <Cooler> http://lpaste.net/355474
14:43 moet joined
14:44 <lyxia> Cooler: the type checker cannot guess what type of graph you want to use
14:44 <phadej> Cooler: you should use concrete type
14:44 <phadej> > (show . read) "something"
14:44 <lambdabot> "*Exception: Prelude.read: no parse
14:44 <phadej> ah, lambdabot defaults to ()
14:45 <phadej> > (show . read) "()"
14:45 <Cooler> what?
14:45 <lambdabot> "()"
14:45 <phadej> Cooler: e.g. the above example "show . read :: String -> String"
14:45 <Cooler> lyxia, i specified the type
14:45 acarrico joined
14:45 <phadej> the compiler doesn't know what you try to read in between
14:45 <mauke> Cooler: where?
14:46 <phadej> same situation is in your code, as compiler doesn't know what concrete graph type it should use
14:46 <Cooler> is a Graph g
14:46 <mauke> that's not a type
14:46 <Cooler> and
14:46 <Cooler> g ItemTree ()
14:46 <mauke> g is a type variable
14:46 <phadej> you say "some type which is Graph"
14:46 <Cooler> yeah g has kind * -> * -> *
14:47 <Cooler> class Data.Graph.Inductive.Graph.Graph (gr :: * -> * -> *) where
14:47 max3 joined
14:47 <phadej> you should use concrete instance: like http://hackage.haskell.org/package/fgl-
14:47 zeroed joined
14:48 <phadej> Gr is Graph
14:48 SkyPatrol joined
14:48 <phadej> but compiler doesn't know that you want to use that, or some other Graph
14:48 <Cooler> what? why can't i have a function that takes something of a typeclass?
14:49 <Cooler> f :: Eq a => a -> a -> bool
14:49 <Cooler> its the same thing
14:49 <phadej> Cooler: you can; yes. it is.
14:49 <lyxia> Cooler: a is not a concrete type, you must specialize f
14:49 <lyxia> to use it
14:49 <Cooler> a doesn't have to be a concrete type
14:49 <phadej> but you have "make me some type" and "consume some type"
14:50 <Cooler> thats the point
14:50 <phadej> Cooler: and you don't specify what concrete type you want
14:50 halogenandtoast joined
14:50 <phadej> compiler refuses to guess
14:50 <Cooler> wait
14:51 <Cooler> can i do f :: Eq a => b -> a
14:51 <mauke> in principle, yes
14:51 <Cooler> or something, does final output have to be a concrete type?
14:52 <phadej> Cooler: think about (show (read input))
14:52 <phadej> > show (read "()")
14:52 <phadej> works
14:52 <lambdabot> "()"
14:52 <phadej> but why
14:52 <phadej> > show (read "1")
14:52 <lambdabot> "*Exception: Prelude.read: no parse
14:52 <phadej> doesn't? isn't obvious that I try to read Int?
14:53 <Cooler> it says here "The Patricia tree implementation does not support multiple edges between two nodes.
14:53 <Cooler> "
14:53 <Cooler> http://web.engr.oregonstate.edu/~erwig/fgl/haskell/
14:53 <Xnuk> > show (read "1" :: Int)
14:53 <Cooler> Kown bug:
14:53 <lambdabot> "1"
14:53 <Cooler> typo, they mean Known bug
14:53 pera joined
14:54 <phadej> Cooler: there's also another instance http://hackage.haskell.org/package/fgl-
14:54 safe joined
14:54 <phadej> and you have to choose which one you want to use
14:54 juanpaucar joined
14:54 <Cooler> phadej, in the code, prod_tree is a concrete type
14:55 <Cooler> only the output is polymorphic
14:55 erthalion joined
14:55 <phadej> Cooler: as Xnuk fixed show read example above
14:55 <phadej> you have to do
14:55 <Cooler> so whatever type that create_state_tree returns, is the type that table_from_states takes
14:55 <phadej> table_from_states (create_state_tree prod_tree :: Gr ItemTree ())
14:55 <mauke> Cooler: no, create_state_tree doesn't get to choose a type it returns
14:56 <mauke> Cooler: you have to tell it which type to return
14:56 <mauke> just like read
14:56 <Cooler> oh
14:56 <Cooler> why can't it choose?
14:56 <mauke> because g is universally quantified
14:57 dfordivam joined
14:57 <Cooler> ?
14:57 <mauke> that is, create_state_tree has to be able to produce a result of type 'g ItemTree ()' for all types g
14:57 <phadej> :t read
14:57 <lambdabot> Read a => String -> a
14:57 <mauke> that's what the type says
14:57 <phadej> it would be quite boring if `read` would decide which type to produce
14:58 <phadej> I "as programmer" want to say which type I want `read` to return
14:58 <Cooler> why can't read decide at runtime from the input which type to produce
14:58 <phadej> how it would pick between Int or Double?
14:58 <mauke> it could, but then you'd have to change its type completely
14:58 <Cooler> arbitrarily
14:59 <Cooler> mauke, change its type to what?
14:59 <mauke> depends on how we want to encode existential types
14:59 <Cooler> whats wrong with Read a => String -> a
15:00 <mauke> nothing
15:00 <lyxia> "arbitrarily" is not a good idea since the behavior of the function depends on that choice...
15:00 <mauke> it just lets me, the caller, choose an 'a'
15:00 <Cooler> lyxia, thats not the point, the point is if its possible
15:00 <mauke> i.e. read has to be able to produce a result no matter which 'a' I pick
15:00 moongazer joined
15:01 <mauke> I could do something like: wtfRead :: String -> (forall a. a -> b) -> b
15:01 <Cooler> well its simple, don't allow the caller to choose the type
15:01 <mauke> but then you couldn't use its result because it could return any type at all
15:01 moongazer joined
15:01 <mauke> wtfRead gets to choose, and you have to write code that has to deal with that
15:01 <mauke> good luck :-)
15:02 <Cooler> mauke, well thats only because its too general, in this case it returns a object of a typeclass
15:02 <Cooler> Graph
15:02 <Cooler> its still usable
15:02 <mauke> create_state_tree :: ProdTree -> (forall g. (Graph g) => g ItemTree () -> b) -> b
15:03 <mauke> that could work
15:03 <phadej> but then you have to code in when create_state_tree created Patricia graph, and when inductive graph
15:03 moongazer joined
15:03 <mauke> table_generator prod_tree = create_state_tree prod_tree table_from_states
15:04 <Cooler> phadej, no you don't even know what type it is, you just know its of typeclass Graph and you can use the methods of that typeclass only
15:04 oish joined
15:04 <lyxia> I think you're blaming a type system you don't understand
15:04 <phadej> at some point you still have to choose the conrete representation
15:04 <Cooler> why
15:05 <phadej> because it just doesn't make arbitrary choices
15:05 <Cooler> i don't need the concrete representation, i just need the methods on Graph
15:05 <mauke> yes, and with my code you can do that
15:05 ziocroc joined
15:06 ekasc joined
15:06 <Cooler> mauke, what is create_state_tree :: ProdTree -> (forall g. (Graph g) => g ItemTree () -> b) -> b
15:06 <Cooler> (forall g. (Graph g) => g ItemTree () -> b) is that a function?
15:06 terminalcommand joined
15:06 <Cooler> that converts from Graph to what?
15:07 darlan joined
15:07 <Cooler> and also why
15:07 <mauke> this is a trick known as CPS transform
15:07 <mauke> instead of returning a value of an unknown (to the caller) type, which haskell doesn't allow ...
15:07 <mauke> we take a function that we apply to our result
15:08 jmcarthur joined
15:08 <mauke> so instead of f x = y we have f x g = g y
15:08 <mniip> "The -pa option produces the most detailed report containing all cost centres in addition to the actual time and allocation data."
15:08 <mniip> somehow, I did not find it as detailed as I wanted it to be?
15:09 acarrico joined
15:09 <mauke> the type signature says this function has to be able to work with all types g, as long as they're an instance of Graph
15:09 osa1 joined
15:09 <mniip> how do I get a more detailed report?
15:09 <mauke> this lets us secretly pick any graph type we want, then apply the function to it
15:09 <mauke> i.e. create_state_tree gets too choose g
15:09 <mauke> s/too/to/
15:10 <phadej> mauke: it wont
15:10 <Cooler> mauke, how is forall g. (Graph g) => g ItemTree () -> b different from Graph g => g ItemTree () -> b
15:10 <mauke> Cooler: by itself, it isn't
15:10 <mauke> but it makes a difference when embedded in a larger type
15:10 <mauke> phadej: why not?
15:11 <phadej> mauke:
15:11 <phadej> http://lpaste.net/355475
15:12 <phadej> mauke: in producer you have to pick concrete representation
15:12 bennofs joined
15:12 <mauke> phadej: yes, exactly
15:12 <phadej> it can be different based on the inputs, but you have to make a choice
15:12 <mauke> yes
15:12 <mauke> that's what I'm saying
15:12 <phadej> mauke: good
15:12 <phadej> but that's not what Cooler wants
15:12 <mauke> I think it is
15:13 <phadej> I guess he want's more of show (read input :: Int) approach
15:13 Goplat joined
15:13 terminalcommand joined
15:13 <Cooler> phadej, by producer you mean the first function that produces a Graph g?
15:13 <phadej> Cooler: yes
15:13 <Cooler> yeah that function picks a concrete type at runtime
15:14 justinfokes joined
15:14 <Cooler> depending on the input
15:14 balor joined
15:14 dm3 joined
15:14 <phadej> from Inductive.Tree or PatriciaTree?
15:14 <Cooler> at compile time all you know is that its a Graph g that it produces
15:14 <mauke> > let { foo :: (forall a. (Show a) => a -> String) -> (String, String, String); foo f = (f 0, f 'x', f [1,2,3]) } in foo show
15:14 <lambdabot> ("0","'x'","[1,2,3]")
15:15 koserge joined
15:15 sighingnow joined
15:15 <mauke> here foo can apply f to an Integer, a Char, or list of Integers
15:16 <mauke> any value works as long as its type has a Show instance
15:16 dfordivam joined
15:16 <Cooler> mauke, CPS is basically callbacks
15:16 <Cooler> don't know why they gave it a fancy name
15:16 peterbecich joined
15:17 bjz joined
15:17 <phadej> Cooler: that's an intersting question which name was first :)
15:17 <nshepperd_> Uhm, have you considered outputting an Either Patricia.Gr Inductive.Gr
15:18 <nshepperd_> Also what's the actual problem with just choosing a type
15:18 <Cooler> well this was more about the principle of the thing, actually i am probly just gonna use a single concrete type
15:18 terminalcommand joined
15:19 <phadej> Cooler: you don't need to choose a concrete type for create_state_tree or table_from_states
15:19 <phadej> only in table_generator
15:19 <Cooler> yeah
15:19 Gurkenglas joined
15:19 <mniip> Cooler, it's not a callback
15:19 <mniip> it's a continuation
15:19 <phadej> except if you really want create_state_tree to choose the type; which I doubt
15:19 <Cooler> probably not patricia, because it can't handle multiple edges
15:20 <mniip> a more specific kind of pattern
15:20 <mniip> where you decide what function to call *after* this one finishes
15:20 <mniip> not just sometime during its execution
15:20 <mniip> hence, you can decide the return type
15:20 <mauke> mniip: well, I'd say a "continuation" in this sense is a type of callback
15:20 <mauke> just a specific one
15:20 <phadej> mauke: that's what mniip said
15:20 <mniip> well yes, I did specify that this is a specialization
15:21 <mauke> <mniip> Cooler, it's not a callback
15:21 <Cooler> mniip, well its a special case of a callback
15:21 <mniip> it needs a fancy name because it's a specific callback
15:21 <mniip> for the same reason we don't call everything Thing
15:21 <phadej> :P
15:21 <mauke> also because we're only modelling continuations using callbacks
15:21 <mauke> some languages support continuations directly
15:21 <Cooler> its just a JMP instruction
15:23 dm3 joined
15:23 <lyxia> that's an implementation detail
15:24 sellout- joined
15:24 <Cooler> its also a much simpler explanation
15:24 splanch joined
15:24 soniku joined
15:24 <mniip> jmp?
15:25 <mniip> I would not be so sure
15:25 wolfsif joined
15:25 <mniip> hm, alright it is
15:25 <mniip> but only because stg never bothers to use actual 'call'
15:25 <mauke> tail call == jump
15:25 raichoo joined
15:25 meandi joined
15:26 fendor joined
15:27 <mniip> Can I see the call (case-of) stack during allocation profiling?
15:27 erthalion joined
15:28 <sighingnow> Hi all, I encountered a bug when tried to instantiate Vector as Foundation's Collection, maybe be related to UndecidableInstances
15:28 <sighingnow> I have put may code here
15:28 <sighingnow> https://gist.github.com/sighingnow/7ed34d26b8c64226e8fe945022ac59ac
15:29 <sighingnow> Could anyone help with this error message ?
15:29 <mniip> you've defined an overly broad instance
15:31 nachoman joined
15:31 <sighingnow> I have put a `G.Vector v a` constraint in the instance declaration, why type `[Int]` is matched with this instance declaration ?
15:31 laplacian joined
15:31 <sighingnow> `[]` type is not satisfy the constraint `G.Vector v a`
15:31 fotonzade joined
15:31 <mauke> because constraints don't affect instance selection
15:32 AntiSpamMeta joined
15:32 zeroed joined
15:33 <mniip> sighingnow, it is not possible for the typechecker to make an instance selection based on a constraint like that
15:33 dm3 joined
15:34 <sighingnow> Is it related to the `UndecidableInstances` extension?
15:34 oish joined
15:34 <lyxia> no, you have overlapping instances
15:34 <geekosaur> it is related to the fact that you can define a class in a package and a year later define a new instance in another package using the first
15:34 ed-ilyin-lv joined
15:35 eklavya joined
15:35 <sighingnow> So, how could I put a constraint on the type variable `v` ?
15:35 <mniip> you cannot write that instance
15:36 Khisanth joined
15:36 <mniip> (you can, but this is a good time to reconsider what you're doing)
15:38 lknows joined
15:38 redfish64 joined
15:38 acertain joined
15:39 trism joined
15:40 <sighingnow> mniip, do you mean that the constrains which are not related to the pre-condition of class `Collection` will have no effect when type checking ?
15:41 <mniip> constraints *are not* checked when finding an instance
15:41 connrs joined
15:43 nachoman joined
15:43 <mniip> on an unrelated note, I got -pa to give me a call stack
15:44 <mniip> but how do I get it to produce an *evaluation* stack
15:44 <mniip> a call stack is of no use to me...
15:44 ericdwhite joined
15:45 urodna joined
15:45 zeroed joined
15:48 <ezyang> as in, who was responsible for causing the thunk to be evaluated?
15:49 <mniip> yes
15:49 <ongy> can I tell cabal where to put the package list it downloads from hackage?
15:50 <mniip> I'm producing a lazy structure, and consuming it in another function
15:50 justinfokes joined
15:50 <mniip> I suspect the consumer is insufficiently lazy
15:50 <monochrom> Yes. Look around in $HOME/.cabal/config
15:51 <sighingnow> as my understanding, the constraints are assertions of type variables when matching instance declaration, as in `(Ord k, Ord v) => Ord (Map k v)`, when the `Ord k` and `Ord v` are all satisfied, then `Ord (Map k v)` is satisfied.
15:51 wildlander joined
15:51 <mniip> sighingnow, they are assertions
15:51 <mniip> not guards
15:51 <sighingnow> mniip, why this case is different from my `Collection (v a)` instance ?
15:51 <EvanR> the direction of implication depends on class vs instance
15:52 <mniip> sighingnow, again, assertions, not guards
15:52 <mniip> this case is different because instance selection is based on the top-level type constructor
15:52 <monochrom> If you know Prolog, "instance X a => Y a" means "Y(a) :- !, X(a)". Note the cut right at the beginning.
15:52 <mniip> Map
15:53 <mniip> instance selection is based on the structural shape of the type
15:53 blbrown_win3 joined
15:53 <monochrom> Therefore it is never in your best interest to write "instance Whatever => Y a" at all.
15:53 <mniip> yeah
15:53 <mniip> everything matches the "shape" 'a'
15:54 <mniip> likewise almost everything matches "shape" 'v a'
15:54 <EvanR> i need to know prolog now
15:54 <monochrom> The "X a" does not matter until after the cut. I.e., already committed. Even if X a comes out false, there will be no backtracking.
15:56 <mniip> no one knows prolog :v
15:57 <monochrom> Anyway, the difference with Ord (Map k v) is that Map is not a type variable.
15:57 <monochrom> Map k v will not match Either Int Bool, but v a will.
15:59 juanpaucar joined
15:59 <mniip> so, any idea about the evaluation stack
16:00 ericdwhite joined
16:01 drets joined
16:01 eacameron joined
16:02 descender joined
16:03 tomphp joined
16:03 <sighingnow> mniip, thanks for your guide, I'm going to find some materials to understand instance constraints better.
16:03 cloudhead joined
16:03 oish joined
16:04 ski joined
16:04 blym joined
16:04 <monochrom> You could try Typing Haskell in Haskell.
16:04 [[ExTRa]] joined
16:05 connrs joined
16:06 <sighingnow> I think the `OVERLAPPABLE` and `OVERLAPPING` pragmas will help in my case, right?
16:07 <mniip> no
16:07 moth joined
16:07 <mniip> only if the implementations for specific and generic instances behave identically
16:08 <monochrom> They might make your program legal. Doesn't mean your program is meaningful.
16:08 <monochrom> Much less meaning what you think.
16:08 justinfokes joined
16:09 <sighingnow> After put a `OVERLAPPABLE` in my custom instance declaration, the list type can matched with the right instance implementation.
16:10 <sighingnow> I think, compared to `Collection [a]`, the `Collection (v a)` is more generic.
16:12 <iqubic> sighingnow: It is actually.
16:12 <iqubic> Collection (v a) is more generic.
16:13 <iqubic> What are you trying to do with Collections?
16:14 <sighingnow> In `Collection (v a)`, the assertions about `a` will be checked, but assertions about `v` won't, right ?
16:14 <mniip> they will be
16:15 Axman6 joined
16:15 <iqubic> What are assertions?
16:15 <sighingnow> I'm trying to do something about the repo foundation-edge, bridging the foundation package and the vector package together.
16:15 <iqubic> What is the foundation package?
16:15 <sighingnow> iqubic, here is my source code, https://gist.github.com/sighingnow/7ed34d26b8c64226e8fe945022ac59ac
16:16 <iqubic> I've looked at that. What is the issue?
16:16 <sighingnow> The foundation package is http://hackage.haskell.org/package/foundation
16:16 <monochrom> The point is not "whether". The point is "when", and "what if false".
16:16 Hellaenergy1 joined
16:17 <monochrom> The answer to "when" is "too late". The answer to "what if false" is "nothing else is tried".
16:17 moet joined
16:18 haskellandchill joined
16:18 haskellandchill left
16:18 jcjf joined
16:18 <iqubic> monochrom: Are you a philosopher? What are you talking about
16:18 <monochrom> Are you Elizer?
16:19 <monochrom> Err, I guess it's spelled Eliza.
16:19 <iqubic> No.
16:19 <iqubic> I am not Eliza
16:19 <Axman6> How does Err, I guess it's spelled Eliza. make you feel?
16:19 <Axman6> I am not Eliza?
16:20 <iqubic> No, I am not Eliza.
16:20 <iqubic> I am iqubic
16:20 <monochrom> I feel bad that I made a spelling mistake in a rhetorical question. :)
16:21 psmolen joined
16:21 robotroll joined
16:21 <jcjf> Kills the vibe
16:23 entuland joined
16:23 epsilonhalbe joined
16:24 epsilonhalbe left
16:24 fokker joined
16:25 sigmundv__ joined
16:26 sellout- joined
16:26 fosterite joined
16:26 justinfokes joined
16:28 fnurglewitz joined
16:29 wonko7 joined
16:31 <sighingnow> Now I could see that constraints in the context of instance declaration only have effect for satisfying the constraints in superclasses, or making assertions in the method implementations of this type class. And the context has no effect when for matching instance when type checking, right ?
16:31 ezksd joined
16:33 draudebal joined
16:33 draudebal left
16:34 meoblast001 joined
16:35 bennofs joined
16:36 DTZUZU joined
16:36 <EvanR> @index Fix
16:36 <lambdabot> bzzt
16:37 fosterite joined
16:37 fosterite joined
16:38 nshepperd joined
16:39 zaltekk joined
16:39 Noldorin joined
16:43 fosterite joined
16:43 moet joined
16:44 <iqubic> @index fix
16:44 <lambdabot> Data.Function, Control.Monad.Fix
16:48 nomeata joined
16:48 robertkennedy joined
16:51 aring joined
16:51 Deide joined
16:56 darlan joined
16:56 twomix joined
16:58 cschneid_ joined
16:59 <Myrl-saki> Does anyone here know how to make reflex widgets?
17:00 dm3 joined
17:00 CoolerZ joined
17:01 carlomagno1 joined
17:02 vektorweg1 joined
17:03 juanpaucar joined
17:06 CoolerZ joined
17:06 JoshS joined
17:07 Lord_of_Life joined
17:07 Lord_of_Life joined
17:08 juanpaucar joined
17:10 <robertkennedy> Is there any way to write a `reallyUnsafePtrEquality'# :: a -> b -> Int#` so that, if I wrote `data A = A Bool Int; data B = B Bool Int`, reallyUnsafePtrEquality`# A B is true?
17:11 <EvanR> how would this be true
17:12 <robertkennedy> Well their data constructors, which in an untyped setting would be memory allocators, yeah?
17:12 <robertkennedy> And like assuming the function is type correct until the last stage, a program could shrink those together
17:12 <EvanR> youre comparing types for ptr equality?
17:13 wolfsif joined
17:13 <robertkennedy> No, sorry, I shouldn't have punned the constructors
17:13 kritzcreek joined
17:14 <EvanR> youre trying to detect an optimization that makes A and B's support code the same?
17:14 <robertkennedy> So I'm imagining just `reallyUnsafeEquality# MkA MkB`
17:14 <EvanR> oh
17:14 <robertkennedy> Yeah
17:14 <robertkennedy> Maybe
17:14 <EvanR> seems impossible
17:14 dan_f joined
17:15 sellout- joined
17:15 <robertkennedy> Well if ADTs shrink to sum and product types
17:15 carlomagno joined
17:16 <EvanR> theres no guarantee the optimization would happen
17:16 <byorgey> EvanR: that's why it would be reallyUnsafe
17:16 <EvanR> so you can make the ptr equality operation but you cant necessarily have it do what youre saying
17:16 <EvanR> im ignoring the name as thinking about what its supposed to do
17:16 <byorgey> robertkennedy: it is certainly possible to imagine a compiler where reallyUnsafeEquality# MkA MkB sometimes returns True
17:17 <EvanR> s/as/and/
17:18 <orion> Is data Foo a = A | B | C a Functor? If so, is it possible to perform a natural transformation on it such as (forall x. Foo x -> IO x)?
17:18 <c_wraith> orion: that data type supports a Functor instance.
17:19 <c_wraith> orion: however, that polymorphic type is a bit difficult to write.
17:19 <byorgey> It's not too hard to write. Just return the value in the case of C a, and throw an exception otherwise.
17:20 <byorgey> oh, wait, I read that as Foo a = A | B | C a
17:20 <byorgey> but the 'a' was part of 'a Functor'
17:20 <byorgey> ?
17:20 <c_wraith> Oh, so did I
17:20 <robertkennedy> The name was to suggest functionality admittances, ie you can make such a function return different argument with `seq`
17:20 <EvanR> haha
17:20 <c_wraith> It still can be a Functor instance either way!
17:21 <byorgey> indeed
17:21 <c_wraith> But I, personally, really do have trouble writing partial functions. :)
17:21 bollu joined
17:21 <c_wraith> it burns!
17:21 <byorgey> c_wraith: I do too, but when the output type is IO x it somehow seems less partial to me to throw an exception.
17:21 <* EvanR> lights cigar, i love it when a function is total
17:21 <byorgey> Exceptions are a well-defined part of the semantics of IO.
17:22 robkennedy joined
17:22 dfeuer joined
17:22 <bollu> why is the intuition for limit of a functor "f" the same as the solution to (forall a. f a) ?
17:22 <monochrom> Totality is wrong vocabulary for IO.
17:23 <byorgey> monochrom: what is the right vocabulary?
17:23 <bollu> Like, I mean, why does the "cone" definition match up with (forall a. f a)
17:23 <monochrom> Control flow.
17:24 <bollu> monochrom: how so?
17:24 <monochrom> bollu, perhaps because forall is intersection.
17:24 eklavya joined
17:24 <bollu> monochrom: but, the cone definition doesn't ask for intersection, just "the universal cone"
17:25 <bollu> ah, are you saying that universality is like looking for the intersection of all solutinos?
17:25 <bollu> solutions*?
17:25 revprez_atlanta joined
17:25 <orion> c_wraith: I am trying to write a function to perform this natural transformation, but I am unable to figure it out: https://gist.github.com/centromere/be51d19858cb082b4c3382f02fdbc91d
17:26 <orion> '
17:26 <monochrom> Not all universality. But the cone one. It really looks like greatest lower bound or least upper bound.
17:26 <bollu> hm
17:26 <bollu> let me go back and draw diagrams
17:26 <bollu> and see what happens to cones of an endofunctor
17:26 <bollu> thanks
17:26 gienah_ joined
17:26 <monochrom> "I have a collection. What is the one thing above/below all of my collection?"
17:26 sleffy joined
17:27 <orion> The `transform` function is returning IO (), but it needs to return IO a. I am not sure how to do that.
17:27 soniku joined
17:27 <bollu> monochrom: but, like, for a functor F: J -> C, the cones of this are the "things in C that look like J"
17:27 <bollu> I don't see how above/below plays in
17:27 <cocreature> orion: without throwing exceptions or writing a partial transformation, you can’t
17:28 jbalint joined
17:28 jbalint joined
17:28 <orion> Oh man, that's terrible. :(
17:28 eacameron joined
17:28 <cocreature> orion: why do you need to write this?
17:29 rcat joined
17:29 <byorgey> orion: your 'transform' function has type Ap Foo a -> IO a, but it looks like it is pattern-matching on... something else
17:30 revprez_atlanta joined
17:30 <orion> byorgey: My mistake.
17:30 <orion> I copy/pasted code and re-worked it in the gist without validating it.
17:30 <byorgey> orion: it is definitely possible to write a function of type Ap Foo a -> IO a . It is not possible to write a function of type Foo a -> IO a.
17:30 chlong joined
17:31 dm3 joined
17:31 <orion> byorgey: I have updated the gist. Is that better?
17:31 revprez_atlanta joined
17:31 <orion> wait
17:31 <byorgey> orion: since Ap f is the free applicative functor for f, that means it is possible to write a function (forall a. Ap f a -> g a) for *any* Applicative g
17:31 <cocreature> orion: that doesn’t compile
17:31 <byorgey> in fact you can write it without even knowing what g is.
17:31 <orion> cocreature: Yes, I just realized.
17:32 np356 joined
17:32 <orion> The goal is to write the Free Applicative interpreter for Ap Foo a.
17:33 fotonzade joined
17:33 <orion> 'runAp ??? a' should print "Foo: A" and evaluate to ().
17:33 <lyxia> Don't you need (forall a. f a -> g a) first?
17:34 <byorgey> oh, right, my bad.
17:35 <orion> The interpreter (represented in my previous statement by '???') is a natural transformation from Ap Foo a -> IO a for all a. That's what I struggle with.
17:35 <byorgey> orion: ok, sorry, I was wrong before. This is impossible. I don't think the definition of Foo is what you want.
17:36 <orion> I see. Would it be correct to change it to something like, "data Foo next = A next | B next | C next" ?
17:37 <cocreature> it’s not impossible, give me a minute. lpaste is being slow
17:37 {emptyset} joined
17:37 ekasc joined
17:37 <cocreature> gnah I think it’s just broken
17:37 NeverDie joined
17:37 <cocreature> orion: https://gist.github.com/cocreature/03b6bf83dcd5d044746d67e3dde0009d
17:38 <EvanR> is there something like a read-only STM TVar
17:38 <byorgey> oh, if you return an IO (), sure
17:38 <cocreature> they said they want to evaluate to () :)
17:39 egis joined
17:39 <orion> Oh wow.
17:39 <cocreature> and it works for any IO a where a is a monoid
17:39 <iqubic> What is quasiquote?
17:39 <byorgey> orion: I don't really know what you want to do, but data Foo next = A next | ... could be reasonable too
17:39 <orion> cocreature: I never would have thought to use runAp_
17:40 <cocreature> orion: the monoid instance for IO a is relatively new but it can be quite handy :)
17:40 <iqubic> What's a quasiquote?
17:40 <byorgey> orion: with data Foo a = A | B | C, Ap Foo () is basically just a list of Foo values; the Applicative interface serves no purpose
17:41 <orion> byorgey: The purpose is to create a DSL.
17:41 fendor joined
17:41 <orion> A, B, and C are operations that take no parameters.
17:41 cyborg-one joined
17:42 <cocreature> so you’ll add other operations that have parameters?
17:43 <orion> Possibly.
17:43 Shatnerz joined
17:43 eacameron joined
17:44 <cocreature> if not, byorgey is right and Ap doesn’t buy you anything
17:44 Icewing joined
17:45 sproingie joined
17:45 psychicist__ joined
17:46 chewzerita joined
17:47 laplacian joined
17:47 theelous3 joined
17:48 sillyotter joined
17:50 <orion> I see.
17:50 <mrkgnao> iqubic: it's a way of generating an AST from Haskell code, modulo some stuff
17:50 caumeslasal joined
17:50 moongazer joined
17:51 <orion> cocreature / byorgey: I mean, I want the DSL to be extendible so that some other person could add their own operations (D Int, E String, F, ...) and use an Applicative transformer (ApT) to merge the two together.
17:53 jbalint joined
17:53 jbalint joined
17:55 fosterite joined
17:59 ezsd joined
18:00 whoisxy joined
18:00 dm3 joined
18:01 entuland_ joined
18:05 sucks joined
18:05 nshepperd joined
18:06 Wuzzy joined
18:06 krok_ joined
18:06 quchen joined
18:07 systemfault joined
18:07 smwangi joined
18:07 <quchen> Anyone else having trouble running HLint 2.x?
18:07 <quchen> It seems like it doesn’t walk through directories recursively
18:08 <quchen> »openFile: inappropriate type (is a directory)«
18:08 zariuq joined
18:12 <lknows> I made a very simple function named maxmin that takes in a list and returns a two component tuple (maximum and minimal value of the list). I tried using the following type signature but it throws a comp. error
18:12 <lknows> maxmin :: [a] -> (a, a)
18:13 <quchen> lknows: You can’t calculate the maximum of any value, just of values that support comparison.
18:13 <quchen> Your type signature claims that it works for *any* choice of »a«, e.g. »IO ()«.
18:14 <quchen> lknows: Try leaving the type signature away, and ask GHCi for the type of your definition using »:t maxmin« :-)
18:14 <Athas> That would work in OCaml!
18:14 <quchen> :t \xs -> (minimum xs, maximum xs)
18:14 <lambdabot> (Ord t, Foldable t1) => t1 t -> (t, t)
18:14 Fheigo joined
18:14 <quchen> Well, in your case t1 is [] (list), but the Ord is the key component you’re missing.
18:15 <lknows> Hmmm, I see.
18:15 <Athas> quchen: do you know if GHC will fuse those two loops?
18:16 <quchen> Fusion works only in chains of functions, not over multiple independent structures.
18:16 <ongy> join #mutt
18:16 <lknows> I've not seen this 'Ord a' before, I think this is where I'll find my answer.
18:16 <quchen> I won’t claim GHC will not fuse this, because GHC is crazy smart, but I’d be surprised.
18:17 juanpaucar joined
18:17 <quchen> lknows: It’s a constraint on »a«. The type basically says »works for any a, as long as it has the Ord instance«
18:17 jud joined
18:17 <Athas> Yeah, me too. GHC is a little limited in that regard.
18:17 <Athas> It's hard to write that fusion as a rewrite rule.
18:17 <quchen> lknows: Ord is what gives you the comparison functions like < and > and so on
18:17 <quchen> ?src ord
18:17 <lambdabot> Source not found. Whoa.
18:17 <quchen> ?src Orf
18:17 <lambdabot> Source not found. I am sorry.
18:17 <quchen> ?src Ord
18:17 <lambdabot> class (Eq a) => Ord a where
18:17 <lambdabot> compare :: a -> a -> Ordering
18:17 <lambdabot> (<), (<=), (>), (>=) :: a -> a -> Bool
18:17 <lambdabot> max, min :: a -> a -> a
18:17 <quchen> Goddammit. Finally!
18:17 <Tuplanolla> I recall seeing a rewrite rule for a pair of folds somewhere.
18:19 Itkovian joined
18:20 Flecheck joined
18:23 <Tuplanolla> Something like `(foldr f y xs, foldr g z xs) = foldr (\ x (y, z) -> (f x y, g x z)) (y, z) xs` or `(foldr f y xs, foldr g y xs) = foldr (\ x y -> (f x y, g x y)) y xs`.
18:24 ertes joined
18:24 {emptyset} joined
18:24 sheogorath joined
18:26 Rodya_ joined
18:27 plutoniix joined
18:29 robertkennedy joined
18:33 sheogorath joined
18:33 RdeH joined
18:34 RdeH left
18:36 javjarfer joined
18:37 Hunter1_ joined
18:39 juanpaucar joined
18:42 seanparsons joined
18:43 ninedotnine joined
18:44 oberstein joined
18:46 Itkovian joined
18:47 tzh joined
18:48 chaosmasttter joined
18:49 mada joined
18:52 yellowj joined
18:54 sfcg joined
18:58 dni joined
18:59 jer1 joined
18:59 fendor joined
19:08 nachoman joined
19:08 medicijnman joined
19:09 <EvanR> nice... hs-boot file worked ;)
19:09 JoshS joined
19:09 <EvanR> mutual recursion wins flawless victory
19:11 <* hackage> mustache 2.1.4 - A mustache template parser library. https://hackage.haskell.org/package/mustache-2.1.4 (justus)
19:12 Itkovian joined
19:14 sgflt joined
19:15 moongazer joined
19:15 armyriad joined
19:17 dm3 joined
19:20 xcmw joined
19:23 <Gurkenglas> Is there a full text source search across hackage, or simple way to set one up?
19:25 <lyxia> doesn't google index it
19:27 Rodya_ joined
19:28 mrkgnao joined
19:30 soniku joined
19:30 Levex joined
19:31 sedeki joined
19:31 hybrid joined
19:32 bennofs joined
19:32 markasoftware joined
19:34 Itkovian joined
19:34 takuan joined
19:35 whoisxy joined
19:37 javjarfer joined
19:38 robertkennedy joined
19:39 chaosmasttter joined
19:39 perrier-jouet joined
19:40 dm3 joined
19:43 coot____ joined
19:43 insitu joined
19:45 smwangi joined
19:46 mmn80 joined
19:48 moet joined
19:49 rntz joined
19:49 <rntz> so, ListT warns that "this does not yield a monad unless the argument monad is commutative"
19:49 <rntz> (in http://hackage.haskell.org/package/mtl-2.2.1/docs/Control-Monad-List.html)
19:50 <rntz> specifically, is (Either String) commutative?
19:50 <rntz> and, generally, when is a monad commutative?
19:50 <rntz> and if (Either String) is not commutative, is there an example of why ListT (Either String) is not a monad?
19:50 zero_byte joined
19:51 <* hackage> search-algorithms 0.2.0 - Common graph search algorithms https://hackage.haskell.org/package/search-algorithms-0.2.0 (devonhollowood)
19:53 <rightfold> Do invariant biapplicatives exist?
19:54 <lyxia> > (Left "a" >> Left "b", Left "b" >> Left "a") -- Either String is not commutative
19:54 <lambdabot> (Left "a",Left "b")
19:54 coot____ joined
19:55 <bennofs> rightfold: i'm don't quite understand what that would be. even invariant applicatives don't exist, do they? (I thought you need to be covariant for applicative?)
19:55 <rightfold> Hmm
19:55 <rntz> ah. so a monad is commutative iff (x >> y) = (y >> x)?
19:56 <lyxia> I'm not sure that's sufficient. Here x, y should be of type m ()
19:56 <rntz> aha
19:56 <rntz> yeah, that... would seem a little strong if they produced a result
19:56 ChaiTRex joined
19:56 <rntz> that is, if they were of type (m a) for some type a which has multiple values :P
19:56 Mon_Ouie joined
19:57 <lyxia> I think a more general requirement would have you flip the results on one side
19:57 <rntz> hm, so why is ListT (Either String) therefore not a monad? which law does it violate?
19:57 juanpaucar joined
19:57 <rightfold> bennofs: gooling "invariant applicative" gives 0 relevant results
19:57 <rightfold> we can conclude that you're right
19:58 revprez_atlanta joined
19:58 <rightfold> Yeah what would pure look like lol
19:58 <EvanR> only if you can derive a (f : Applicative) -> Invariant f -> Void
19:58 falafel joined
19:59 <rightfold> ipure :: forall a. (f a, a -> f a) or something
20:00 <lyxia> rntz: https://wiki.haskell.org/Monad#Commutative_monads for the actual characterization of commutative monads
20:01 Rodya_ joined
20:02 juanpaucar joined
20:03 <Gurkenglas> rntz, http://stackoverflow.com/questions/12617916/why-is-listt-monad-transformer-considered-buggy-what-monad-laws-it-breaks
20:03 mohsen_1 joined
20:05 <Gurkenglas> The definition lyxia links should be equivalent to (x >> y) = (y >> x) if we say that (>>) is "Monad m => m () -> m a -> m a" :P
20:06 dni joined
20:10 jer1 joined
20:11 justinfokes joined
20:11 doyougnu joined
20:12 <EvanR> sdl2 bindings depends on linear which uses template haskell which is problematic on raspberry pi....
20:12 <davean> EvanR: whats the problem with template haskell on a rpi?
20:13 <thang1> It doesn't really work because you can't compile TH on a rpi due to hardware limitations
20:13 <thang1> EvanR and I had a nice discussion about that a few days ago with a few other people on here
20:13 <EvanR> without alien technology you cant cross compile code with TH
20:14 javjarfer joined
20:14 <EvanR> so i forsee alien technology in my future
20:14 <davean> All you need is the TH server on the rpi
20:14 <davean> also, you can compile on an rpi, its just slow?
20:14 robertkennedy joined
20:14 <EvanR> you may not be able to compile on a rpi because you run out of memory
20:14 hiroaki joined
20:14 marr joined
20:14 <davean> You use swap
20:14 <EvanR> ...swap?
20:14 <davean> which is why its slow
20:15 <davean> but I've seen ghc compiled on an rpi
20:15 <EvanR> SD card swap?
20:15 <EvanR> i dont want to compile ghc
20:15 netheranthem joined
20:15 <EvanR> not sure why that always comes up
20:15 <davean> yes, but my point is that if GHC gets compiled on an rpi, your project surely can
20:15 <davean> and the TH server doesn't require the compilation to be done the rpi
20:15 <EvanR> what do you consider slow?
20:16 <davean> just the TH to execute that
20:16 <EvanR> yeah im not compiling on the rpi
20:16 <EvanR> also i need latest ghc features, not sure if prebuilt ghc's exist for rpi
20:16 <davean> They do
20:17 <EvanR> of the latest version
20:17 <davean> yes, I often see them for ghc-head
20:17 <davean> They're not generally released to my knowlege though
20:17 <EvanR> TH server here i come
20:17 <davean> (rpis are oddly frequently used for testing)
20:18 replay joined
20:18 <thang1> davean: they're cheap as shit and tons of people build free stuff for RPIs so of course you'd use them for testing. Plus they cost like zero electricity to leave them on forever just buildling crap
20:20 cef0l0 joined
20:20 araujo joined
20:21 <davean> EvanR: https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/ExternalInterpreter
20:21 <sternmull> could you use qemu to compile in a rpi-like environment that is powered by desktop PC? Not sure if this will be faster... but i think at least RAM should no longer be a problem.
20:22 <davean> EvanR: iserv was available as long ago as 8.0.1
20:22 <EvanR> yes i thought of that
20:23 Mutter joined
20:23 <cocreature> I don’t think you can use iserv for cross compilation in 8.0.1. this has been fixed recently but I’m not sure if all patches have made it into HEAD yet
20:26 takle_ joined
20:27 Cooler joined
20:27 <Cooler> is this a instance of graph? https://hackage.haskell.org/package/fgl-
20:27 <Cooler> https://hackage.haskell.org/package/fgl-
20:27 <Cooler> i mean it is, but its a tree
20:27 <cocreature> trees are graphs
20:28 <Cooler> i need a directed graph with cycles
20:28 <cocreature> also I don’t think it’s a tree. it’s an arbitrary graph that is internally represented as a tree
20:28 <EvanR> yes Cooler you can do it
20:28 erikd joined
20:30 <Cooler> so PatriciaTree.Gr ItemTree () would work?
20:30 justinfokes joined
20:31 <Cooler> also i don't seem to be getting auto completion in haskell-mode
20:32 <Cooler> in emacs
20:32 dmwit_ joined
20:36 <bennofs> Cooler: I think haskell-mode does not include completion. you'd need either ghc-mod or intero for that iirc
20:36 cef0l0 left
20:36 <Cooler> thats not what it says here http://haskell.github.io/haskell-mode/manual/latest/Completion-support.html#Completion-support
20:36 <monochrom> haskell-mode autocomplete uses ghci's autocomplete command. This means they are equally smart or dumb.
20:37 jason85 joined
20:37 <monochrom> For example if your last loading was a failure, you lose autocomplete of all but Prelude stuff.
20:38 <monochrom> For example if your last loading was a success, but you're now adding a brand new function called "foofoofoo", then autocomplete has not learned of it yet.
20:38 armyriad joined
20:39 <Gurkenglas> http://lpaste.net/4097793525058371584 have I used hackage-mirror wrong, or is it broken? (perhaps only on windows?)
20:39 <monochrom> But it does know about "foofoo" if it already existed at that loading.
20:39 <Cooler> haskell-interactive-mode does something weird
20:39 darlan joined
20:39 <Cooler> it gets rid of all the syntax highlighting and makes the text read only
20:40 <Cooler> it also put a line at the bottom with lambda >
20:40 fosterite joined
20:40 {emptyset} joined
20:40 <Cooler> wheres ertes
20:42 nachoman joined
20:43 Itkovian joined
20:43 <cocreature> haskell-interactive-mode is for the repl buffer not for Haskell files iirc
20:44 javjarfer joined
20:44 <monochrom> Right.
20:44 cschneid_ joined
20:45 <lknows> A question that's a bit off-topic, but I've no other place to ask. How long did it take you folks to finish "Learn you a Haskell for great good"?
20:46 <lyxia> never started it
20:46 <hpc> about a month
20:46 <cocreature> lknows: I think about a week
20:46 <Tuplanolla> I read it on coffee breaks before writing a single line, so about three months at that pace, lknows.
20:46 cschneid_ joined
20:48 cschneid_ joined
20:48 SCHAPiE joined
20:49 erikd joined
20:49 <thang1> How about Haskell From First Principles? (which is a much better book, anyway)
20:49 soniku joined
20:49 Itkovian joined
20:50 doomlord joined
20:50 tromp joined
20:51 cschneid_ joined
20:52 NeverDie joined
20:53 <EvanR> is there a standard filterMap :: (a -> Maybe b) -> [a] -> [b]
20:53 <* hackage> yesod-bin - The yesod helper executable. https://hackage.haskell.org/package/yesod-bin- (MichaelSnoyman)
20:53 <hpc> :t catMaybes .: filter
20:53 <lambdabot> error:
20:53 <lambdabot> • Variable not in scope:
20:53 <lambdabot> (.:) :: ([Maybe a1] -> [a1]) -> ((a0 -> Bool) -> [a0] -> [a0]) -> t
20:53 <hpc> :t catMaybes . filter
20:54 <lambdabot> error:
20:54 <lambdabot> • Couldn't match type ‘[a1] -> [a1]’ with ‘[Maybe a]’
20:54 <lambdabot> Expected type: (a1 -> Bool) -> [Maybe a]
20:54 <cocreature> :t mapMaybe
20:54 <hpc> pah
20:54 <lambdabot> (a -> Maybe b) -> [a] -> [b]
20:54 <hpc> ah
20:54 <EvanR> huzzah
20:54 <* hpc> lrns2hoogle
20:54 <EvanR> @hoogle mapMaybe
20:54 <lambdabot> Data.Maybe mapMaybe :: (a -> Maybe b) -> [a] -> [b]
20:54 <lambdabot> Data.IntMap.Internal mapMaybe :: (a -> Maybe b) -> IntMap a -> IntMap b
20:54 <lambdabot> Data.IntMap.Lazy mapMaybe :: (a -> Maybe b) -> IntMap a -> IntMap b
20:54 <EvanR> @hoogle (a -> Maybe b) -> [a] -> [b]
20:54 <lambdabot> Data.Maybe mapMaybe :: (a -> Maybe b) -> [a] -> [b]
20:54 <lambdabot> CorePrelude mapMaybe :: (a -> Maybe b) -> [a] -> [b]
20:54 <lambdabot> Agda.Utils.List takeWhileJust :: (a -> Maybe b) -> [a] -> [b]
20:54 <Myrl-saki> Also.
20:54 <EvanR> worked
20:54 <Myrl-saki> :t catMaybes . map
20:54 <lambdabot> error:
20:54 <lambdabot> • Couldn't match type ‘[a] -> [b]’ with ‘[Maybe a1]’
20:54 <lambdabot> Expected type: (a -> b) -> [Maybe a1]
20:54 <Myrl-saki> WAT
20:55 <EvanR> it requires .:
20:55 <Myrl-saki> :t \f -> catMaybes . map f
20:55 <lambdabot> (a1 -> Maybe a) -> [a1] -> [a]
20:55 <Myrl-saki> EvanR: What is (.:) ?
20:55 <EvanR> (.) . (.)
20:55 <EvanR> :t (catMaybes .) . map
20:55 <Myrl-saki> Oh cool. Where's it defined?
20:55 <lambdabot> (a1 -> Maybe a) -> [a1] -> [a]
20:55 <EvanR> nowhere, thats the issue
20:56 <EvanR> and (.::) = (.) . (.) . (.) to do it for two arguments
20:56 whoisxy joined
20:58 hiroaki joined
20:58 <Myrl-saki> It's in Data.Function.
20:58 <Myrl-saki> And it's used for deeper maps.
20:59 <Myrl-saki> @let import Data.Function
20:59 <lambdabot> Defined.
20:59 <Myrl-saki> :t (.:)
20:59 <lambdabot> error:
20:59 <lambdabot> • Variable not in scope: .:
20:59 <lambdabot> • Perhaps you meant one of these:
20:59 <Myrl-saki> :(
20:59 <Myrl-saki> Wait. I'm stupid. Ignore that.
21:00 juanpaucar joined
21:00 <Myrl-saki> I like the deeper maps better than the function only, tbh.
21:00 canta joined
21:01 vbCrLf joined
21:01 ziocroc joined
21:03 rsuwalski joined
21:04 sellout- joined
21:04 ertes joined
21:05 levex_ joined
21:09 JeanCarloMachado joined
21:10 biglama joined
21:11 <* hackage> monad-logger-syslog - syslog output for monad-logger https://hackage.haskell.org/package/monad-logger-syslog- (MichaelSnoyman)
21:12 erikd joined
21:12 jangsutsr joined
21:13 jaziz joined
21:16 rameerez joined
21:17 jdt joined
21:17 simendsjo joined
21:17 sedeki joined
21:18 peterhil joined
21:18 tromp joined
21:18 jimmyrcom joined
21:19 <sternmull> I wonder why the documentation does not show argument names. Often they would carry information. For instance "makeRelative :: FilePath -> FilePath -> FilePath" is not very helpful.
21:19 <EvanR> they only show argument names if they are documented
21:20 <EvanR> in chiasmic fashion
21:20 drewbert joined
21:20 <sternmull> in my opinion they should be there all the time.
21:20 <EvanR> (a cool feature of dependent function types, you get argument names for "free")
21:21 <EvanR> well in many cases the names are in the way
21:21 <EvanR> for the zillion functions like mappend :: Monoid a => a -> a -> a youd be sifting through artificial names like arg1 and arg2
21:22 <EvanR> when a name would make sense, haddock lets you document it
21:22 <EvanR> but people usuall dont
21:22 <* hackage> http-client-tls - http-client backend using the connection package and tls library https://hackage.haskell.org/package/http-client-tls- (MichaelSnoyman)
21:22 <monochrom> I agree with documentation. I disagree that they must be names.
21:23 <sternmull> yes, looks like they don't. I can't remember seeing argument names in the docs.
21:23 <EvanR> wellNamedIOActionHopefully :: IO ()
21:23 <Lokathor> can one set it up so that stack will automatically rebuild the haddock of a module every time the module changes on disk?
21:23 <Lokathor> i seem to recall stack being able to monitor stuff at least a little
21:23 sheogorath_ joined
21:23 bjz joined
21:23 <monochrom> Now add to the fact that Haskell lets you write "f (Just (x:xs)) = ..." so there is no name to begin with.
21:24 <EvanR> sternmull: see here https://hackage.haskell.org/package/mikmod-
21:24 <EvanR> arg by arg docs, names or otherwise
21:24 <monochrom> More precisely, "f Nothing = ...; f (Just []) = ...; f (Just (4:5:xs)) = ...; f (Just (x:xs)) = ..." so there is no single name.
21:25 <lyxia> Lokathor: stack build --haddock --file-watch perhaps
21:25 <* hackage> yesod-form 1.4.12, yesod-auth (MichaelSnoyman): https://qbin.io/fz2h7nzn
21:25 <sternmull> monochrom: In that case i would understand if the argument names are missing. But if there is a meaningful name it would enhance the documentation with zero overhead for the author.
21:25 <Lokathor> lyxia, neato
21:25 <EvanR> big if
21:25 <monochrom> Unless you tell me: Never use that feature. Write f meaningfulname = case meaningful name of ...
21:25 <EvanR> overhead for the reader to look at swatches of "x" and two letters names
21:26 <EvanR> swathes
21:26 <sternmull> EvanR: Ah! Yes, i recognize that... ok maybe i have seen documented arguments before.
21:26 nachoman joined
21:27 <EvanR> 2 out of the 3 args there are documented, i feel just stupid documenting the other one. in many other languages people dont
21:28 <EvanR> well or naming the other one
21:28 <athan> Hi all. I ported monad-control to expose the "monadic state" type chosen at the constraint level, instead of an assicated type family. Please let me know what you think: http://hackage.haskell.org/package/monad-control-aligned-0.0.1/docs/Control-Monad-Trans-Control-Aligned.html
21:29 <athan> coupled with this: http://hackage.haskell.org/package/extractable-singleton-0.0.1/docs/Data-Singleton-Class.html
21:29 <athan> would allow for someone to "run an action" in the monad-to-be-lifted, _and_ extract the return value
21:30 kadoban joined
21:30 erikd joined
21:30 <lyxia> why turn this into a fundep
21:30 <athan> so you can do `liftBaseWith $ \runInBase -> do x <- runSingleton <$> runInBase someMonadicAction`, where `x :: a` is the exact value that `someMonadicAction :: m a` would have returned
21:31 <monochrom> To be sure, the opposite scenerio also happens. In some cases you want to give meaningless labels to arguments. This is so that you can later describe the function holistically (as opposed to per-argument incohesion) and you can use the labels as pronouns.
21:31 <sternmull> can i tell stack to install the sources of my dependencies so i have a chance to look at the sources for more information? At the moment i use online docs and hope they are about the same version of the packages that i use.
21:31 <athan> lyxia: because then you can write `(MonadBaseControl b m stM, Extractable stM) => ...`
21:31 Zialus joined
21:31 <athan> using the `runSingleton` method I just mentioned
21:32 <* hackage> hsudoku - Sudoku game with a GTK3 interface https://hackage.haskell.org/package/hsudoku- (mmo)
21:32 <athan> which is a `forall (f :: * -> *) (a :: *). f a -> a` function
21:33 <athan> lyxia: without `Extractable`, you have no ability to witness the returned value from a run expression, when inside the monad to be lifted
21:33 tzh joined
21:34 <athan> x <- runSingleton <$> runInBase someCrazyValueFromMyMonadStack
21:35 <athan> law: forall x. liftBaseWith (\runInBase -> runSingleton <$> runInBase x) == x
21:35 <lyxia> hmmm ok
21:35 mojjo joined
21:35 <drdo> Is it possible to get the leftover string when using parsec?
21:35 <athan> I think it would be sweet to have
21:37 <EvanR> drdo: yes
21:37 <athan> Would there be a good way to state "all * -> * kinded-types which are isomorphic to Identity" in haskell?
21:38 <EvanR> getInput :: Monad m => ParsecT s u m s
21:38 <lyxia> You could also have Extractable use b and m as parameters, perhaps. That would be compatible with the current monad-control
21:39 <lyxia> athan: "isomorphic to identity" sounds wrong
21:39 <drdo> EvanR: I meant after running a parser, but that works too :)
21:39 <EvanR> right, no
21:39 types4life joined
21:39 <athan> lyxia: well, that would mean you would have to pattern-match on (StT b m) for all cases, though :\
21:40 <athan> or just make individual pointed instances for each existing instance of MonadBaseControl etc
21:40 <c_wraith> athan: I can't think of a standard term, or a non-standard term that's any better than (the truly awful) "identity-like"
21:40 <lyxia> right
21:40 <athan> lyxia: ahh yeah I think you're right
21:40 <athan> because you can't "create one" with the same chosen state, forgetfully
21:40 meba joined
21:40 <athan> c_wraith: hmm... thank you
21:41 <* athan> wants generic programming for "existing typeclass instances"
21:41 <Gurkenglas> athan, a class defining "forall a. Iso' (f a) a"?
21:41 <lyxia> that, and we don't tend to define things isomorphic to other things that exist
21:41 <athan> Gurkenglas: !! I think that's it, but I stated it wrong regardless
21:41 <Gurkenglas> (Or have the iso as your function argument if you dont want to define a class)
21:42 <athan> lyxia: ahh hm
21:42 <athan> me want excessive vocabulary
21:42 Swizec joined
21:42 <Gurkenglas> lyxia, sometimes we define things that are more general than another thing up to isomorphism, see Cofree vs Tree
21:43 <lyxia> right. I probably meant something different
21:45 jdt joined
21:45 <lyxia> One day naming things won't be a problem anymore. We'll just send each other neural patterns.
21:47 <athan> but... how do you abbreviate them? :D
21:47 <mojjo> hi.. one can say, that each element in a list has a successor, except the last one. With this in mind, one can create a type `Map a [a]` which maps from each distinct element of the input list to a list of possible successors. My problem is now:
21:47 <mojjo> How can I make sure that the Map stays circular in the way that every item in the value lists is a key hof the Map. It looks to me, taht this is only problematic for the last element, but could not find a good approach to solve this yet...
21:49 <Tuplanolla> > fmap (head &&& tail) (tails [1 .. 4]) -- You mean this problem, mojjo?
21:49 <lambdabot> [(1,[2,3,4]),(2,[3,4]),(3,[4]),(4,[]),(*Exception: Prelude.head: empty list
21:50 <Tuplanolla> > (M.fromAscList . init . fmap (head &&& tail) . tails) [1 .. 4] -- You can make use of laziness.
21:51 <mojjo> Tuplanolla: no.. this one not.. I'll provide a naive implementation in a sec...
21:51 <lambdabot> fromList [(1,[2,3,4]),(2,[3,4]),(3,[4]),(4,[])]
21:51 <drdo> EvanR: Is there an easy way to find out if a parser failed because input ended or because there were "real errors"?
21:51 <hpc> if someday variable names are neural patterns, i am definitely sabotaging all of my code by naming things variations of "i'm hungry" :D
21:51 <EvanR> your parser can require input ended or didnt end
21:51 <EvanR> eof :: Parser ()
21:52 <EvanR> if input ends at the right time, no error
21:52 <fryguybob> EvanR: I saw you asked about a read-only TVar. What do you have in mind?
21:52 <EvanR> well i gave up on that, but the idea is one part of the program is allowed to modify it and another part is not
21:52 <drdo> EvanR: What I want to do is run the same parser an arbitrary number of times
21:52 hiratara joined
21:53 heurist joined
21:53 <drdo> (independently)
21:53 simukis_ joined
21:53 {emptyset} joined
21:53 louispan joined
21:53 <fryguybob> EvanR: And you want to statically enforce that?
21:54 <EvanR> yes, rather than whoever-is-working-on-the-read-only-part's-memory-enforces-it
21:54 <EvanR> actually
21:54 <EvanR> the proper type for that would be, STM a
21:55 <fryguybob> Right
21:55 kadoban joined
21:55 <EvanR> makeReadOnly :: TVar a -> STM a; makeReadOnly = readTVar
21:55 <EvanR> haha
21:55 <fryguybob> :D
21:56 <* fryguybob> goes back to getting burned by unsafeCoerce#...
21:57 <* EvanR> shuts the 10-ft steel door to hell on fryguybob
22:00 <athan> lyxia: hmm... what do you think about an associated... lens?
22:01 <athan> into StT / StM
22:02 <* hackage> atlassian-connect-core - Atlassian Connect snaplet for the Snap Framework and helper code. https://hackage.haskell.org/package/atlassian-connect-core- (RobertMassaioli)
22:02 <athan> & associated traversals & prisms for others
22:02 <athan> hm...
22:02 Wizek_ joined
22:02 <* lyxia> shrugs.
22:03 mekeor joined
22:04 mjora7 joined
22:06 javjarfer joined
22:07 <* hackage> time - A time library https://hackage.haskell.org/package/time- (AshleyYakeley)
22:07 Swizec joined
22:07 <EvanR> dang an update to time o_O
22:07 <Gurkenglas> mojjo, do you want to also connect the last element to the first one? Do you want a subtype of Map a [a] that has as an invariant that all elements of a value are a key?
22:07 <EvanR> so new the docs dont work
22:08 <thang1> https://monad.cat/posts/2016-05-10-barbed-wire.html was there ever a part 2 to this?
22:09 <EvanR> looks like some built details and a change to the %Q format specifier
22:10 modlin joined
22:10 ADG joined
22:10 Destol joined
22:10 kneit joined
22:11 <ADG> what ide/editor do you use?
22:11 <monochrom> I use Emacs.
22:11 <ADG> I use atom now and I am thinking of something better?
22:11 jer1 joined
22:12 <kneit> ?src find
22:12 <lambdabot> find p = listToMaybe . filter p
22:12 <monochrom> I haven't tried Atom. Don't know how to compare.
22:12 <thang1> ADG: why do you need abetter editor?
22:12 <ADG> autocomplete
22:12 <thang1> atom is fine then, it uses intero
22:13 modlin joined
22:13 <thang1> https://atom.io/packages/ide-haskell you're using this package, yes?
22:13 <Gurkenglas> There's intero for atom? Why have I been using emacs for a weeks then :s
22:13 <ADG> yes
22:13 <Gurkenglas> -s
22:13 <thang1> https://atom.io/packages/autocomplete-haskell You also need to use this for autocomplete
22:13 <ADG> I use haskell-ghc-mod, ide-haskell and language-haskell
22:14 <thang1> Gurkenglas: intero /is/ the backend of IDE-haskell
22:14 <thang1> ADG: you need to have autocomplete-haskell installed as well. ide-haskell used to have it but they pulled it into its own package
22:15 <monochrom> Aw, people really like to split packages.
22:15 <thang1> at least, I think it is...
22:15 <ADG> also can anyone tell how to solve management of my project using cabal [here](https://softwareengineering.stackexchange.com/questions/348908/how-to-properly-maintain-compilation-makefile-for-haskell-project-not-using-s)
22:15 <athan> lyxia: can't make a lensy class, unfortunately. The `StT` type makes things ambiguous
22:15 <ADG> no markdown :(
22:16 <thang1> Anyway, Atom is one of the best editors for IDE like autocompletion once you get all the packages installed
22:16 <lyxia> athan: you can always make things unambiguous with a Proxy
22:16 <athan> http://lpaste.net/355488
22:17 <EvanR> yesss seems like i destablized sdl2 bindings with my use of threads
22:17 drewbert joined
22:17 <athan> for some reason, `t` is ambiguous
22:17 <lyxia> stTLens :: Proxy t -> Lens' (St t a) a
22:18 <xcmw> What does "installed package info from too old version of Cabal (key field does not match id field)" mean? I get this when running "cabal build" in a nix shell. I am trying to run the example in https://github.com/dalaing/websockets-reflex
22:18 <athan> hmm
22:18 <lyxia> The reason is that St is a type synonym family
22:18 <* hackage> pipes-lzma - LZMA compressors and decompressors for the Pipes package https://hackage.haskell.org/package/pipes-lzma- (BenGamari)
22:18 revprez_atlanta joined
22:18 <EvanR> videogame: schedule: re-entered unsafely.\n\tPerhaps a 'foreign import unsafe' should be 'safe'?
22:18 ryantrinkle joined
22:18 slack1256 joined
22:19 <athan> ooooohh wait I get it
22:19 <athan> or I could just make it an operation inside `t` or something
22:19 ryantrinkle left
22:19 <athan> but that would be restrictive
22:19 <slack1256> on -cafe, should I just reply to the list or also to CC the sender?
22:19 robotroll joined
22:20 <Gurkenglas> Does some site provide a reddit-like read/write interface to mailing lists?
22:20 <torstein> is it possible to do case pattern matching on a record field inside a Just? something like this: case mmaybe of Just( Rec { var } )
22:21 <geekosaur> did you try it?
22:21 <torstein> yeah I'm getting loads of errors
22:22 <thang1> I stand corrected, Atom doesn't seem to use Intero. However, it still has plenty of good haskell packages so it shouldn't be too bad.
22:22 <geekosaur> without an extension you need to say what to bind the field to
22:22 <ReinH> ADG: start with cabal init, the.
22:22 <geekosaur> Just (Rec {field = binding})
22:22 <ReinH> Then read the users guide https://www.haskell.org/cabal/users-guide/developing-packages.html#using-cabal-init
22:22 <ADG> Just made from it
22:22 <geekosaur> or with NamedFieldPuns you can just say the field and a binding with the same name will be generated
22:22 <slack1256> Gurkenglas: just for reading, any mailing list archive will have hierarchy and good mails should just respond to a quoting context
22:22 <hexagoxel> torstein: might need (Just Rec { var }) instead
22:22 <ADG> but how to dynamically add all files from src/
22:22 <lyxia> slack1256: reply the sender (main recipient), cc the list (people might be interested)
22:22 <slack1256> but for writing, you have to send a mail
22:23 <ReinH> ADG: just add them.
22:24 <ADG> I think adding 140 executables is not practical (ideally it would become 540 soon)
22:24 <hexagoxel> depending on the context at least. the inner parens are optional, the outer might not be.
22:24 <ReinH> 140 executables?
22:24 perrier-jouet joined
22:25 <ReinH> You might have some luck using hpack, which generates a cabal confit from yaml.
22:25 <ADG> Yes I make x.hs for each project euler problem
22:25 soniku joined
22:25 <ReinH> You could generate the yaml more easily.
22:25 <ADG> there are 500-ish peroblem
22:26 <geekosaur> > let Just (Foou {baar = bar}) = Just (Foou "z" 1) in bar
22:26 <lambdabot> "z"
22:27 <ReinH> still seems like you only need one executable. You could pass the problem number as an arg.
22:27 <hexagoxel> ^
22:27 <ReinH> Anyway, cabal doesn't have such a feature.
22:28 <monochrom> That just shovels the length elsewhere.
22:28 <ReinH> But you can use hpack and generate the yaml somehow.
22:28 jordan33 joined
22:28 <jordan33> function = [x | x <- [1,2..], x `mod` 2 == 1, x `mod` 7 == 0, x `quot` 9 == 3]
22:28 <fryguybob> EvanR: This is fine. :P
22:28 <jordan33> main = print(take 6 aufgabeA)
22:28 np356 joined
22:28 <jordan33> why doesnt my program terminate?
22:29 <monochrom> what is aufgabeA?
22:29 <jordan33> print(take 6 function)
22:29 <jordan33> sry
22:29 <geekosaur> because it still has to scan the whole list
22:29 <geekosaur> laziness is not magic
22:29 <monochrom> > take 6 [x | x <- [1,2..], x `mod` 2 == 1, x `mod` 7 == 0, x `quot` 9 == 3]
22:29 <lambdabot> mueval-core: Time limit exceeded
22:29 <monochrom> quot? mod?
22:30 <jordan33> division and modulo
22:30 <EvanR> 
22:30 <jordan33> i thought take 6 makes it possible to do what im doing
22:30 <thang1> Pretty sure monochrom knows what quot and mod are :p
22:30 <monochrom> Yes yes. I am asking you to confirm: Do you really really want x `quot` 9 as opposed to x `mod` 9?
22:31 <edwardk> call it quotRem or divMod, dont cross the streams :)
22:31 <geekosaur> eew
22:31 hiratara joined
22:31 soniku joined
22:31 AlexRussia joined
22:31 <jordan33> ohh
22:31 <jordan33> no sry
22:31 <jordan33> 1 sec
22:32 wonko7 joined
22:32 <ReinH> jordan33: how many such xs are there?
22:32 <jordan33> > take 6 [x | x <- [1,2..], x `mod` 2 == 1, x `mod` 7 == 0, x `mod` 9 == 3]
22:32 <lambdabot> [21,147,273,399,525,651]
22:32 <jordan33> it works now
22:32 <jordan33> i didnt want to use quot
22:32 <AlexRussia> Hi! I'm noobie & looking in this code https://github.com/aurapm/aura/blob/master/aura/src/Aura/Dependencies.hs#L48 I'd like to pass pkg argument down to findPkg call, as I understood, I need somehow zip (pkgDepsOf pkg) & pkg but can't figure out the syntax. Could somebody help me with it?
22:32 <jordan33> thanks a lot ^
22:33 <ReinH> jordan33: do you understand why it didn't work?
22:33 <thang1> I feel like there's a better way to do that...
22:33 drewbert joined
22:33 <edwardk> with quot you have a very narrow range of such possible xs and ran out before you got 6
22:34 <jordan33> yes because it couldnt find any x which actually have these properties
22:34 meoblast001 joined
22:34 <* hackage> atlassian-connect-core - Atlassian Connect snaplet for the Snap Framework and helper code. https://hackage.haskell.org/package/atlassian-connect-core- (RobertMassaioli)
22:35 Rodya_ joined
22:35 <EvanR> doh, not using -threaded strikes again
22:35 <EvanR> no -threaded + sdl audio does not mix
22:35 tromp joined
22:36 modlin joined
22:36 <ReinH> AlexRussia: can't you add it as an argument to addDep?
22:36 robkennedy joined
22:38 JeanCarloMachado joined
22:38 <AlexRussia> ReinH: see, as I understood, the `traverse_` is an iterator which takes a function & a list and applies function to each element of the list. If so, as I understood, I must modify list, so addDep could take 2 arguments instead of one. I'm wrong?
22:38 <jordan33> aufgabeB = take 10 [a*a + b*b + c*c | a <- [1,3,5..], b <- [2,4,6..], c <- [1,2..], c > b > a]
22:38 <jordan33> apparently haskell doesnt understand a <- [1,3,5..] ?
22:38 <monochrom> It doesn't.
22:38 <jordan33> should i just say a <- [1,2..] and then use mod?
22:38 <lyxia> > [1,3..]
22:38 <lambdabot> [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53...
22:39 <jordan33> mhm thats weird
22:39 <EvanR> > [3,1..]
22:39 <lambdabot> [3,1,-1,-3,-5,-7,-9,-11,-13,-15,-17,-19,-21,-23,-25,-27,-29,-31,-33,-35,-37,...
22:39 <athan> Can I use type quantification in... constraints?
22:39 <EvanR> > [3,1..] :: [Natural]
22:39 <lambdabot> []
22:39 <monochrom> It is not like you can say [1, 2, 4..] and the computer suddenly guesses that you want the powers of 2.
22:39 <EvanR> o_O
22:39 <athan> foo :: (Foo q, Bar p, ..., forall a. SomethingCrazy f a, ...) => ...
22:39 <Cale> @oeis 1, 2, 4
22:39 <ReinH> AlexRussia: why not traveree_ (addDep pkg) (pkgDepsOf pkg)
22:39 <edwardk> evanr it computes a delta as a natural i guess
22:40 <EvanR> > [5,4..] :: [Natural]
22:40 <ReinH> Er, traverse_
22:40 <edwardk> that should be overridden.
22:40 <lambdabot> []
22:40 <lambdabot> https://oeis.org/A000079 Powers of 2: a(n) = 2^n.
22:40 <lambdabot> [1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,2...
22:40 <AlexRussia> ReinH: wow
22:40 <* edwardk> sends up the hvr signal
22:40 <EvanR> > 4 - 5 :: Natural
22:40 <lambdabot> *Exception: Natural: (-)
22:40 <EvanR> does it mask exceptions?
22:40 <ReinH> AlexRussia: partial application is useful
22:40 <athan> doodad :: (forall a. t b a ~ m a) => m a -> t b a
22:40 <edwardk> not sure how the instance is written
22:40 <athan> doodad = id
22:41 <monochrom> OK! It is not like any Haskell compiler is going to send a web request to OEIS during compilation!
22:41 <edwardk> but it should allow negative deltas and stop at 0
22:41 <Cale> hahaha
22:41 <athan> (I should have that as `forall a. m a -> t b a`)
22:41 <geekosaur> until someone tosses TH into the mix >.>
22:41 <AlexRussia> ReinH: wow, that really works, app has successful build with my changes
22:41 <edwardk> monochrom: we just need to get oeis to add mandatory haskell snippets
22:41 <AlexRussia> ReinH: cool tip, thank you
22:41 <EvanR> > [5,(6 `div` 0)..] :: [Natural]
22:41 juanpaucar joined
22:41 <Cale> monochrom: If only we had Haskell entries on OEIS for more things...
22:41 <ReinH> np
22:41 <jordan33> ok now this is interesting:
22:41 <lambdabot> mueval-core: Time limit exceeded
22:41 <jordan33> > take 10 [a*a + b*b + c*c | a <- [1,3..], b <- [2,4..], c <- [1,2..], c > b, b > a]
22:42 <lambdabot> [14,21,30,41,54,69,86,105,126,149]
22:42 <jordan33> but this doesnt work:
22:42 <EvanR> what in the
22:42 <jordan33> take 10 [a*a + b*b + c*c | a <- [1,3,5..], b <- [2,4..], c <- [1,2..], c > b, b > a]
22:42 <AlexRussia> ReinH: also, can you explain, why some function definitions use '->' to explain arguments, and others just separate arguments by spaces?
22:42 <AlexRussia> please
22:42 <monochrom> Again, there is no [1,3,5..].
22:42 <jordan33> > take 10 [a*a + b*b + c*c | a <- [1,3..], b <- [2,4..], c <- [1,2..], c > b, b > a]
22:42 <lambdabot> [14,21,30,41,54,69,86,105,126,149]
22:42 <jordan33> yes but i dont understand why
22:42 <ReinH> AlexRussia: I'm not sure what you mean. Can you give me an example?
22:42 <geekosaur> because it's not a general syntax
22:42 <edwardk> or to use somehing like the "Extended Rate, more gfun" paper to solve recurrences
22:42 <Cale> I actually think it would be kind of cool if [a,b,c,d...] etc would do Lagrange interpolation.
22:43 <AlexRussia> ReinH: if in terms of the code, resolveDeps & addPkg functions
22:43 <edwardk> cale: i'd love to see the extended rate approach
22:43 <monochrom> I don't like Lagrange interpolation. OEIS is more sensible.
22:43 <geekosaur> [x..] is enumFrom. [x..y] is enumFromTo. [x,y..] is enumFromThen. [x,y..z] is enumFromThenTo. other things have no functions to translate to
22:43 <AlexRussia> ReinH: oh, or definition of arguments types is just optional?
22:43 <edwardk> https://arxiv.org/abs/math/0702086
22:43 <athan> does the existence of an `f a -> a` function imply that `f` is a functor, where it's instance is just like the Identity functor?
22:44 <ReinH> AlexRussia: I'm still not sure what you mean. What is an example of separating arguments by spaces?
22:44 <Boomerang> jordan33: 3 numbers in a row is overspecification, with 2 numbers you can always find the arithmetic series, with there are impossible cases. For example, what should [1,2,5..] do?
22:44 <edwardk> jacques carette made me care about that approach way back when
22:44 <jordan33> Boomerang thats a good point
22:44 <Tuplanolla> How about `1 : [2, 5 ..]`, Boomerang?
22:44 <jordan33> but i thought if the assumed pattern keeps working haskell would accept it
22:44 <Cale> athan: It doesn't imply that f is a functor, and even if f is a functor, it doesn't imply that it's Identity.
22:44 <jordan33> apparently it doesnt
22:45 <AlexRussia> ReinH: I mean, when in the code function resolveDeps is defined, first of all it describes types using tokens '::' and '->', but at the same time, function addPkg does nothing, just get arguments
22:45 <AlexRussia> ReinH: is there any specific difference between them?
22:45 <Boomerang> Tuplanolla: That should work, but you are simply prepending 1 to it
22:45 <edwardk> athan: no, f could be something like data F a = F a (a -> IO ())
22:45 <Cale> athan: Consider f = (,) e for instance
22:45 <edwardk> that is t a functor
22:45 doyougnu joined
22:45 <ReinH> :: is used to declare a type signature, it means "is of type" or "has type"
22:45 <edwardk> er isnt
22:45 <jordan33> > take 10 (1 : [2, 5 ..])
22:45 <lambdabot> [1,2,5,8,11,14,17,20,23,26]
22:45 <ReinH> Type signatures are optional when types can be inferred.
22:46 <ReinH> addPkg does not have type signature, it is inferred.
22:46 pgiarrusso joined
22:46 <AlexRussia> ReinH: oh, okay, I guess I've got it
22:46 <AlexRussia> ReinH: thanks
22:46 types4life joined
22:47 <ReinH> AlexRussia: you could add above it addPkg :: Package -> whatever the rest of type is, I am not as good at inferring types as GHC is.
22:47 types4life joined
22:48 <AlexRussia> ReinH: yeah, I understood
22:48 <ReinH> (one handy trick is to say addPkg :: () and the compiler error will tell you what type GHC has inferred)
22:48 <ReinH> AlexRussia: ok cool
22:49 <geekosaur> if you have a new enough ghc that'd be :: _
22:49 <ReinH> True.
22:49 <thang1> geekosaur: is that any GHC past version 8.0?
22:49 pgiarrusso_ joined
22:50 <geekosaur> 8.0 and on
22:50 <geekosaur> you need an extension to tell ghc to run with the result, but not to get the inferred type out
22:50 <Tuplanolla> We had `PartialTypeSignatures` in 7.10.
22:50 <geekosaur> (PartialTypeSignatures)
22:51 <AlexRussia> ReinH: I just got interesting problem now, lol. I needed pass the 'pkg' to make some debug-like info. See, aura is package manager for Arch Linux, which can install packages using binary repositories, or either take them from AUR. The function we've looking at implements resoling dependencies of packages. The joke is that if package exists and in AUR, and in binary repositories, first one is taken, ever if
22:51 <AlexRussia> its dependencies is unresolvable :D
22:51 <geekosaur> thought that was just typed holes, which isn't actually an extension
22:51 pera joined
22:51 <monochrom> @quote monochrom _
22:51 <lambdabot> monochrom says: <mreh> type T = T T <monochrom> type T = T_T
22:52 <monochrom> Aw, the saying I was looking for is something along the line of "your code writes itself starting from _ :: _"
22:52 modlin joined
22:53 <AlexRussia> ReinH: problem for me as user were that error message was...a litte _too_ simple(containing only dependency name, not of package it's needed for), so now with your help I've got it and understood the problem I've described, thanks
22:53 <Tuplanolla> @quote monochrom ::
22:53 <lambdabot> monochrom says: I use safeFromJust :: Maybe a -> Maybe a
22:53 Levex joined
22:53 moet joined
22:53 <ReinH> That's a good quote.
22:54 carlomagno1 joined
22:54 DinmarkD joined
22:54 reshi joined
22:54 <ReinH> monochrom: in Agda, code writes you!
22:55 <EvanR> right it highlights what kind of safety Maybe implies
22:55 <EvanR> or begs the question
22:55 practica joined
22:55 <monochrom> For the evil twin quote:
22:56 Rodya_ joined
22:56 <monochrom> @quote monochrom unsafeCoerce
22:56 <lambdabot> monochrom says: isTrue = (unsafeCoerce :: Either a b -> Bool) . (unsafeCoerce :: Maybe c -> Either a b) . (unsafeCoerce :: Bool -> Maybe c)
22:57 kritzcreek joined
22:57 sfcg joined
22:57 <Eduard_Munteanu> :t spoon
22:57 <lambdabot> error: Variable not in scope: spoon
22:57 <Eduard_Munteanu> @hoogle spoon
22:57 <lambdabot> package spoon
22:57 <lambdabot> Control.Spoon spoon :: NFData a => a -> Maybe a
22:57 <lambdabot> module Control.Spoon
22:58 carlomagno joined
23:00 <* Eduard_Munteanu> wonders where copumpkin is these days
23:00 <EvanR> saw him in another channel, not telling which
23:00 <EvanR> contrapumpkin
23:01 oisdk joined
23:01 cschneid_ joined
23:02 <Eduard_Munteanu> Oh, ok, so he didn't change nick into one of the ^co things in here.
23:05 louispan joined
23:09 revprez joined
23:09 [[[[[ExTRa]]]]] joined
23:15 conal joined
23:15 nachoman joined
23:19 qwertyzxcvbn joined
23:21 [[[[[ExTRa]]]]] joined
23:21 zero_byte joined
23:23 nakal joined
23:23 erikd joined
23:26 conal joined
23:26 ADG joined
23:27 <EvanR> if no one is reading from a TChan, and something gets written to it, does it pile up in memory?
23:27 jao joined
23:28 <EvanR> i guess it cant know that you yourself may never read from it
23:28 <* hackage> jenga - Generate a cabal freeze file from a stack.yaml https://hackage.haskell.org/package/jenga- (ErikDeCastroLopo)
23:28 <Eduard_Munteanu> EvanR, there's a TBChan
23:29 prophile joined
23:30 <EvanR> TBQueue ?
23:30 <Eduard_Munteanu> Oh, that. I haven't looked at this in a while.
23:31 JeanCarloMachado joined
23:32 <monochrom> Yes, TChan will pile up in memory.
23:32 orion joined
23:32 orion joined
23:34 lambda-11235 joined
23:35 <Eduard_Munteanu> I'm not exactly sure when you'd use a TChan rather than a TMVar. If readers are slow on average, you run the risk of piling up much like a memory leak.
23:36 <Eduard_Munteanu> Contention, on the other hand, seems a better outcome.
23:36 BlueRavenGT joined
23:37 <Eduard_Munteanu> And if the readers are just slow at times, then you could do better with a TBQueue.
23:39 theDon_ joined
23:40 <xcmw> What does "installed package info from too old version of Cabal (key"
23:40 <xcmw> field does not match id field)
23:40 <xcmw> mean?
23:41 sfcg joined
23:41 <glguy> Sounds like you installed a package using a version of Cabal that was too old
23:41 JeanCarloMachado joined
23:41 markus1189 joined
23:41 sfcg joined
23:41 <EvanR> Eduard_Munteanu: consider if you will the read is a dsp callback which runs maybe once per 10ms and takes as much as is in the Chan then continues generating sound
23:41 markus1199 joined
23:42 sfcg joined
23:42 <Eduard_Munteanu> You might still want some bound on that, though.
23:42 <EvanR> if it was an MVar then it would only ever be able to do one command per buffer period. meanwhile the threads generating sound are blocked and may miss conditions that would be nice to play sound because of
23:43 <EvanR> if thats the worst case scenario, just missing sound, yeah bound might be a good idea
23:44 <EvanR> but in that case theres bigger problems if the audio callback is too slow
23:44 <* EvanR> solves problems by showing the problem would involve a bigger problem
23:44 <EvanR> would imply
23:45 <ReinH> Reads and writes aren't always correlated.
23:45 <ReinH> There are applications where both vary over time.
23:46 juanpaucar joined
23:46 <* hackage> tmapchan 0.0.2 - An insert-ordered multimap (indexed FIFO) which consumes values as you lookup https://hackage.haskell.org/package/tmapchan-0.0.2 (athanclark)
23:46 <ReinH> If they are correlated, a TMVar might be nice.f
23:46 <ReinH> If not, a channel might be nice but then you also need to consider whether that channel is likely to overflow based on how frequently you read and write, etc.
23:47 <EvanR> Eduard_Munteanu: consider a loop that checks for pending events and also is rendering/waiting for vsync (which sucks, but thats SDL)... if the port to dump the events were an MVar that is blocking, then the main loop is blocked on rendering graphics
23:48 <EvanR> blocked NOt rendering graphics
23:48 <ReinH> You're only considering use cases where reads are correlated with writes. There are other use cases.
23:48 <EvanR> i dont know what you mean
23:48 <ReinH> Like EvanR's examples.
23:48 <EvanR> oh
23:49 mekeor joined
23:49 <EvanR> and if you dont render graphics, theres a side effect on OSX that the window doesnt really respond, mucking up events
23:49 <ReinH> Was talking to Eduard_Munteanu
23:49 <Eduard_Munteanu> I'm sure TMVar is pretty bad in some cases, but why would you use an unbounded channel instead of a bounded one?
23:49 <EvanR> is this kind of like why do you use a list and not a bounded list?
23:50 cschneid_ joined
23:50 <EvanR> or Integer and not 64-bit integer
23:50 <Tuplanolla> Stop inspiring me to question everything.
23:51 <ReinH> Sometimes you just care that usaeg patterns provide a practical upper bound
23:51 <ReinH> Same reason you use Int instead of integer
23:52 <ReinH> You are confident it won't overflow.
23:52 <EvanR> i use Int because its what the prelude prefers
23:52 <ertes> in this case there is also the aspect of safety
23:52 <EvanR> i never really know if it will overflow
23:52 <EvanR> which is why i made longSleep :: Integer -> IO ()
23:52 <EvanR> if Int clamped at intMax thatd be another story
23:53 <ReinH> it can be hard to know what a reasonable upper bound would be.
23:53 <EvanR> yes i was asking what a reasonable upper bound for the score would be
23:53 <ertes> in many cases it's not too important to select a good upper bound, but merely to have one
23:53 <EvanR> assuming Integer and imposing a bound
23:53 <ertes> if you think that a typical load will use 10 items, perhaps set the bound to 1000 or 10000
23:53 <EvanR> ertes: sounds kind of like CEO speak, just make a decision immediately
23:54 <EvanR> doesnt matter what it is
23:54 <EvanR> i actually dont care as long as the failure mode is understandable and acceptable
23:54 <ertes> EvanR: it depends on *why* you're using a bounded channel… for example you might use it to prevent denial of service attacks
23:55 <Eduard_Munteanu> The bound on Integer/Int is usually much more difficult to hit if you're careful. A TChan on the other hand seems to run the risk of using up all memory in a few minutes, hours or days, depending on the task.
23:55 <ertes> in which case it's not too important what the bound is, as long as there is one that can be reached
23:55 soniku joined
23:56 <EvanR> thats a good point, if you dont expect to have pretty much anything piling up in memory, a bounded channel that crashes everything would at least indicate your bugs
23:56 <EvanR> er performance bugs
23:57 <hpc> clearly this is what was meant by "640kb of ram is enough for anyone"
23:57 <* hackage> zip-stream 0.1 - ZIP archive streaming using conduits https://hackage.haskell.org/package/zip-stream-0.1 (DylanSimon)
23:57 infinity0 joined
23:58 <EvanR> on a related note. if i am waiting on a list of asyncs, and one crashes, how can i tell which one?
23:58 <EvanR> i get an Async a back... but...
23:58 <EvanR> Eq ?
23:58 <ertes> EvanR: there is waitCatch
23:58 alveric3 joined
23:58 <ertes> or rather waitCatchSTM in this cae
23:58 <ertes> case
23:58 <EvanR> talking abou waitAnyCatchCancel
23:59 <ertes> you can use waitCatchSTM with (<|>)
23:59 <EvanR> the exception probably wont indicate where its from