<     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 infinity0 joined
00:02 gmcabrita_ joined
00:02 dgpratt_ joined
00:02 whaletechno joined
00:02 systadmin joined
00:03 infinity0 joined
00:03 scav joined
00:03 Ornedan joined
00:03 ahf joined
00:03 killtheliterate joined
00:03 bengt_ joined
00:03 scopedTV joined
00:04 fotonzade joined
00:04 adelbertc joined
00:05 Twey joined
00:05 supki joined
00:05 dfordivam joined
00:05 Ford_Prefect joined
00:05 Ford_Prefect joined
00:06 infinity0 joined
00:06 Saizan joined
00:07 dan_f joined
00:07 monad_cat joined
00:07 qlkzy joined
00:08 splanch joined
00:08 henriquev joined
00:09 infinity0 joined
00:11 teto joined
00:11 infinity0 joined
00:13 DataComputist joined
00:13 plutoniix joined
00:13 ChaiTRex joined
00:13 <robertkennedy> Is there any sort of Compact or other serialization library for extremely recursive data? Ie where I might hope to send the list `lst = 3 : lst`?
00:13 Reisen joined
00:14 plutoniix joined
00:14 <robertkennedy> > let lst = 3 : lst in take 10 lst
00:14 <lambdabot> [3,3,3,3,3,3,3,3,3,3]
00:14 infinity0 joined
00:15 <Welkin> how would you serialize an infinite list?
00:15 <ertes> robertkennedy: https://hackage.haskell.org/package/data-reify
00:15 <robertkennedy> Well `lst = 3 : lst` serialized it pretty well
00:15 <robertkennedy> Ty
00:15 <ertes> robertkennedy: however: https://ro-che.info/ccc/9
00:16 ptvirgo joined
00:16 <monochrom> I like that comic too :)
00:16 <ertes> robertkennedy: what you're asking for is called observable sharing, and it's an IO effect
00:17 <monochrom> Hrm, where is the doc for DeRef?
00:17 <monochrom> Err nevermind! Associated type.
00:17 pip joined
00:18 nighty-- joined
00:18 <monochrom> But you have to write your own code for recognizing cycles in your own data structures.
00:19 <Guest14204> Just wonder is this declaration make sense? data T1 = TypeA | TypeB data T2 = TypeC data T3 = T1 | T2 It complies but I can't really use it
00:19 joelburget joined
00:20 <glguy> Guest14204: You've defined two different T1 and T2 constructors
00:20 <robertkennedy> Hmmm. Hopefully I can do that. The usecase I'm looking at is essentially foreign indexes for SQL tables, and its definitely a Graph structure, so this is promising
00:20 <glguy> The first two defined type constructors
00:20 <glguy> and the second two live at the value level
00:20 jer1 joined
00:21 <glguy> data TypeConstructorHere = ValueConstructorHere
00:21 <Guest14204> I see, so T1 and T2 in the second expression is constrctors and not the type in the first expression ....
00:21 <glguy> they're values and not types
00:21 <glguy> all the T1 and T2s are constructors
00:22 <robertkennedy> Yeah, you likely want something like `data T1 = T11 | T12; data T2 = T2; data T3 = T31 T1 | T32 T2`
00:22 <glguy> right
00:23 nighty-- joined
00:23 darlan joined
00:24 <Guest14204> My original intent is something like data T1 = apple | orange, data T2 = pear, and data T3 = apple | orange | pear - seems like I need to rethink the whole apporach
00:25 <ertes> Guest14204: one option is to use (Either T1 T2) in place of T3
00:25 <Guest14204> Either only has left and right, but I need more the two
00:25 <ertes> Left Apple :: Either T1 T2
00:25 <ertes> Left Orange :: Either T1 T2
00:26 <ertes> Right Pear :: Either T1 T2
00:26 <Guest14204> oh, like a tree ...
00:26 <ertes> more like nested choice
00:26 <monochrom> It is always a good idea to rethink the whole approach. :)
00:26 <Guest14204> thx - back to drawing board.
00:27 <monochrom> in the twilight zone of decision trees
00:27 <ertes> Guest14204: side note: T1 is basically Bool, and T2 is basically ()
00:27 <joe9> I get this error: 57,1)-(62,5): Non-exhaustive patterns in function processMessage -- I have a blank pattern that can match against any type. But, still I get that message.
00:27 Justckay joined
00:27 <ertes> Guest14204: and then T3 is basically Ordering, a 3-value type
00:28 <ertes> Guest14204: call Bool and T1 collectively "2", and call T2 and () collectively "1"
00:28 <ertes> then read "Either" as "plus" =)
00:28 northfurr joined
00:29 earthy joined
00:29 <joe9> got it. sorry for the bother.
00:29 <monochrom> data Six = Six Bool Ordering
00:29 <ertes> then you might call "Either T1 T2" or "Either Bool ()" "2 + 1"
00:30 <ertes> and that of course is Ordering, also known as "3" =)
00:30 teto joined
00:30 Justckay joined
00:30 <ertes> (i'm using slightly imprecise language)
00:30 <* monochrom> summons Russell and Whitehead to rewrite their book in Haskell
00:30 <Guest14204> humm interesting, so that is the sum type right? I was thinking about that but the syntax caught me up
00:30 <robertkennedy> Guest14204: maybe vinyl has this type? You're looking for extensible sum types, it seems. I've done a lot of research recently into extensible product types
00:31 <ertes> Guest14204: yeah, that's why it's called "sum"
00:31 daniel-s joined
00:32 <Guest14204> is vinyl a library?
00:32 <ertes> vinyl is an exercise in forcing haskell to do multiple things it sucks at
00:33 <kadoban> Hah, I like that description.
00:33 PennyNeko joined
00:33 joelburget joined
00:33 <hpc> "Extensible records for Haskell with lenses using modern GHC features" - yeah, sounds about right
00:33 <robertkennedy> The pattern your describing might be exactly right - for instance, if you want `data Fruit = Peach | Apple; data Vegetable = Lettuce; data GoodFood = Fruit Fruit | Vegi Vegetable`
00:34 <hpc> maybe someday after we have extended the type system to the point that it can make coffee just right, we'll make a good record system ;)
00:34 <ertes> the outcome is what you might expect…
00:34 <robertkennedy> If you ever use that Fruit and Vegis are different, that's probably exactly what you want. But if you are just dividing them for modularity, it will feel wrong
00:34 <ertes> "interesting"
00:34 <Guest14204> the fruit / veg example is what I am trying
00:36 asmyers joined
00:36 ph88_ joined
00:36 <Guest14204> when I try something like fun :: GoodFood -> String, then try to pattern match e.g. fun Peach = "Peach" ghc flags an error
00:37 <ertes> Guest14204: fun (Fruit Peach) = …
00:38 <Guest14204> so that's is what I am missing ... !!
00:38 <ertes> remember that you need to pattern-match on constructors with proper nesting
00:38 <ertes> if your type is (Either A B), your outermost constructors will be Left and Right
00:38 <Guest14204> going to give it a try. brb
00:38 <ertes> if your type is GoodFood, your outermost constructors will be Fruit and Vegi
00:38 jer1 joined
00:38 <robertkennedy> Yeah, you'll want to do something like `fun goodfood = case goodfood of {Vegi v -> funV v; Fruit f -> funF f}
00:39 <Guest14204> ah, vinyl is extensible record, witty ...
00:40 <ertes> beware of libraries that depend on the 'singletons' library
00:40 <ertes> they tend to be… "interesting"
00:40 splanch joined
00:40 <monochrom> I have just discovered the best slogan for that library.
00:40 <robertkennedy> Or, as ertes says, `case goodfood of {Fruit Peach -> ...}`
00:41 safe joined
00:41 <monochrom> Extensible record for an inextensible language using a lot of extensions.
00:41 gugah joined
00:41 mizu_no_oto joined
00:41 <ertes> … using dependent types in a non-dependent language
00:41 <monochrom> \∩/
00:42 <robertkennedy> http://ircbrowse.net/browse/haskellNothing that Zerg does early will kill you, and then [...] late game you're INnoVation so nothing Zerg can do late will kill you - @Artosis
00:42 <robertkennedy> Oh sorry my bad
00:42 <robertkennedy> http://ircbrowse.net/browse/haskell
00:42 <robertkennedy> Seems dead - anyone know who to contact?
00:43 <sm> still chris done AFAIK, but he hasn't been too responsive lately
00:43 <ertes> robertkennedy: the operator is aware… IIRC he's looking for a new admin
00:43 JeanCarloMachado joined
00:45 ChaiTRex joined
00:45 rkazak joined
00:47 louispan joined
00:47 splanch joined
00:47 andyhuzhill joined
00:48 joelburget joined
00:48 flatmap13 joined
00:49 flatmap13 joined
00:50 uglyfigurine joined
00:50 <athan> Are there any race conditions for using StateT vs. an STM TVar in a -threaded application?
00:52 splanch joined
00:52 <Guest14204> thx everyone, I think I got the Fruit/Vegi thing working
00:52 bigos_ joined
00:52 <lyxia> athan: How can you compare these? There is no concurrency involved in StateT.
00:52 <Guest14204> I didn't expect / know I need to use an outer constructor
00:53 <robertkennedy> athan: if your StateT is in STM it would act the same as any other STM yeah?
00:53 splanch_ joined
00:54 tom7942 joined
00:54 c4r50nz joined
00:56 splanch__ joined
00:57 <robertkennedy> What's​ the canonical motivation for `fix`?
00:58 <mniip> motivation?
00:58 <ChaiTRex> It's from functional programming.
00:58 northfurr joined
00:58 <ertes> robertkennedy: general recursion
00:58 <jchia> I think maybe robertkennedy means use case
00:58 <ChaiTRex> You can, for example, make unnamed (anonymous) recursive functions with it.
00:59 <robertkennedy> ChaiTRex: could you give an example?
01:00 robertkennedy joined
01:00 <ertes> robertkennedy: simply typed lambda calculus is not turing-complete, and as such can be used as a consistent logical calculus
01:00 jer1 joined
01:00 <ChaiTRex> Here's not a very good one:
01:00 dhil joined
01:00 <mniip> > fix ((1 :) . scanl (+) 1)
01:00 <lambdabot> [1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,17...
01:00 <ertes> robertkennedy: a fixed-point combinator makes it turing-complete
01:00 <robertkennedy> Yeah, use case is fine, but Wadler mentioned it as an impossible function in some calculuses. So I wondered what it might add
01:01 <ChaiTRex> > (fix (\f x -> if x == 1 then 1 else f (x - 1))) 2
01:01 <ertes> robertkennedy: yes, that's exactly what i'm referring to
01:01 <ChaiTRex> > (fix (\f x -> if x == 1 then 1 else f (x - 1))) 2
01:01 <lambdabot> 1
01:01 <ertes> robertkennedy: consider fix id = ⊥, an infinite loop
01:01 <mniip> fix id :: a *gasp*
01:02 systadmin joined
01:03 <ChaiTRex> > (fix (\f x -> if x == 1 then True else if even x then f (div x 2) else f (3*x + 1))) 100
01:03 <robertkennedy> mniip: that fib sequence is insanity
01:03 <lambdabot> True
01:03 <ChaiTRex> The Collatz whatsit ^
01:03 <ertes> > fix (\r x y -> x : r y (x + y)) 0 1
01:03 <lambdabot> [0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765,10946,...
01:03 <ertes> robertkennedy: ^ here is an easier one
01:04 <robertkennedy> ChaiTRex so there you're fixing the function, right? Is that the normal case you see? The fix examples all use ie `fix cos = 0.43791694940` or whatever
01:04 <robertkennedy> > fix cos
01:04 <ertes> robertkennedy: or try this: main = fix (\again -> putStrLn "Hello!" >> again)
01:04 <lambdabot> mueval-core: Time limit exceeded
01:05 <ChaiTRex> robertkennedy: fix (\f args -> you can use f here, even though it's not named externally) is the main case I see.
01:05 lambdamu joined
01:05 <ChaiTRex> robertkennedy: There are other cases, though, as you've seen with the Fibonacci one.
01:06 <ertes> robertkennedy: challenge: define 'fix' without using recursion, and without referring to any existing recursive function
01:06 <ertes> you may use lambdas freely
01:06 <mniip> can one use ADTs?
01:07 eSVG joined
01:07 erisco joined
01:07 jfokkan__ joined
01:07 sproingie joined
01:08 <robertkennedy> See, my intuition was `fix f x = let x' = f x in if x' == x then x else fix f x'`, but that's clearly not what's being fixed
01:08 <athan> aie karumba, sorry lyxia & robertkennedy
01:08 teto joined
01:08 <erisco> at some point we have to give up this class hierarchy, don't we?
01:08 <erisco> Monoid, Alternative, MonadPlus
01:08 <athan> I was imagining `StateT s m a ~ MonadBaseControl IO m => ReaderT (TVar s) m a`
01:08 <ertes> mniip: not sure, but i think ADTs can be allowed, unless i'm missing something
01:08 <mniip> without adts it's impossible
01:08 <ertes> robertkennedy: 'fix' has only one argument
01:08 <mniip> I think
01:08 <athan> but I'm off :) thank you
01:09 <ertes> mniip: it better be =)
01:09 Guest45076 joined
01:09 <robertkennedy> > :t fix
01:09 <lambdabot> <hint>:1:1: error: parse error on input ‘:’
01:09 <robertkennedy> :t fix
01:09 <lambdabot> (a -> a) -> a
01:09 <robertkennedy> Okay I'll be back
01:10 smw_ joined
01:10 <ChaiTRex> > fix (flip div 2) 1
01:10 <lambdabot> error:
01:10 <lambdabot> • Could not deduce (Integral (t0 -> t1))
01:10 <lambdabot> (maybe you haven't applied a function to enough arguments?)
01:10 <NextHendrix> :t (.) . (.) . (.) . (.)
01:10 <lambdabot> (b -> c) -> (a3 -> a2 -> a1 -> a -> b) -> a3 -> a2 -> a1 -> a -> c
01:10 <ChaiTRex> @unpl (.) . (.) . (.) . (.)
01:10 <lambdabot> (\ x g x0 x1 x2 x3 -> x (g x0 x1 x2 x3))
01:11 kay joined
01:11 raviko_ joined
01:11 <NextHendrix> lol
01:11 <lyxia> robertkennedy: fix f is f's all the way down: f (f (f ...))
01:11 <ChaiTRex> > fix (flip div 2)
01:11 <smw_> Hi all. I am trying haskell for the first time. I am trying to create an infinite fib sequence. What is wrong with the following code? fib a b = (a+b):(fib b a+b). I see the occurs check error, but I don't understand why.
01:11 <lambdabot> mueval-core: Time limit exceeded
01:11 <NextHendrix> :t fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap fmap map map map fmap
01:11 <lambdabot> error:
01:11 <lambdabot> • Couldn't match type ‘f0 a1 -> f0 b1’ with ‘[[a -> b]]’
01:11 <lambdabot> Expected type: ((((((((((a -> b) -> [a] -> [b])
01:12 <lyxia> smw_: fib b (a+b) <- you forgot parentheses
01:12 <ertes> smw_: fib b a + b = (fib b a) + b
01:12 <smw_> lyxia: ah
01:13 <smw_> lyxia: it worked :-)take 5 fib'
01:13 <smw_> [1,2,3,5,8]
01:13 hololeap joined
01:13 <mniip> :t \f -> (\y -> f (unFix y y)) (Fix (\x -> f (unFix x x)))
01:13 <lambdabot> (t -> t) -> t
01:14 MP2E joined
01:14 <smw_> ertes: interesting. I didn't know you could do that.
01:14 <hololeap> i'm looking for an abstraction that can be found in the standard libraries that works like until, but instead of (a -> a) it takes (a -> m a) where m is a monad
01:14 <EvanR> smw_: occurs check error, thats when inference sees a type that contains itself, an infinite type
01:14 <ertes> smw_: it's not really "doing" anything… i'm just telling you how the compiler interprets "fib b a + b" =)
01:15 <EvanR> its probably not what you intended, so its an error
01:15 <smw_> ertes: ah
01:15 <hololeap> and basically binds recursively until the condition holds, in which case it just runs pure
01:15 <lyxia> hololeap: take a look at monad-loops
01:15 <smw_> ertes: I am up to the recursion part of learn you a haskell. I have no idea what I am doing.
01:15 <smw_> ertes: apparently, I don't know basic order of operations yet.
01:16 <hololeap> lyxia: oh, i actually have that installed :)
01:16 <ertes> smw_: just keep in mind that function application binds more tightly than any operator
01:16 <smw_> ertes: got it. That is helpful.
01:16 raviko__ joined
01:17 <ertes> smw_: and you can always ask GHCi, for example: :i +
01:17 <ertes> tells you: infixl 6 +
01:17 <ertes> priority 6, left-associative
01:17 <ChaiTRex> :i +
01:17 <* ChaiTRex> chides lambdabot.
01:17 xinming joined
01:17 <hololeap> botsnack
01:18 <ChaiTRex> @botsnack
01:18 <lambdabot> :)
01:18 mekeor joined
01:18 <mniip> beep boop
01:19 <smw_> ertes: one more question before I go back to learn you a haskell and project euler: How can I create a runnable haskell script? It hates it when I have a naked expression at the top level.
01:20 <mniip> you'll need an IO action
01:20 jer1 joined
01:20 <mniip> main = do {- something -}
01:20 <et09> :t (Just (+)) <*> (Just 5)
01:20 <lambdabot> Num a => Maybe (a -> a)
01:21 Supersonic112 joined
01:21 <ChaiTRex> main = print $ expression to evaluate and print here
01:21 darjeeling_ joined
01:21 <smw_> mniip: action? That sounds awfully imperative :-). Anyways I am not there yet so I will wait for it to come in the book.
01:21 <et09> :t (Just (+)) <*> (Just 5) <*> (Just 3)
01:22 <lambdabot> Num b => Maybe b
01:22 <mniip> smw_, you could put 'main = print (expr)'
01:22 <et09> :t fmap (\x -> x + 5) $ (Just (+)) <*> (Just 5) <*> (Just 3)
01:22 <lambdabot> Num b => Maybe b
01:22 <mniip> would make the program output a Show-able value
01:22 <smw_> mniip: awesome, that I can do :-)
01:22 <et09> wait what
01:22 <et09> oh right. now how do i actually extract the alue
01:23 <et09> does it have to be pattern matching
01:23 <robertkennedy> smw_ what pe problems you working through?
01:24 teto joined
01:25 <smw_> robertkennedy: well, I did number 1 in a single line in the repl. Just got a working infinite fib sequence to answer problem 2
01:25 <et09> what's the non-infix name for <*>
01:26 <kadoban> ap
01:26 <smw_> Any way to make ghci run the given script then exit immediately?
01:26 <kadoban> Or (<*>) of course
01:26 <et09> it's ap ??
01:26 <et09> oh god. of course
01:26 <kadoban> :t ((<*>), ap)
01:26 <lambdabot> (Applicative f, Monad m) => (f (a1 -> b1) -> f a1 -> f b1, m (a -> b) -> m a -> m b)
01:26 <kadoban> Yep
01:26 <et09> this language, whew
01:28 <mniip> pff
01:28 <mniip> @let data Apply (f :: k -> *) (a :: k) = Apply { unApply :: f a }; data FlipT (c :: m -> l -> *) (b :: l) (f :: k -> m) (a :: k) = FlipT { flopT :: c (f a) b }
01:28 <lambdabot> Defined.
01:28 <et09> wait so ap is the monadic version, <*> is the applicative version?
01:28 joelburget joined
01:28 <pacak> :t ap
01:28 <lambdabot> Monad m => m (a -> b) -> m a -> m b
01:28 <mniip> :t FlipT $ FlipT $ FlipT $ FlipT $ FlipT $ Apply (1,2,3,4,5,6)
01:28 <lambdabot> (Num b1, Num b, Num b2, Num b3, Num b4, Num a) => FlipT (FlipT (FlipT (FlipT (FlipT Apply b1) b) b2) b3) b4 (,,,,,) a
01:29 <geekosaur> well, sort of. before there was Applicative we put them in Monad, so ap has a Monad constraint (and will keep it because the retrofit for Applicative instances is <*> = ap)
01:29 <et09> ah
01:31 <et09> what is FlipT
01:31 <mniip> I just defined it above!
01:33 <et09> ah. now what does what you wrote do, lol
01:33 teto joined
01:33 conal joined
01:34 <mniip> plumbing for indexed datatypes
01:35 <mniip> when working with type-indexed stuff you can often come across functions that derive some info from a type-index, but they don't care what type the index is provided with, so they have a type 'forall p. p Index -> Data'
01:35 <mniip> letting you substitute any 'p'
01:35 <mniip> one example is
01:35 <mniip> :t GHC.TypeLits.natVal
01:35 <lambdabot> GHC.TypeLits.KnownNat n => proxy n -> Integer
01:36 flatmap13 joined
01:36 <mniip> the problem with that is that the index has to be the last argument of your 'p' datatype
01:36 <mniip> which is not always the case
01:36 <et09> you say 'index' and i think array index and db index
01:37 <smw_> ertes: ok, so what did I fail now? https://pastebin.com/x0nP7856. It looks like it is unhappy that I didn't tell it what types to use?
01:37 <mniip> this is where FlipT, Apply, and Compose come in - the three can be used to construct an (isomorphic) wrapper where any part of the type you wish will be on the end
01:37 <EvanR> et09: this is index as in indexed family of something
01:37 <mniip> what EvanR said
01:37 <et09> https://wiki.haskell.org/GHC/Type_families this?
01:37 tom7942 joined
01:38 <EvanR> hmm. type families are more like type functions
01:39 <mniip> et09, does any of "GADT", "kind polymorphism", "higher rank type" ring a bell?
01:39 <et09> GADT. and i know what polymorphism is in OOP
01:40 <mniip> sounds like you have much to learn then
01:40 <et09> yup
01:40 mjora7 joined
01:41 cschneid_ joined
01:41 urodna joined
01:41 <mniip> (your guess at polymorphism was wrong)
01:41 <Lokathor> so are sin and cos and all that in radians?
01:41 pera joined
01:41 jer1 joined
01:41 <EvanR> yep
01:42 joelburget joined
01:43 <et09> oh. KP reminds me of TemplateHaskell
01:43 firef1y joined
01:43 <NextHendrix> atan2 is bae
01:44 <EvanR> bae?
01:45 jmct joined
01:46 Durbley joined
01:46 louispan joined
01:47 raviko_ joined
01:47 JeanCarloMachado joined
01:50 <ski> et09 : see "On Understanding Types, Data Abstraction, and Polymorphism" by Luca Cardelli,Peter Wegner in 1985-12 at <http://lucacardelli.name/Papers/OnUnderstanding.A4.pdf>
01:50 jud joined
01:51 <ski> et09 : that talks about different senses of the word "polymorphism"
01:51 <et09> this is some kind of seminal paper isn't it
01:51 patbecich joined
01:52 takle joined
01:52 <mniip> welcome to haskell
01:52 <mniip> you'll be reading papers all the time
01:53 <et09> i've been writing haskell for 10 years lol
01:53 cschneid_ joined
01:53 <ski> et09 : if you're unfamiliar with type systems, then perhaps "Polymorphic Type Inference" by Michael I. Schwartzbach in 1995-03 at <http://web.cecs.pdx.edu/~antoy/Courses/TPFLP/lectures/TYPE/typeinf.p(s|df)> might also be interesting
01:53 <ski> ok
01:54 <mniip> cool
01:54 <ski> there's also an "On Understanding Data Abstraction, Revisited" by William R. Cook in 2009-10 at <http://www.cs.utexas.edu/~wcook/Drafts/2009/essay.pdf> which talks about OO and closures
01:54 <et09> ok, i'll save these
01:55 <sm> any particular known performance regressions in emacs-25.2.1, compared to 25.1-ish ? Certain things seem to hang more (eg half a minute plus while doing something in list-packages), and cursor movement begins to pause every second or so in some buffers
01:55 <* ski> points in the direction of #emacs
01:55 Welkin joined
01:56 e14 joined
01:56 <sm> argh, apologies
01:56 <mniip> hey sm
01:56 dustmote joined
01:56 <mniip> mind a PM?
01:56 <sm> hi mniip, what's up ?
01:56 <robertkennedy> mniip: why do you want to move the target type to the end?
01:57 <mniip> robertkennedy, 1494293782 [04:36:22] <mniip> the problem with that is that the index has to be the last argument of your 'p' datatype
01:58 <ski> smw_ : .. it's meant to sound imperative
01:58 roconnor_ joined
01:58 justkkay left
01:59 takle joined
01:59 <robertkennedy> Ah, they are newtypes and not data types, gotcha
02:00 ystael joined
02:00 <smw_> ski: sorry, just a joke. Anyways, I am giving up on haskell for tonight. I have a 3 hour "haskell 101" class tomorrow to try it out :-)
02:00 hucksy_ joined
02:00 mjora7 joined
02:01 <ski> no worry. take your time
02:01 _rht joined
02:02 jer1 joined
02:03 shangxiao joined
02:03 <smw_> ski: I am finding haskell very difficult due to the material I am learning from. A lot of the concepts are not difficult for me thanks to experience with many of these things in other languages. I guess my problem is the book I am working from doesn't properly explain the code samples. That, and I am impatient :-)
02:04 FrankZappa joined
02:04 <et09> smw_: Constants are 16-bit values only and may range from 0 to 65535. They are prefixed by a mesh (#). Caution! Under no circumstances confuse the mesh with the interleave operator, except under confusing circumstances!
02:04 <smw_> et09: wrong person?
02:04 crobbins_ joined
02:05 <Welkin> lol
02:05 <et09> no, it's an old joke from the intercal manual
02:05 dcoutts_ joined
02:05 <smw_> et09: you haskell people are all weird :-P
02:06 <Cale> smw_: When I started out back in 2001 or so, it took me about 2 months to feel like I could really be productive, and about a year to be comfortable.
02:06 <Cale> So don't be too surprised if it takes a bit of getting used to.
02:06 <Welkin> smw_: it will takes a couple months at least
02:06 <smw_> better error messages would be awesome.
02:06 <Welkin> and one or two non-trivial (medium sized) projects
02:07 <Welkin> smw_: the error messages are actually very good, you just need to get used to/learn how to read them
02:07 <et09> smw_: the error messages take getting used to as well. they all deal with the same academic discipline
02:07 JeanCarloMachado joined
02:07 <Welkin> it also depends on the library
02:07 <et09> jinx
02:07 <Welkin> some have better ones than others
02:07 <smw_> et09: yeah, but I never had a formal education :-)
02:08 <et09> me neither, that's why i'm in here right now
02:08 <et09> only reason i have the first clue is cause i've been using xmonad for a decade
02:08 takle joined
02:09 <Welkin> formal education in what?
02:09 <smw_> Welkin: um... anything past community college?
02:11 <smw_> So, anyone know what I did wrong here? https://pastebin.com/Fx6c88pe
02:11 <glguy> You used pastebin.com
02:11 <Lokathor> :P
02:11 <glguy> 4e6 is a floating-point literal
02:11 <glguy> but you're wanting to work with integers
02:11 isovector joined
02:11 LHoT10820 joined
02:12 <glguy> There's an extension you can enable to allow 4e6 as an integer literal, but it's not on by default
02:12 <smw_> glguy: I see
02:12 <isovector> heya! i'm looking for a function `Prism' a b -> b -> a` which i feel like must be stupid and obvious, but i can't seem to find it
02:12 <glguy> If you added {-# Language NumDecimals #-} to the top of your file it would work
02:13 <glguy> Or change 4e6 to 4 * 10^6
02:13 <pacak> > review _Left 100500
02:13 <lambdabot> Left 100500
02:13 <smw_> glguy: well, it works. Just solved project euler #2 :-)
02:14 <isovector> pacak: thanks! knew it was dumb :)
02:14 <smw_> glguy: now, I am going to go break it again and try to understand that error message.
02:14 <glguy> smw_: In the future it'll help to include the error message in your paste when you have questions about an error
02:14 filterfish joined
02:14 <Lokathor> smw_, note that Project Euler is usually not a good way to learn a new programming language
02:14 lambda-11235 joined
02:14 <smw_> glguy: good to know
02:14 <Lokathor> most of the questions are more about knowing the right math trick than they are about knowing how to express that in a progamming language
02:15 <smw_> Lokathor: why not? I mostly do the same project euler questions for each programming language I learn.
02:15 tromp joined
02:15 <smw_> Lokathor: I know the math tricks for the ones I do :-)
02:15 <glguy> I liked the Advent of Code problems more for having some simple programming exercises to play with
02:15 <Lokathor> Advent of Code was good it seemed, I did a few this year
02:15 <Lokathor> well, "this last one"
02:16 <EvanR> :t identity
02:16 <lambdabot> error:
02:16 <lambdabot> • Variable not in scope: identity
02:16 <lambdabot> • Perhaps you meant data constructor ‘Identity’ (imported from Control.Monad.Identity)
02:17 <Lokathor> smw_, one thing to note if you're doing Euler (or other computationally intense things) is that ghci is extremely slow compared to a compiled binary in many cases
02:17 <Lokathor> because it can't do particular optimizations, so you get bad GC performance and stuff like that
02:18 <smw_> Lokathor: makes sense. I gave up on ghci because I couldn't figure out how to get it to just run what is in the file and quit.
02:18 raviko__ joined
02:18 northfurr joined
02:18 <Lokathor> ah, it's more like a python shell than like a script runner. if you want to just "run a file" try the runhaskell command
02:18 sleffy joined
02:19 <smw_> Lokathor: sweet
02:21 Wizek__ joined
02:22 splanch joined
02:22 joelburget joined
02:22 jer1 joined
02:23 filterfish joined
02:23 <smw_> Lokathor: I just found real world haskell. From a quick skim it looks more like something I would like :-)
02:23 takle joined
02:23 <Lokathor> ah
02:23 <Lokathor> well
02:23 <smw_> Lokathor: ?
02:24 <Lokathor> it's okay as far as "free" goes, but if you want to put down the 60 bucks, http://haskellbook.com/ is your best bet
02:24 mmachenry joined
02:24 <smw_> Lokathor: why this one instead?
02:24 <glguy> That's certainly one of the choices. There's also Programming in Haskell 2nd ed by Hutton
02:26 ridho joined
02:26 <Lokathor> smw_, RWH has suffered a bit from code rot in places, for one. and it also lacks "homework problems", which Haskell Book has, and those are the real edge I think
02:26 <glguy> That one's nice in that it gets you through the language in about 300 pages and it ends in a neat section on "calculating compilers" by incrementally transforming a simple program into an efficient one
02:26 splanch_ joined
02:26 <Lokathor> well, okay, it has some exercises, but often not of the tricky kind that give you good insights
02:28 path[l] joined
02:28 splanch joined
02:29 teto joined
02:30 bsima joined
02:30 beerdrop joined
02:30 <sm> HTAC (Haskell Tutorial And Cookbook) is also good for some
02:31 andreabedini joined
02:32 andrea_ joined
02:33 exferenceBot joined
02:34 robkennedy joined
02:34 andreabedini joined
02:34 raviko_ joined
02:35 andrew__n__ joined
02:36 Xalph0r joined
02:36 raviko_ joined
02:37 JeanCarloMachado joined
02:37 hexagoxel joined
02:38 connrs joined
02:39 mmachenry1 joined
02:39 marc_ joined
02:39 brynedwards joined
02:39 <dmj`> smw_: Brent Yorgey’s resources are great as well
02:39 <dmj`> @typeclassopedia
02:39 <lambdabot> Unknown command, try @list
02:40 <dmj`> @google typeclassopedia
02:40 <lambdabot> https://wiki.haskell.org/Typeclassopedia
02:40 <smw_> dmj`: will look
02:41 sproingie joined
02:41 takle joined
02:41 ocharles joined
02:43 jer1 joined
02:44 cstrahan joined
02:46 roconnor_ joined
02:48 justkkay_ joined
02:48 andreabedini joined
02:48 splanch joined
02:49 dsh joined
02:51 justkka__ joined
02:53 sleffy joined
02:54 pavonia joined
02:58 ericbmerritt_ joined
02:58 ^bschafer1 joined
02:59 <Lokathor> https://hackage.haskell.org/package/haskeline-
02:59 hololeap joined
03:00 <Lokathor> I'm not clear how I send this off to an async (possibly a lifted async), since i can only obtain it after I enter the InputT
03:00 <geekosaur> you don't want to do that
03:00 <geekosaur> you *really* don;t want to do that
03:00 <geekosaur> terminals have ONE cursor position. you expect it to sanely share between threads?
03:01 <geekosaur> also one source of input and one output stream. not one per thread
03:01 takle joined
03:01 <Lokathor> but it says right there "and may be run concurrently with user input without affecting the prompt."
03:01 otto_s_ joined
03:02 <geekosaur> oh, it's some kind ogf wrapper that you payfor on every I/O operation. ok, carry on...
03:03 <EvanR> ogf?
03:03 <geekosaur> "of"
03:03 joelburget joined
03:03 <geekosaur> point being that now every operation whether through that wrapper or not has to check a terminal mutex
03:03 <Lokathor> i think haskeline is checking the terminal mutex even if you don't call that
03:03 jer1 joined
03:04 <geekosaur> probably
03:04 <geekosaur> not great in any case
03:04 cpennington joined
03:04 doomlord joined
03:04 <geekosaur> but then I don't think they had any interest in performance since --- with the possible exception of cases where you'd want to use getExternalPrint, naturally --- the usual limiting case is the user on the other side of the terminal >.>
03:05 <Lokathor> okay, so... how do i pass the externalPrint to an async?
03:06 <geekosaur> I also don't know how tightly wedded it is to the InputT context... you may not be *able* to hand it off
03:07 <Lokathor> damn
03:07 <geekosaur> although the type suggests it "should" be okay, I guess? since if you needed that context it ought to be in the type instead of it being IO ()
03:08 <Lokathor> i think, if i had to guess, once the mutex check has been injected into the action it's fine
03:08 <geekosaur> which still leaves your question, but ... I suspect your use case is not the intended one. or, if you can't delay the thread start until after you call this, you must initialize the terminal earlier
03:08 <Lokathor> i made a similar thing to what they have without knowing it once, but it wasn't cross platform
03:09 <Lokathor> windows only i'm afraid
03:09 <geekosaur> that is likely a good idea anyway as you will get unfortunate results if you try to use it before you have the terminal in the mode it expects
03:09 <geekosaur> which is to say, just to model the terminal properly it *ought* to have made the type InputT m IO () instead of IO ()
03:09 mjora7 joined
03:10 perrier-jouet joined
03:10 <geekosaur> character at a time mode may change both input and output termios settings, which will affect how the output function works
03:11 <Lokathor> well you can do something like this https://github.com/Lokathor/galaxy-break/blob/master/src/ConcurrentConsole.hs
03:11 <Lokathor> but that version basically only works on windows right now
03:12 takle joined
03:12 <geekosaur> yeh, on Windows it's different
03:12 <EvanR> a haskell-like terminal lib for stuff like nethack would be cool
03:12 <geekosaur> unix terminal handling is a generally messy and frustrating thing
03:12 <Lokathor> you mean HScurses, vty, etc?
03:13 <geekosaur> partly for historical reasons
03:13 <geekosaur> the interface those have to talk to
03:13 <geekosaur> which is why they end up sucking a bit
03:13 <EvanR> i havent heard good things about HScurses
03:13 jmcarthur joined
03:13 <geekosaur> also the interface haskeline talks to, so...
03:13 <geekosaur> well, curses is a mess, and only some of that is because of termios. but some of it is because of termios
03:14 jsgrant_om joined
03:14 <Lokathor> EvanR, I made a curses wrapper using inline-c, and it worked 99% like a dream
03:14 <Lokathor> but if you resized your terminal the program would instantly crash :/
03:14 <EvanR> nice
03:15 <Lokathor> couldn't get the system signal stuff to interface right
03:15 <EvanR> maybe a thing that looks like a terminal lib for stuff like nethack
03:15 smw_ joined
03:15 <Lokathor> what i wanted was
03:15 <EvanR> which doesnt really do any real terminal anything because its so insane
03:15 <Lokathor> haskeline reading in 1 character at a time
03:16 <Lokathor> https://hackage.haskell.org/package/haskeline-
03:16 <Lokathor> says that you can do that
03:16 flatmap13 joined
03:16 <* geekosaur> occasionally wants to write a terminal interface in haskell just so he can have a type Terminal t r a i n w r e c k
03:16 <Lokathor> and then ansi-terminal doing output
03:16 systemfault joined
03:16 <Lokathor> cause guys, check this: https://gist.github.com/Lokathor/b9275c459ad4707025587a96ecee86aa
03:16 justkkay joined
03:16 sellout- joined
03:17 <Lokathor> that ansi-term snippit gives you output like this: https://www.dropbox.com/s/j7l511x2rf8xi1i/Screenshot%202017-05-08%2000.01.39.png?dl=0
03:17 systemfault joined
03:17 <Lokathor> if you just shove enough output at once (all ~24 lines), you can "emulate" curses in a cross platform way via ansi-terminal and haskeline
03:18 <Lokathor> ansi-terminal also allows clearing of the screen, setting cursor location, etc
03:18 CARAM__ joined
03:18 tommd joined
03:19 _sg joined
03:19 takle joined
03:19 <geekosaur> anyway, my advice is initialize the terminal and get your InputT early, before spawning threads. because if you were to use that callback before the terminal is initialized, you will probably be unhappy
03:20 <Lokathor> well of course
03:20 <Lokathor> you can't get handed that callback before the InputT starts anyway :P
03:20 <geekosaur> exactly. I think that's the point
03:21 <Lokathor> so once you're inside InputT, how does one call async?
03:21 kamyar joined
03:21 <Lokathor> can you just liftIO on it?
03:21 <kamyar> Hello guys
03:22 <Lokathor> last time i tried to lift async, it lead to an entirely other package i didn't know exited that did strange things
03:22 <EvanR> hi
03:22 <Lokathor> kamyar, hey
03:22 <kamyar> Please take a peek on my code
03:22 <kamyar> http://lpaste.net/355336
03:22 <kamyar> I just wanna use Reader MOnad to read redis and postgresql config and pass pool to repository module
03:23 <kamyar> as you can see there are 2 functions using redis
03:23 <Lokathor> kamyar, do the version that doesn't user Reader at all
03:23 <kamyar> and there is a module 'Repository' which uses postgresql pool
03:23 <Lokathor> just pass around your handle to the connection pool all the time, that should be simple enough in this case I think
03:23 <kamyar> Lokathor: Why?
03:24 <Lokathor> because MonadReader isn't getting you much value added if your call stack isn't too deep, and i don't think it's too deep here
03:24 jer1 joined
03:25 <kamyar> Lokathor: So I have to change redis functions to get redis config, and Repository module funcitons to get postgresql pool
03:25 <Lokathor> right now most of your stuff is just in IO
03:25 <Lokathor> converting that to a monad stack at all is a fair deal of work
03:26 <kamyar> Lokathor: Also I have to change handler funciton signatore to get pool
03:26 kamog joined
03:26 ridho joined
03:27 <EvanR> https://pbs.twimg.com/media/C8QejJ1VoAAQgDE.jpg
03:28 <geekosaur> Lokathor, yes, I'd think so
03:28 <geekosaur> (re async)
03:29 ChaiTRex joined
03:30 <kamyar> Lokathor: What if I define some types to hold my stuff and change functions to get them in
03:30 unyu joined
03:30 joelburget joined
03:31 <Lokathor> I'm not fully familiar with your program, but I can say that "do the first version without using Reader then see if you really need it later" is always solid advice
03:31 tromp joined
03:32 filterfish_ joined
03:34 <Lokathor> :t liftIO withAsync
03:34 <lambdabot> error: Variable not in scope: withAsync :: IO a
03:34 Destol joined
03:34 <Lokathor> :t liftIO Control.Concurrent.Async.withAsync
03:34 <lambdabot> error:
03:34 <lambdabot> • Couldn't match expected type ‘IO a’
03:34 <lambdabot> with actual type ‘IO a0
03:34 ericsagnes joined
03:35 <Lokathor> geekosaur, trying to lift async gives you that insane type error thing ^
03:35 Durbley joined
03:35 <Lokathor> a proper ghci can tell you the full story and such
03:35 _sg2 joined
03:35 <mniip> withAsync sounds like a higher rank type
03:35 <mniip> :t Control.Concurrent.Async.withAsync
03:35 <lambdabot> IO a -> (Control.Concurrent.Async.Async a -> IO b) -> IO b
03:36 <Lokathor> yeah, it uses bracket and stuff
03:36 <EvanR> i dont see why there would be a problem spawning threads with async inside a MonadIO monad
03:36 <mniip> :t liftIO
03:36 <lambdabot> MonadIO m => IO a -> m a
03:36 <Lokathor> EvanR, type mismatch is all :P
03:36 <mniip> ah, here's the problem
03:36 <EvanR> not a higher rank type, but a higher order function
03:37 <mniip> EvanR, yeah but the error message suggested rankn
03:37 <EvanR> bad error msg, bad
03:37 <geekosaur> depends on the context of the error message
03:37 <Lokathor> https://hackage.haskell.org/package/lifted-async-
03:37 <Lokathor> so there's this package
03:37 hybrid joined
03:38 <Lokathor> but last time i had to use it, someone else told me how to make the MonadBaseControl dealybooper
03:39 xcmw joined
03:39 takle joined
03:39 <Lokathor> i've no real idea how it works :/ something about shifting things around and then reversing them later
03:40 ridho joined
03:41 sdothum joined
03:43 _sg2 joined
03:44 <Lokathor> even dropping the bracket stuff, liftIO Control.Concurrent.Async.async doesn't work because it's still higher order.
03:44 joelburget joined
03:47 _sg joined
03:48 juhp__ joined
03:48 jer1 joined
03:49 <MarcelineVQ> doesn't work?
03:49 <Lokathor> doesn't type check
03:49 <Lokathor> :t liftIO Control.Concurrent.Async.async
03:49 <lambdabot> error:
03:49 <lambdabot> • Couldn't match expected type ‘IO a’
03:49 <lambdabot> with actual type ‘IO a0 -> IO (Control.Concurrent.Async.Async a0)’
03:49 <MarcelineVQ> that's an arity issue isn't it
03:49 <Lokathor> is it?
03:49 <MarcelineVQ> liftIO . async ?
03:50 <Lokathor> hmm
03:50 <geekosaur> that was what I meant by context earlier
03:50 <geekosaur> :t liftIO . Control.Concurrent.Async.async
03:50 <lambdabot> MonadIO m => IO a -> m (Control.Concurrent.Async.Async a)
03:50 <Lokathor> that blasted dot
03:51 <geekosaur> without the dot, you do indeed have some higher order and probably impredicative monstrosity
03:51 joelburget joined
03:51 _sg2 joined
03:53 Antares joined
03:55 sproingie joined
03:55 sproingie joined
03:56 tromp joined
03:58 <Lokathor> hmm
03:58 takle joined
03:58 felixsch_ joined
03:58 <Lokathor> http://lpaste.net/355347
03:58 otto_s joined
04:00 _sg2 joined
04:01 __main__ joined
04:01 mbrock joined
04:01 splanch joined
04:02 <Lokathor> a billion curses
04:03 SlashLife joined
04:03 <Lokathor> even mixing in ansi-terminal stuff, it doesn't print in colors you set
04:03 <Lokathor> eg, http://lpaste.net/355348
04:05 mbp joined
04:07 binaryplease joined
04:07 typedrat joined
04:07 jer1 joined
04:08 _sg joined
04:09 <Lokathor> perhaps if you do the thing where you send the control sequences as part of the string, but that doesn't work on windows so i don't care
04:09 <EvanR> >_<
04:10 louispan joined
04:10 <EvanR> might should have just made a terminal-looking thing in SDL
04:10 <Lokathor> yeah
04:10 Costar joined
04:10 descender joined
04:11 <Lokathor> that's why i was making that dumpy triforce actually... I did a lesson of opengl and i'm hoping to make it into a 2d grid of glyphs thing
04:11 <Lokathor> (yes i could use SDL, but then i'd need the SDL.dll to be packaged too, so i'll learn a little opengl along the way)
04:11 andro_ joined
04:11 <EvanR> sdl or glfw
04:12 <Lokathor> GLFW-b is making my window
04:12 <Lokathor> but it sure seems to be fine without a backing dll on windows, or at least said dll is part of the system files enough that i could assume the user will have it
04:12 <Lokathor> of course, then there's no sound support and stuff, oh well
04:13 perrier-jouet joined
04:13 tromp joined
04:13 <EvanR> port audio bindings
04:13 <EvanR> actually what rogue likes have sound
04:13 <Lokathor> that too
04:13 <Lokathor> i mean the end user of the library can still add audio via whatever audio library they want
04:13 fosterite joined
04:14 <Lokathor> but i think i could even package the font bitmap straight into the EXE if i wanted to have an executable that you could just run from anywhere
04:15 <Lokathor> convert the font data into a huge bytestring, shove that as a literal into a module the program compiles in, convert that at runtime instead of loading form disk. ugly, but would work i think?
04:15 sproingie joined
04:16 _sg2 joined
04:16 <EvanR> sounds good
04:18 <Lokathor> it's all just bytes in the end
04:18 _sg joined
04:19 wyvern joined
04:19 <EvanR> bytes are just another abstract data type
04:19 <Lokathor> main = do { a <- doThing; doOtherThing (unsafeCoerce a)}
04:20 <EvanR> o_O
04:21 jchia1 joined
04:22 Antares joined
04:23 _sg joined
04:23 kamyar left
04:25 splanch joined
04:27 splanch_ joined
04:27 louispan joined
04:28 _sg2 joined
04:28 ystael joined
04:28 splanch__ joined
04:28 jer1 joined
04:30 splanc___ joined
04:30 eklavya joined
04:30 cschneid_ joined
04:31 joelburget joined
04:34 <Lokathor> https://www.dropbox.com/s/3rokj1l14lmtn3f/Screenshot%202017-05-08%2022.32.42.png?dl=0
04:35 <EvanR> woo colors
04:35 Xanather joined
04:36 <Lokathor> sadly, this only works on windows at the moment
04:37 _sg joined
04:38 connrs joined
04:39 <Lokathor> specifically in the cmd prompt, not in other forms of prompt
04:39 _sg joined
04:40 splanch joined
04:41 brynedwardz joined
04:41 dm3 joined
04:42 _sg joined
04:43 vektorweg11 joined
04:45 splanch joined
04:45 takle joined
04:48 _sg joined
04:49 jer1 joined
04:49 splanch joined
04:50 vlatkoB joined
04:51 MrWoohoo joined
04:53 SpinTensor joined
04:54 <mniip> Lokathor, can't you just load ansi.sys
04:54 BartAdv joined
04:54 <Lokathor> mniip, i don't know what package that module is from
04:54 doomlord joined
04:54 <mniip> dos?
04:55 <Lokathor> well, the goal is to have a cross-platform version
04:55 doomlord joined
04:55 <Lokathor> i mean ansi-terminal already does colors, you just can't mix ansi-terminal with haskeline it seems
04:55 <mniip> ansi.sys translated ansi escape sequences into dos formatting interrupts so
04:56 doomlord joined
04:56 treaki_ joined
04:57 doomlord joined
04:57 doomlord joined
04:58 mjora7 joined
04:58 filterfish__ joined
05:00 <Lokathor> hmm
05:01 <Lokathor> i don't see a dos package on hackage...
05:01 _sg joined
05:03 louispan joined
05:03 takle joined
05:04 c4r50nz joined
05:05 michaelw joined
05:06 roar joined
05:06 _sg joined
05:07 roar joined
05:07 geekosaur joined
05:07 guardianJ joined
05:07 dec0n joined
05:08 <Lokathor> mniip, ^
05:08 <mniip> um
05:08 <mniip> I think you've misinterpreted me
05:09 <Lokathor> i'm starting to think the same
05:09 <mniip> I'm talking about DOS the operating system
05:09 _sg joined
05:09 jer1 joined
05:10 extra- joined
05:11 shangxiao joined
05:11 aarvar joined
05:12 joelburget joined
05:12 Sose_ joined
05:13 xtreak joined
05:13 guardianJ joined
05:14 cyborg-one joined
05:14 <Lokathor> mniip, this would be more modern versions of windows :P
05:15 Mutter joined
05:15 _sg joined
05:15 jhrcek joined
05:18 _sg joined
05:18 cur8or joined
05:18 Costar joined
05:18 prizim joined
05:19 aarvar left
05:19 splanch joined
05:20 Swizec joined
05:23 teto joined
05:24 guardianJ left
05:24 jchia joined
05:25 tromp joined
05:27 osa1 joined
05:27 osa1 joined
05:27 dfeuer joined
05:27 jchia joined
05:27 northfurr joined
05:28 takle joined
05:29 tomus joined
05:29 ystael joined
05:30 jer1 joined
05:31 jchia joined
05:31 jchia joined
05:31 jchia joined
05:33 reino4477 joined
05:33 <reino4477> hi. will anyone help me to fix an error https://gist.github.com/GildedHonour/02007863f4c10fc611efcfc361507c6d ?
05:34 <reino4477> that's Spock
05:34 zgrepc joined
05:34 <reino4477> I've tried different ways to fix it, but...
05:34 <glguy> reino4477: It looks like part of the error message got cut of
05:35 <reino4477> glguy: updated
05:36 <reino4477> it's all about types mismatch
05:36 takle joined
05:37 <glguy> That error message doesn't appear to match the code you pasted
05:37 jchia joined
05:38 <reino4477> ok. how do I properly return an html file from the "post" with the "do"?
05:39 joelburget joined
05:39 <reino4477> post "/some_port_url" $ do ..........
05:40 Xanather joined
05:42 Randy joined
05:42 primal_ joined
05:42 suppi joined
05:42 Mutter joined
05:43 mstruebing joined
05:43 rinon joined
05:43 rinon joined
05:44 jgertm joined
05:44 caumeslasal joined
05:46 jutaro joined
05:46 solatis joined
05:48 montag451___ joined
05:48 ThomasLocke joined
05:48 ThomasLocke joined
05:48 mrjake joined
05:48 Argue joined
05:51 primal_ joined
05:51 <cocreature> ReinH: take a look at https://hackage.haskell.org/package/Spock-core-
05:52 <cocreature> eh sry, reino4477 already left and autocomplete broke
05:52 jer1 joined
05:53 joelburget joined
05:54 aarvar joined
05:54 takle joined
05:54 robertkennedy joined
05:55 dm3 joined
05:57 chrissl joined
05:58 mbuf joined
06:02 sproingie joined
06:02 danvet joined
06:06 reino4477 joined
06:06 <reino4477> does anybody know how to capture POST parameters in Spock?
06:08 eatman joined
06:12 louispan joined
06:12 jer1 joined
06:12 rkazak joined
06:12 <cocreature> reino4477: do you want to capture query string parameters or the request body?
06:13 muesli4 joined
06:13 dejanr joined
06:14 <reino4477> cocreature: no
06:14 student001 joined
06:14 thunderrd joined
06:15 <cocreature> … so what do you want to do?
06:15 <reino4477> capture parameters of a POST
06:17 revtintin joined
06:18 txx joined
06:18 <cocreature> you can get the request body using "body" from Web.Spock.Action
06:19 <txx> Seems like Haskell is working its way "up" the chain of mathematical objects: https://en.wikipedia.org/wiki/Magma_(algebra)#/media/File:Magma_to_group2.svg
06:19 suppi joined
06:19 yoneda joined
06:19 <reino4477> cocreature: thx
06:19 <txx> This creates issues w/ compatiblity: https://prime.haskell.org/wiki/Libraries/Proposals/SemigroupMonoid
06:19 <txx> Why not just work down from magna :P?
06:20 <txx> *magma
06:20 joelburget joined
06:20 takle joined
06:20 <cocreature> txx: because you can’t change history and Monoid was there before :)
06:20 <txx> Yes, but it's never too late to start
06:21 <cocreature> also Magma is not really a useful class
06:21 <txx> Don't think Magma, Quasigroup, or Loop exist yet
06:21 RegEchse joined
06:22 <cocreature> Haskell is still a programming language and not a way to formalize math so you have to think about what is actually useful in programs
06:23 <txx> Inb4 need to implement Axiom of Choice
06:24 <txx> Sure, well, the Functor-Applicative-Monad and Semigroup-Monoid proposals just made me smh at the necessary shoehorning things back in
06:24 hurkan joined
06:25 <pacak> txx: Do you have any good examples of something that is Magma, but not Semigroup/Monoid?
06:25 <cocreature> pacak: (-) on integers
06:27 Mortomes|Work joined
06:28 <pacak> Hmm... Good and useful example I wanted to say.
06:30 <cocreature> well things that are not associative are always awkward :)
06:30 txx left
06:30 zeroed joined
06:30 zeroed joined
06:30 CurryWurst joined
06:31 freusque joined
06:31 ystael joined
06:33 afarmer joined
06:33 jer1 joined
06:33 joelburget joined
06:33 Argue_ joined
06:33 mohsen_1 joined
06:34 andyhuzhill joined
06:34 <reino4477> what's the simpliest way to convert a json string to a map or tuple? preferably, without a 3rd party dependencies
06:35 conal joined
06:35 andyhuzhill joined
06:35 <pacak> aeson?
06:36 <reino4477> why are you asking me?
06:36 xtreak joined
06:36 <liste> reino4477: by using dependencies (the aeson library for json parsing)
06:36 <liste> @hackage aeson -- reino4477
06:36 <lambdabot> http://hackage.haskell.org/package/aeson -- reino4477
06:37 Argue__ joined
06:37 <reino4477> and without them?
06:37 primal_ joined
06:37 <cocreature> write your own json parser
06:37 <pacak> > (\x -> (x, "1")) "Json string" -- in a tuple
06:37 <lambdabot> ("Json string","1")
06:38 <reino4477> isn't there anything in haskell standard library?
06:38 <liste> reino4477: for json? no
06:38 <reino4477> thanks
06:39 connrs joined
06:39 <liste> the `base' library is minimal
06:39 <liste> you should really be using other libraries too
06:39 <cocreature> liste: they already left
06:39 <liste> cocreature: oh, I see, thanks. (I have part/join notifications off)
06:40 alfredo joined
06:40 mgu joined
06:40 Argue_ joined
06:40 <cocreature> liste: weechat has a cool feature where it shows you part/join notifications only when the person talked within a configurable timespan (the last 5 minutes by default) :)
06:41 louispan joined
06:41 quobo joined
06:41 takle joined
06:41 <kadoban> Yeah, my client has that as well, it's a nice feature.
06:41 <ongy> glirc has a cool feature where it collapses all join/part into one line :)
06:43 oisdk joined
06:44 xtreak joined
06:45 synProgrammer joined
06:46 bkboggy joined
06:46 primal joined
06:47 magthe joined
06:51 quchen joined
06:51 teto joined
06:53 ertes-w joined
06:53 primal_ joined
06:53 jer1 joined
06:54 guiben joined
06:54 danthemyth joined
06:56 mmn80 joined
06:56 primal_ joined
06:57 ogrady joined
06:57 hansihe joined
06:59 paolino joined
06:59 joelburget joined
06:59 ventonegro joined
06:59 augur joined
07:00 takle joined
07:00 Itkovian joined
07:01 primal joined
07:02 uglyfigurine joined
07:02 <Antares> Parade Victory http://www.1tv.ru/live Parade Victory
07:04 rinon joined
07:04 rinon joined
07:04 prophile joined
07:06 primal__ joined
07:07 primal___ joined
07:07 primal__1 joined
07:08 ragepandemic joined
07:08 nickolay joined
07:11 binaryplease joined
07:11 takle joined
07:12 <pacak> Antares: o_O
07:12 <pacak> Antares: ☭
07:14 jer1 joined
07:14 Elhamer_ joined
07:15 vlatkoB_ joined
07:16 primal joined
07:16 roar joined
07:17 primal_ joined
07:17 primal__2 joined
07:17 bennofs joined
07:18 juhp__ joined
07:18 bvad joined
07:20 filterfish__ joined
07:20 eklavya joined
07:21 carlomagno2 joined
07:24 takle joined
07:25 noam joined
07:25 tromp joined
07:26 aloiscochard joined
07:26 takuan joined
07:26 joelburget joined
07:26 primal__ joined
07:26 primal___ joined
07:26 primal__1 joined
07:27 cur8or joined
07:28 mattyw joined
07:31 oish joined
07:31 takle joined
07:32 ystael joined
07:34 Yuras joined
07:34 guiben joined
07:34 jer1 joined
07:35 connrs joined
07:35 thc202 joined
07:35 augur joined
07:35 armyriad joined
07:36 freusque joined
07:36 primal joined
07:36 primal_ joined
07:36 bigos_ joined
07:37 primal__2 joined
07:37 teto joined
07:37 uiop joined
07:39 coot joined
07:40 [[[[[ExTRa]]]]] joined
07:40 armyriad joined
07:40 joelburget joined
07:40 xall_ joined
07:44 coot joined
07:46 takle joined
07:47 primal__ joined
07:47 primal___ joined
07:47 primal__1 joined
07:47 baldrick joined
07:48 teto joined
07:48 jwbuurlage joined
07:49 razi1 joined
07:51 Tinyyy joined
07:53 [[ExTRa]] joined
07:54 narendraj9 joined
07:55 jer1 joined
07:55 darjeeling_ joined
07:56 primal joined
07:56 primal_ joined
07:57 primal__2 joined
07:58 takle joined
08:02 infinity0 joined
08:03 acidjnk22 joined
08:04 mohsen_ joined
08:04 oisdk joined
08:06 primal__ joined
08:07 primal___ joined
08:07 primal__1 joined
08:07 zariuq joined
08:07 joelburget joined
08:07 sproingie joined
08:07 sproingie joined
08:08 takle joined
08:09 teto joined
08:12 marr joined
08:13 bennofs joined
08:13 Glooomy joined
08:14 narendraj9 joined
08:15 Elhamer__ joined
08:15 zargoertzel joined
08:16 primal joined
08:16 primal_ joined
08:16 primal__2 joined
08:17 tomphp joined
08:18 ChaiTRex joined
08:18 PennyNeko joined
08:18 merijn joined
08:18 fre joined
08:19 jer1 joined
08:19 mjora7 joined
08:19 soniku joined
08:22 slomo joined
08:23 mels joined
08:23 fizruk joined
08:24 teto joined
08:25 metalrain joined
08:25 balor joined
08:25 primal__ joined
08:26 bennofs joined
08:26 primal___ joined
08:26 Dookie12 joined
08:26 primal__1 joined
08:26 billstclair joined
08:27 takle joined
08:27 lep_ joined
08:27 entuland joined
08:29 jhrcek joined
08:30 teto joined
08:31 jutaro joined
08:31 ploop joined
08:33 tomphp joined
08:33 ystael joined
08:35 primal joined
08:36 primal_ joined
08:36 primal__2 joined
08:37 tomphp joined
08:38 jer1 joined
08:40 soLucien joined
08:42 cranej joined
08:42 Frankablu joined
08:42 teto joined
08:43 sophiag joined
08:45 primal__ joined
08:45 primal___ joined
08:46 primal__1 joined
08:46 dm3 joined
08:47 raichoo joined
08:48 bollu joined
08:48 <bollu> cocreature: ping
08:49 Levex joined
08:49 <bollu> cocreature: you had shown me a way to encode a "free-ish" DSL while still being inspectable (i.e, not having things of the form a -> Free f b)
08:50 uglyfigurine joined
08:51 hurkan left
08:51 takle joined
08:53 bvad joined
08:55 danthemyth joined
08:55 primal joined
08:55 <merijn> Is there a way to use cabal flags to cause the same target to be built multiple times?
08:56 xtreak joined
08:56 primal_ joined
08:56 primal__2 joined
08:56 lemonxah joined
08:56 <lemonxah> good day :)
08:57 <merijn> I have to flags Foo and Bar and one target that should be built with ghc-options X if Foo is true and with ghc-options Y is true and I'd like to build both versions if both flags are true
08:57 balor joined
08:57 <merijn> Or am I stuck duplicating the target with a different name?
08:57 stphrolland joined
08:57 <lemonxah> i appologize if this is off topic to this channel, i am semi new to haskell and would like to know if there is a preffered library to use for writing RESTful API service
08:58 cloudhead joined
08:58 <stphrolland> Hi, I have a question about aeson. I work with a API which delivers objects which have an field called id. How do I do so as to avoid conflicts with id function defined in Prelude ?
08:58 <yushyin> lemonxah: maybe servant
08:59 tomphp joined
08:59 jer1 joined
08:59 <stphrolland> I mean, when I define the record which corresponds to the json object, I should have a field called id, which will collide with the Prelude id function.
09:01 <merijn> stphrolland: Well, the easiest solution is to avoid naming the field id. Another option would be to hide Prelude's id, which is not ideal. Or a final option is to only use explicitly qualified names for id
09:01 <lemonxah> yushyin: thank you i will check it out i am going to write some microservices
09:01 joelburget joined
09:02 kamyar joined
09:02 <kamyar> Hello guys
09:02 oish joined
09:02 TrumpPatrol1 joined
09:02 <kamyar> PLease help mw in the code: http://lpaste.net/355351
09:02 <kamyar> What is the problem? See error below code
09:03 OnTheTrumpPatrol joined
09:03 <OnTheTrumpPatrol> ALERT ALERT
09:04 <OnTheTrumpPatrol> PLEASE EXIT NOW
09:04 xtreak joined
09:04 <stphrolland> merijn: if I hide id only in this module ? is it considered ok ?
09:04 <merijn> stphrolland: Yeah, just annoying
09:05 <stphrolland> merijn: I have never hidden functions from Prelude, how one does it ?
09:05 unK_ joined
09:05 <merijn> stphrolland: "import Prelude hiding (id)"
09:05 <kamyar> Please check my code: http://lpaste.net/355351
09:05 primal__ joined
09:05 <merijn> stphrolland: You can also add "import qualified Prelude" after that so that you can use "Prelude.id"
09:05 primal___ joined
09:05 OnTheTrumpPatrol joined
09:06 primal__1 joined
09:06 teto joined
09:06 <TrumpPatrolAlpha> please exit now
09:07 OnTheTrumpPatrol joined
09:07 ericsagnes joined
09:07 sproingie joined
09:08 <Xnuk> @where ops
09:08 <lambdabot> byorgey Cale conal copumpkin dcoutts dibblego dolio edwardk geekosaur glguy jmcarthur johnw monochrom quicksilver Saizan shachaf shapr ski
09:08 <AlphaTrumpAlpha> damn isn't anyone gonna ban me
09:08 <AlphaTrumpAlpha> this is one sorry ass server
09:08 <kamyar> No one helps me?
09:08 <entuland> AlphaTrumpAlpha, just go to #freenode and trhy there
09:08 was kicked by dibblego: AlphaTrumpAlpha
09:09 mands joined
09:09 <entuland> :)
09:09 <merijn> Xnuk: Not really a point, they mostly get killed by freenode IRCops within a few seconds
09:09 <merijn> freenode is pretty quick with klining them
09:09 <Xnuk> oh
09:09 <tdammers> kamyar: it might help to paste something more complete
09:10 <kamyar> tdammers: I think the part is enough! Whole code is large
09:10 <entuland> it's nice how IRCops reads "I R Cops" to me :)
09:10 <merijn> Xnuk: Occasionally some scriptkiddie gets bored and starts spamming racist stuff in the top freenode channels, but they're pretty good at playing whackamole with them :)
09:10 noexcept_ joined
09:10 <tdammers> kamyar: but anyway, it looks like the type inference algorithm can't figure out which type to use for `backend`
09:10 mekeor joined
09:11 <kamyar> tdammers: It is persistent-postgresql
09:12 <tdammers> kamyar: what's the type of `listen`, and that of `conf`?
09:12 <tdammers> kamyar: no, forget that, that's not where it errors
09:12 OnTheTrumpPatrol joined
09:12 <kamyar> tdammers: Teh are just records and these two are accessors
09:13 <tdammers> the problem is that both withPostgresqlPool and handler are polymorphic
09:13 andyhuzhill1 joined
09:13 <tdammers> so when you use them both in one expression inside main, without further type annotations, the `backend` is still polymorphic
09:14 <kamyar> tdammers: u mean backend is a type parameter
09:14 <tdammers> but in order for that expression to type check, it has to unify
09:14 <kamyar> tdammers: OK I got the error but how to fix it?
09:14 <tdammers> the easiest fix is to add a type annotation
09:14 Wizek joined
09:14 <kamyar> tdammers: I know but I am not sure which type
09:14 <tdammers> such that the `backend` is forced to a monomorphic type
09:15 <tdammers> you could either change `handler` to use a monomorphic type instead of the `backend` type var
09:15 <tdammers> or you can annotate parts of the line in main that uses handler
09:16 bollu joined
09:16 <tdammers> or you could annotatie withPostgresqlPool itself
09:16 <tdammers> whatever looks the most readable
09:16 mohsen_ joined
09:17 zero_byte joined
09:17 dhil joined
09:18 alios joined
09:18 andyhuzhill1 joined
09:18 luckymerlin joined
09:18 <kamyar> tdammers: I guess if I complete the code and use the backend in the call stack the problem solves. AM I right?
09:19 <tdammers> could be, yes
09:19 <OnTheTrumpPatrol> PLEASE
09:19 <OnTheTrumpPatrol> exit
09:19 <OnTheTrumpPatrol> NOW
09:19 teto joined
09:19 was kicked by dibblego: OnTheTrumpPatrol
09:20 <kamyar> tdammers: Thnkx!
09:20 jer1 joined
09:20 splanch joined
09:21 <cloudhead> anyone know how I can create an 'edit' view with digestive-functors?
09:21 tarcwynne_ joined
09:22 LINK joined
09:23 <LINK> hello
09:23 mivael_ joined
09:24 soLucien joined
09:24 andyhuzhill joined
09:25 bilibili joined
09:26 alfredo joined
09:29 xtreak joined
09:29 Hexagenic joined
09:30 bilibili left
09:31 cschneid_ joined
09:31 bilibili joined
09:33 ericsagnes joined
09:33 fbergmann joined
09:34 ystael joined
09:35 feltnerm joined
09:35 jzelinskie joined
09:35 primal joined
09:36 primal_ joined
09:36 primal__2 joined
09:36 Logio joined
09:39 yellowj joined
09:40 uuplusu joined
09:40 twold joined
09:40 bilibili|2 joined
09:41 bilibili joined
09:42 joelburget joined
09:43 gmcabrita joined
09:43 <stphrolland> Hi, another aeson question. The API I have to work with has a field wich begins with a number 24h_var, which does not fit as a field name for my record. How would you deal with it ? The fact of using GHC generics for having instance ToJson and FromJson written for me was really pleasant.
09:44 jer1 joined
09:44 Grisha joined
09:45 bilibili|2 joined
09:46 primal__ joined
09:46 primal___ joined
09:46 primal__1 joined
09:47 <liste> stphrolland: check out https://hackage.haskell.org/package/aeson-
09:47 <liste> you can use it to configure the naming conventions
09:49 <liste> stphrolland: more here https://hackage.haskell.org/package/aeson-
09:51 bilibili|2 left
09:51 <liste> stphrolland: you use it like this: "instance FromJSON Coord where parseJSON = genericParseJSON defaultOptions { fieldLabelModifier = ... }"
09:51 mkoenig joined
09:52 <stphrolland> perfect
09:52 ycz0926 joined
09:52 <stphrolland> and for ToJson ?
09:53 geekosaur joined
09:53 flatmap13 joined
09:54 jer1 joined
09:54 teto joined
09:55 <Grisha> hello everyone
09:55 <liste> stphrolland: there's a genericToJSON too
09:56 primal joined
09:56 primal_ joined
09:56 primal__2 joined
09:57 kyagrd joined
09:58 CoderPuppy joined
09:58 mmhat joined
09:59 <Grisha> my program makes Postcards that are supposed to be sent to different Countries, so there is a class type Postcardable, which Countries might belong to. A part of the postcard making process, there is the composition of address, which is a simple operation on strings. Now, depending on the Country, there are different signatures of makeAddress, accepting different number of Strings. So makeAddress must be :: Postcardable country => AddressParameters coun
09:59 <Grisha> -> String
10:00 <Grisha> how do I make makeAddresss country-aware?
10:00 sfcg joined
10:00 mfukar joined
10:01 takle joined
10:02 <Grisha> and I feel that I don’t have to
10:02 WF-BATCH joined
10:02 <opqdonut> you could add the parameter type to Postcardable
10:03 <Grisha> opqdonut: yes, exactly
10:03 mohsen_ joined
10:03 <opqdonut> either with fundeps or type families
10:03 <Grisha> like class Postcardable country where type AddressParameters country
10:03 <Grisha> but
10:03 <opqdonut> yeah
10:03 <Grisha> then I’ve got this type ambiguity thing
10:04 <Grisha> `makeAdress String String` wouldn’t know it’s for Australia
10:04 <opqdonut> you probably need to add a Proxy country
10:04 <opqdonut> to the args
10:04 <Grisha> hmm
10:04 <Grisha> I’ve seen those proxies before
10:05 <Grisha> and thought that I understood them
10:05 <Grisha> but now I don’t ;>)
10:05 <opqdonut> so you'd run `makeAddress (Proxy :: Proxy Australia) ""` or so
10:06 <Grisha> what would be the signature of makeAddress?
10:06 primal__ joined
10:06 <opqdonut> makeAddress :: Postcardable country => Proxy country -> AddressParameters country -> String
10:06 primal___ joined
10:06 primal__1 joined
10:07 <opqdonut> another option would be to use fundeps, "class Postcardable country params | country -> params, params -> country"
10:07 <opqdonut> and have a unique newtype for every country
10:07 <Grisha> I see
10:07 <opqdonut> then you could just invoke `makeAddres (AustraliaParams "hello" "boing")` or so
10:07 <Grisha> never touched fundeps before, have to read up
10:07 kuribas joined
10:08 <opqdonut> maybe I'm not seeing everything, but you could also just identify the country with the params
10:08 <opqdonut> so you'd have "instance PostcardArgs AustraliaArgs"
10:08 <opqdonut> and none of this fancy stuff :)
10:08 <Grisha> opqdonut: it’s not injective, that’s the thing, different countries can have the same AddressParameters
10:08 blueonyx joined
10:09 <opqdonut> yeah, you'd need to newtype the differences away
10:09 joelburget joined
10:09 <opqdonut> but if you want the non-injective design then you need to have country somewhere in the function
10:09 <opqdonut> either as a Proxy argument, or mentioned in the return type
10:09 <Grisha> yes, exactly
10:09 <Grisha> thanks a lot
10:09 <Grisha> now I remember
10:09 <Grisha> I saw Proxies in Servant
10:10 <opqdonut> I imagine the type could be something like `makeAddress :: Postcardable country => AddressParameters country -> Address country"
10:10 <opqdonut> (heh, mismatched quotes)
10:10 <opqdonut> and `data Address country = Address String` for instance, so just a phantom type for the country
10:10 <Grisha> oh, so `Address country` would be another dependent type, right?
10:10 <opqdonut> dependent type is the wrong term
10:11 ycz0926 joined
10:11 nighty-- joined
10:11 <opqdonut> the `country` in `Address country` is a phantom type since it doesn't appear in the runtime value
10:12 <Grisha> should Address come from the class declaration?
10:12 teto joined
10:12 profsimm joined
10:13 <opqdonut> no, it can be a separate type
10:13 <opqdonut> there are some examples here: https://wiki.haskell.org/Phantom_type
10:14 primal joined
10:14 primal_ joined
10:14 primal__2 joined
10:14 ycz0926 joined
10:14 <Grisha> opqdonut: thank you a lot! you’ve definitely told enough to keep my efforts rolling
10:16 bigos_ joined
10:18 SLi joined
10:21 <Grisha> opqdonut: reading about fundeps
10:21 jer1 joined
10:21 Elhamer_ joined
10:22 soniku joined
10:22 joelburget joined
10:23 cschneid_ joined
10:23 primal__ joined
10:23 primal___ joined
10:24 <Grisha> sounds more like that you’re trying not to allow multiple AddressParams for the same country
10:24 primal__1 joined
10:24 <Grisha> rather just mapping countries to AddressParams
10:27 tromp joined
10:27 ycz0926 joined
10:28 piyush-kurur joined
10:29 phaji joined
10:29 rockfordal joined
10:31 <opqdonut> Grisha: yeah well you can't have multiple AddressParams for the same country with associated types either
10:31 <opqdonut> Grisha: if you want m:n mapping between countries and params you need a separate type family for that, and a Proxy type or some way to specify the country
10:32 <Grisha> opqdonut: what’s the difference then between type families and fundeps?
10:32 <Grisha> ok, maybe too big a question :)
10:32 Xanather joined
10:32 <opqdonut> "class MyClass a b | a -> b" is pretty close to "class MyClass a where type MyClassType"
10:33 <Grisha> but?
10:33 <opqdonut> no buts
10:34 <Grisha> one being syntactic sugar for the other?
10:34 primal joined
10:34 primal_ joined
10:34 <opqdonut> not sure how the implementation goes
10:34 primal__2 joined
10:35 ystael joined
10:36 tomboy64 joined
10:38 govg joined
10:38 erisco_ joined
10:40 <Grisha> opqdonut: you’ve been very helpful, thanks a lot
10:41 sdothum joined
10:41 mattyw joined
10:42 flatmap1_ joined
10:43 <rightfold> There are differences
10:44 mohsen_ joined
10:44 tomboy64 joined
10:47 jship joined
10:47 danthemyth joined
10:49 JagaJaga joined
10:49 danthemyth joined
10:49 joelburget joined
10:50 rockfordal joined
10:51 kefin joined
10:51 Nikotiini joined
10:51 xtreak joined
10:51 bollu joined
10:53 reino4477 joined
10:53 <reino4477> could anyone take a look at this ? http://stackoverflow.com/questions/43865876/aeson-decode-and-overloadedstrings
10:54 primal__ joined
10:54 primal___ joined
10:54 primal__1 joined
10:55 noexcept_ joined
10:57 <srhb> reino4477: decode takes a ByteString, you're feeding it a Text. Are you confused about the conversion?
10:57 <srhb> reino4477: OverloadedStrings only makes string *literals* polymorphic.
10:57 extra- joined
10:57 bennofs joined
10:59 <reino4477> srhb: pack doesn't work either.
11:00 maartinex joined
11:00 <Philonous> Is there a way to construct singletons for Symbols? I.e. I want to have a value of type (Sing ("abc" :: Symbol))
11:00 LeCamarade joined
11:00 maartinex left
11:00 maartinex joined
11:01 <srhb> reino4477: Data.Text.pack? Isn't that String -> Text ?
11:01 perrier-jouet joined
11:01 szhwump joined
11:01 <srhb> reino4477: You need Text -> ByteString, ie. some encoding aware function.
11:01 <maartinex> hello guys, what library or framework should i use for testing in Haskell ?
11:02 Snircle joined
11:02 shangxiao joined
11:03 <szhwump> hi, I want to compile/run a .hs file without setting up a project, can I do that using stack?
11:03 <srhb> szhwump: I think stack has an implicit "project" that lives in your homedir that will be used if you try.
11:04 joelburget joined
11:04 primal joined
11:04 primal_ joined
11:04 <srhb> szhwump: Or in other words, "try" :-)
11:04 <maartinex> srhb, whats the difference just doing ghc ... instead stack .. ?
11:04 <reino4477> srhb: of course
11:04 <reino4477> How can I convert Internal.ByteString to Lazy.Internal.ByteString?
11:04 <srhb> maartinex: stack commands will have access to stack install'ed packages.
11:04 primal__2 joined
11:04 <srhb> reino4477: If you're going from Text, just use the one that goes to lazy immediately.
11:05 <szhwump> srhb: so is there a sandbox in the homdir?
11:05 <reino4477> srhb: what's the one?
11:05 <srhb> szhwump: Yeah, somewhere in ~/.stack I think
11:05 <szhwump> cool thanks
11:05 <srhb> szhwump: I don't use stack myself, so someone else might be more knowledgable :-)
11:05 doomlord_ joined
11:05 <dysfun> .stack-work
11:05 <maartinex> which testing library or framework should i use for my little project ?
11:06 fotonzade joined
11:06 <srhb> reino4477: Data.Text.Lazy.Encoding iirc.
11:06 <reino4477> thx
11:06 <szhwump> srhb: do you never do that though? even if you want to test out something quickly, do you always set up a project?
11:07 <srhb> szhwump: I don't use stack at all, I use Nix, so I just spawn a shell with the packages I need.
11:07 <szhwump> (assuming the repl isn't enough)
11:07 <maartinex> https://hackage.haskell.org/package/HUnit ?
11:07 andro_ joined
11:07 <srhb> szhwump: (I have a gwp (ghc with packages) shell alias than I can use like: gwp lens aeson text mtl and get a shell with ghc with those packages immediately)
11:08 <maartinex> i use nix too, no compling and liked it :D
11:08 <MasseR> srhb: .. that's not a bad idea actually
11:08 <srhb> MasseR: Well, it's just an alias for..
11:08 <srhb> MasseR: nix-shell -p "pkgs.haskell.packages.ghc802.ghcWithPackages (pkgs: with pkgs; [ lens aeson text mtl ])"
11:09 <srhb> MasseR: Which indeed is really useful :)
11:09 <szhwump> that sounds amazing
11:09 <maartinex> srhb, yes sir
11:09 <MasseR> srhb: yeah, I have similar lines in my command history, didn't think of aliasing it though
11:09 <srhb> MasseR: :)
11:09 HoierM joined
11:09 <maartinex> you can use cabal2nix etc..
11:09 <srhb> MasseR: Well, I'm also lying. it's actually a function. I can do gwp -c 7.10.2 lens mtl aeson
11:10 <maartinex> i followed this, https://www.google.com.tr/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwi109qp1uLTAhVCCZoKHZndA0gQFggmMAA&url=https%3A%2F%2Fgithub.com%2FGabriel439%2Fhaskell-nix&usg=AFQjCNGIHfBySfZpQhLm1nXhz-iTacpAIg&sig2=gVu5MK1gxBbOvjSOMMHN9A
11:10 <srhb> MasseR: Which is occasionally useful.
11:10 <maartinex> sorry , https://github.com/Gabriel439/haskell-nix
11:11 <szhwump> so do I need to get NixOS for this?
11:11 <MasseR> szhwump: no, only nix the package manager
11:11 <szhwump> and does this do away with having to use stack somehow?
11:11 <MasseR> szhwump: to be honest, I find stack to be much, much easier
11:12 <srhb> szhwump: You can use both if you like.
11:12 <dysfun> me too
11:12 <srhb> I prefer nix.
11:12 <dysfun> stack is way way easier than understanding nix
11:12 <srhb> Agreed.
11:12 soniku joined
11:12 <szhwump> MasseR: so can you please answer that question then^
11:12 <szhwump> do you never do that though? even if you want to test out something quickly, do you always set up a project?
11:12 <MasseR> szhwump: no
11:12 <maartinex> szhwump, no you dont need at all, i installed nix on vagrant ubuntu and works as same on nixos
11:13 <MasseR> If I want to test something quickly I use the nix-shell solution above, or install packages inside my stack sandbox
11:13 <MasseR> stack --resolver=lts-7.14 install foo
11:13 <MasseR> stack --resolver=lts-7.14 ghci
11:13 <MasseR> import Foo.Bar
11:13 <szhwump> huh, neat
11:14 <maartinex> you guys find nix complicated too ?
11:14 <dysfun> it is
11:14 <MasseR> You can also create scripts with both nix and stack
11:14 <MasseR> #!/usr/bin/env stack
11:14 <dysfun> and the nix language is horrible
11:14 Glooomy joined
11:14 <maartinex> finally someone agreed with me :D yeah it is definetly horrible
11:14 romank joined
11:14 <MasseR> --stack --resolver=lts-7.14 --install-ghc runghc --package brick --package vector
11:15 <hpc> nix is fairly close to being a good configuration language, to be fair
11:15 <maartinex> MasseR, instead of repeating --package ... , you could write little script :D
11:15 <hpc> it just needs types and a clear delineation between pure expressions and things that affect the system state
11:16 <MasseR> maartinex: but those are usually little scripts ;)
11:16 <MasseR> I don't need little scripts to handle package management for my little scripts
11:16 <maartinex> hpc, maybe it is only for defining configuration.nix etc.. in /etc/nixos
11:16 <maartinex> the rest for nix i dont know
11:17 joelburget joined
11:17 <hpc> it does system configuration and packaging
11:17 <maartinex> i can do something with chef etc.. but those are more heavy
11:17 <hpc> i don't have much experience with the packaging side of things either
11:18 <hpc> it's 100% a worse system configuration language than puppet though
11:18 <hpc> which has both of the things i mentioned above
11:18 <maartinex> i have experience in chef but never tried puppet but i heard it is good too
11:19 xtreak joined
11:19 <hpc> the way i would put it is, in the same way haskell is a pure functional language, puppet is a pure imperative language
11:19 navilan joined
11:19 <maartinex> i had packaged some software in nix though but it was very complicated for me :D
11:20 <ertes-w> maartinex: nix has a learning curve, but unlike haskell the curve actually becomes level at some point, so you won't find yourself constantly learning new things once you've mastered the basics =)
11:20 <ertes-w> also it pays off
11:20 <maartinex> i told them and agreed with me too, they have a lot of tools but documentation is poor or weird
11:20 <ertes-w> if only for not having to compile everything
11:21 soLucien joined
11:21 xtreak joined
11:22 teto joined
11:22 <dysfun> is there something better than 'plugins' for loading haskell code at runtime? is there a ghci api?
11:23 <ertes-w> dysfun: during development or in production?
11:23 <dysfun> i'd be interested in both
11:23 <maartinex> ertes-w, sen turk degil miydin bu arada ? :D
11:23 <hpc> dysfun: at a low level there's sort of two options
11:23 <ertes-w> dysfun: for the former i have a project called rapid that you can use… for the latter i would just use separate processes
11:24 <ertes-w> @package rapid
11:24 <lambdabot> http://hackage.haskell.org/package/rapid
11:24 <ertes-w> maartinex: sorry, i don't speak turkish
11:24 primal__ joined
11:24 primal___ joined
11:24 bigos_ joined
11:24 <hpc> dysfun: you can use dlls as plugins, or a more eval-ish approach with hint
11:24 <hpc> (haskell interpreter)
11:24 <maartinex> are you turkish ?
11:24 primal__1 joined
11:24 <maartinex> :P :D
11:25 gawen joined
11:27 macrover joined
11:28 <merijn> #haskell needs a name to nick map...
11:30 <dysfun> okay, i've got plenty to look at. thanks for the help
11:31 mmachenry joined
11:31 joelburget joined
11:33 netheranthem joined
11:34 <srhb> merijn: Just change your legal name to whatever your nick is. Problem solved!
11:34 <merijn> srhb: I don't have to, my nick is already my name, but that doesn't help me find other people :p
11:35 <merijn> srhb: I've learned that badgering people on IRC is far more effective than email/tickets ;)
11:35 <srhb> merijn: Well, I obviously meant to make it an official policy of the channel. ;-)
11:35 <srhb> Agreed!
11:35 <merijn> srhb: Might wanna reconsider your nick, then ;)
11:35 ystael joined
11:36 <Philonous> Maybe that's his actual name?
11:36 <merijn> Philonous: Pretty sure it is her name, minus some vowels and most of the last name :p
11:37 teto joined
11:37 <Philonous> Ugh, I need to get into the habit of using neutral pronouns. Is "they" still the appropriate choice?
11:38 <merijn> Philonous: I just use rote memorisation of people here :p
11:41 <srhb> merijn: You're right :-)
11:41 asmyers joined
11:42 <srhb> It sounds like shrub when pronounced though, which I like, so I might just check if I can legally use that!
11:42 _sg joined
11:42 <Philonous> Can't we just have links to github pages as IRC-nicks? :>
11:44 <quchen> github.com/quchen :-þ
11:44 mmachenry joined
11:44 <merijn> github.com/merijn :p
11:44 joelburget joined
11:45 <tdammers> github.com/tdammers
11:45 <tdammers> yay
11:45 Silox| joined
11:46 <srhb> github.com/srhb >>
11:46 <srhb> We're obviously very clever.
11:48 <Philonous> OK, fair enough, maybe I should just make the names clickable in my IRC client so it sends me to the appropriate page
11:48 <srhb> Philonous: (I use "they" by the way, if /who doesn't seem obvious)
11:48 fotonzade joined
11:48 soLucien joined
11:49 <merijn> On a more practical (well...) haskell topic, suggestions how this could be written more nicely?
11:49 JeanCarloMachado joined
11:49 <lpaste> merijn pasted “No title” at http://lpaste.net/355355
11:49 <merijn> Specifically making line 3 suck less
11:50 <Philonous> I think line 3 is fine, except that I don't see where i comes into scope
11:50 <merijn> Philonous: oh, because I deleted it when I simplified it :p
11:50 Elhamer__ joined
11:51 <Philonous> Maybe newline/indent the parts of the tuple? Not sure
11:51 <merijn> Philonous: Suggestions on how to clean up the typing instead are welcome too :p
11:53 primal joined
11:53 primal_ joined
11:53 Kreest__ joined
11:54 primal__2 joined
11:54 augur joined
11:55 maartinex joined
11:55 <Philonous> Although depending on how you use it, sticking the actions into a record instead of a pair might help with understanding. Memorizing which part of the tuple did what is taxing when producer and consumer of it are far apart
11:56 romank joined
11:57 binaryplease joined
11:58 fendor joined
11:58 jutaro joined
11:59 Glooomy joined
11:59 cpup joined
12:00 <Philonous> There is currently no way to get singletons for Symbols, as in (sing :: Sing "abc"), is there ?
12:00 CosmicRa` joined
12:01 [[[[[ExTRa]]]]] joined
12:02 <Philonous> Oh wait, evidently there is
12:02 <Philonous> Never mind
12:02 zargoertzel joined
12:04 luckymerlin joined
12:04 primal__ joined
12:04 primal___ joined
12:04 primal__1 joined
12:04 <quchen> Is there a way I can tell Stack to run the benchmarks using certain arguments? I usually have a shell script thar runs Criteion with e.g. an --output folder, but I think »stack bench« ought to do this on its own somehow.
12:08 <merijn> Philonous: Not really the issue here, because I basically have "syncGeneral :: (Int -> IO (IO (), IO ())) -> String -> Int -> Benchmark" and then I have specialised versions for different primitives. So the tuple is immediately consumed and only exists to abstract a way a bunch of boilerplate :)
12:08 <merijn> Philonous: i.e., the actual function is "syncMVar = syncGeneral $ \i -> do ..." immediately consuming the tuple again
12:08 <Philonous> Yes, then it's not problem I think
12:08 <Philonous> s/not/no
12:09 Destol joined
12:10 <Philonous> Richard Eisenberg should hurry up and implement pi types already, mucking around with singletons is so painful.
12:10 <Philonous> Maybe I can bribe him...
12:10 alibabzo joined
12:10 teto joined
12:11 romank joined
12:11 joelburget joined
12:12 shangxiao joined
12:12 mounty joined
12:13 balor joined
12:13 tromp joined
12:14 primal joined
12:14 primal_ joined
12:14 primal__2 joined
12:14 profsimm joined
12:15 obadz joined
12:19 ziocroc2 joined
12:20 ystael joined
12:20 burtons joined
12:22 fendoer joined
12:23 primal__ joined
12:24 primal___ joined
12:24 primal__1 joined
12:24 teto joined
12:25 solution_ joined
12:28 danthemyth joined
12:29 danthemyth joined
12:30 danthemyth joined
12:30 extra- joined
12:31 ridho joined
12:32 navilan joined
12:34 primal joined
12:34 primal_ joined
12:34 primal__2 joined
12:34 joelburget joined
12:34 Dookie12 joined
12:36 fotonzade joined
12:36 teto joined
12:36 zero_byte joined
12:36 asmyers joined
12:37 psychicist__ joined
12:41 systadmin joined
12:42 refold joined
12:43 teto joined
12:43 DocWinter joined
12:44 primal__ joined
12:44 primal___ joined
12:44 <jchia_1> I have many top-level names for monads that have the same context and differ only in the return value, e.g. 'foo :: (MonadState Int m, MonadParsec e s m, Token s ~ Char) => m Int' and 'bar :: (MonadState Int m, MonadParsec e s m, Token s ~ Char) => m (Int, Int)'. Is it possible to extract the '(MonadState Int m, MonadParsec e s m, Token s ~ Char) => m _' into a type synonym somehow, or something like that so that I don't have to keep re
12:44 <jchia_1> peating the same lengthy context in the code? It seems that type synonyms cannot have constraints. Is ConstraintKinds relevant?
12:44 primal__1 joined
12:45 kmels joined
12:45 luckymerlin joined
12:45 <jchia_1> I mean "return type" instead of "return value"
12:45 crobbins_ joined
12:46 mkoenig joined
12:46 theelous3 joined
12:47 <ski> jchia_1 : try `type Foo a = forall m e s. (MonadState Int m, MonadParsec e s m, Token s ~ Char) => m a' ?
12:48 valkyr2e joined
12:48 <ski> (or `type Foo m e s a = (MonadState Int m, MonadParsec e s m, Token s ~ Char) => m a', if you prefer being able to "access" `m',`e',`s')
12:48 xtreak joined
12:49 <jchia_1> ski: Thanks, it seems that the existential quantification was needed.
12:49 <jchia_1> I'm not sure why, though.
12:49 <Philonous> You can also just synonym the constraint: type Foo m e s a = (MonadState Int m, MonadParsec e s m, Token s ~ Char), adn then use it like forall e s m. (Foo e s m) => m ()
12:50 Gurkenglas joined
12:50 <Philonous> (needs -XConstraintKinds though)
12:50 <ski> jchia_1 : that's a universal quantification, not an existential quantification
12:52 <ski> you'd use existential quantification, if you'd go with Philonous variant, only not parameterizing on `e',`s', iow `Foo m = exists e s. (MonadState Int m, MonadParsec e s m, Token s ~ Char)', and then use `forall m. Foo m => m a' ..
12:52 <ski> .. except there is no `exists' keyword
12:52 <ski> (but conceptually this'd work)
12:52 navilan joined
12:53 <jchia_1> ski: I was under the impression that when forall is used in the code, it's because the ExistentialQuantification extension is being used, no?
12:53 <ski> (the point is that `(exists a. ..a..) -> ...' is equivalent to `forall a. (..a.. -> ...)', and also `(exists a. ..a..) => ...' is equivalent to `forall a. (..a.. => ...)' .. in this case, it's the latter equivalence that i referred to)
12:53 <c_wraith> jchia_1: only if it's being applied to a constructor
12:53 <merijn> jchia_1: No, there's others, such a RankNTypes and ExplicitForall and ScopedTypeVariables
12:54 <ski> jchia_1 : sometimes, sometimes not
12:54 <c_wraith> You can also encode existentials by CPS transforming with RankNTypes
12:54 mmn80 joined
12:54 <ski> jchia_1 : `ExistentialQuantification' enables one approach to *encode* `exists', by reformulating (via the equivalences i mentioned) into using `forall' instead
12:55 fenedor joined
12:55 <ski> jchia_1 : there's also another encoding of `exists', that doesn't rely on the `ExistentialQuantification' extension (which imho is a misnomer)
12:55 <ski> (c_wraith mentioned the other encoding that's in use)
12:56 <ski> `forall' is always universal quantification, never existential quantification
12:56 <ski> if one writes
12:56 binaryplease joined
12:56 <ski> data QueueOps a = forall q. MkQO (q,a -> q -> q,q -> Maybe (q,a)) -- empty queue, enqueue, dequeue
12:57 <jchia_1> I think I need to read a paper or a textbook on this.
12:57 <ski> then this means that the type signature of the data constructor `MkQO' will be
12:57 <ski> MkQO :: forall q. (q,a -> q -> q,q -> Maybe (q,a)) -> QueueOps a
12:57 <ski> in order to construct a value of type `QueueOps a'
12:58 <ski> .. in fact, since this works for *any* type `a' (the parameter), it's really
12:58 <ski> MkQO :: forall a q. (q,a -> q -> q,q -> Maybe (q,a)) -> QueueOps a
12:58 <ski> however, the type signature
12:58 <ski> MkQO :: forall a. forall q. (q,a -> q -> q,q -> Maybe (q,a)) -> QueueOps a
12:58 binaryplease joined
12:58 <ski> is equivalent, via the equivalence i mentioned, to
12:58 <ski> MkQO :: forall a. (exists q. (q,a -> q -> q,q -> Maybe (q,a))) -> QueueOps a
12:59 joelburget_ joined
12:59 <ski> so that a value of type `QueueOps a' conceptually wraps a value of type `exists q. (q,a -> q -> q,q -> Maybe (q,a))' -- and there's your existential !
12:59 <ski> the existential `exists q. ..q..' here is encoded, by means of a `forall'
13:00 <ski> more specifically, the data constructor `MkQO :: (exists q. ..q..) -> ...' is encoded as `forall q. (..q.. -> ...)'
13:00 <ski> jchia_1 : does that make any sense ?
13:00 <Unode> Hi all, someone was asking about stack versions the other day. Can someone help me understand this dependency failure: "base- must match >=4.5 && <5 && <0"
13:00 <ski> jchia_1 : would it help if i tried to give some intuition of what a type `exists q. ..q..' means ?
13:00 <c_wraith> Unode: it means something has declared a broken dependency. Nothing should depend on base < 0
13:01 <ski> (`exists q. ..q..' is the actual type that i'd call an "existential type")
13:01 <Unode> c_wraith: I'm wondering where is this coming from.
13:01 joelburget joined
13:01 <Unode> On my cabal I simply have 'base' without a version specified.
13:01 <c_wraith> Unode: some transitive dependency somewhere. I'd know how to track it down using cabal, but not stack.
13:03 <Unode> c_wraith: ok, thanks. Knowing how to handle these would be helpful.
13:03 <Unode> I don't really know what to do from here.
13:03 <c_wraith> see if there's a verbose flag.
13:03 <lpaste> merijn pasted “Tight monadic loop?” at http://lpaste.net/355357
13:03 joelburget joined
13:03 joelburg1t joined
13:03 <merijn> I need some extra eyeballs
13:03 <c_wraith> Cabal will tell you exactly where every constraint comes from if you add -v
13:03 primal joined
13:03 primal_ joined
13:03 <merijn> Will that loop run efficiently, e.g, in constant space?
13:04 primal__2 joined
13:04 <c_wraith> in IO, yes
13:04 <merijn> c_wraith: It's IO, yes
13:04 <c_wraith> well, assuming n and i are Int or Integer
13:04 <merijn> Also yes :)
13:04 <c_wraith> then yeah, that should be constant space
13:04 macrover joined
13:04 <merijn> Just a spinloop on atomic-primops counter
13:05 directhex1 joined
13:06 ziyourenxiang joined
13:07 luckymerlin joined
13:08 <Unode> c_wraith: verbose doesn't add much :(
13:08 sproingie joined
13:08 sproingie joined
13:09 <merijn> Unode: "-v3" is what you want for troubleshooting cabal
13:09 <merijn> oh, wait, stack...ignore me
13:09 cdg joined
13:09 <Unode> :)
13:09 <c_wraith> ah, I can never remember if cabal wants -v3 or -vvv
13:10 dhil joined
13:10 <c_wraith> so I always try both
13:10 darlan joined
13:11 teto joined
13:14 primal__ joined
13:14 primal___ joined
13:14 primal__1 joined
13:14 uglyfigurine joined
13:15 chlong joined
13:16 <merijn> eh...
13:16 systadmin joined
13:16 <jchia_1> ski: Thanks. I think I lack background understanding of this topic. Is this something like set theory where the items are types?
13:16 <merijn> This is a new GHC error...
13:16 <merijn> "Undefined symbols for architecture x86_64:
13:16 <merijn> "_add_and_fetch_word", referenced from:"
13:16 <jchia_1> ski: And I understand the exists and forall the same way as in set theory?
13:16 <c_wraith> that looks like a linker error
13:17 binaryplease joined
13:17 <merijn> ah, found the issue, I think
13:17 <merijn> atomic-primops-foreign is broken
13:17 fenedor joined
13:18 <merijn> Or rather, bits-atomic is, I guess
13:19 <c_wraith> only a 32-bit version of it?
13:19 <merijn> c_wraith: bits-atomic supposedly uses GCC's builtin atomics, but on OSX I don't have GCC, of course. Somehow it compiled/installed but seems to refer to symbols that don't exist when linking
13:19 juhp_ joined
13:19 juhp_ joined
13:20 fosterite joined
13:20 <c_wraith> Ah, that's a bit of an issue.
13:20 guiben joined
13:20 <merijn> meh
13:20 <merijn> I'll just stick to atomic-primops then
13:20 takle joined
13:20 <jchia_1> Is there something like withReaderT for StateT?
13:20 <jchia_1> maybe lens is needed?
13:21 <ski> jchia_1 : they are similar to the corresponding quantifiers in logic
13:21 <ski> jchia_1 : a value having type `forall a. ..a..' means that for any type `a', it can be treated as having type `..a..'
13:22 dfeuer joined
13:22 <jchia_1> ski: So the '=>' corresponds to the implies symbol (->) from logic?
13:22 <srhb> @index withStateT
13:22 <lambdabot> Control.Monad.Trans.State.Strict, Control.Monad.Trans.State.Lazy, Control.Monad.Trans.State
13:22 <jchia_1> srhb: How come mtl doesn't have it?
13:23 <srhb> jchia_1: Because it's a transformers thing.
13:23 <ski> jchia_1 : e.g. `Nothing' has type `forall a. Maybe a'. this means that e.g. picking `a' as `Either String (Int -> IO [b])' (assuming `b' is in scope), we *can* treat `Nothing' as having type `Maybe (Either String (Int -> IO [b]))'
13:23 <c_wraith> jchia_1: https://hackage.haskell.org/package/mtl-2.2.1/docs/Control-Monad-State-Strict.html#v:withStateT
13:23 <srhb> ... guess not.
13:23 <c_wraith> that sure looks like mtl has it
13:23 <srhb> Indeed. :)
13:23 <ski> jchia_1 : `length :: forall a. ([a] -> Int)' means that for any type `a', if we apply `length' to an argument of type `[a]', then the result will have type `Int'
13:23 splanch joined
13:23 <c_wraith> jchia_1: Note that if you want a type-changing variant, then you do want lens. That's what the zoom function in lens does
13:24 primal joined
13:24 <lemonxah> any big companies running haskell?
13:24 primal_ joined
13:24 <lemonxah> for more than just 1 system
13:24 primal__2 joined
13:24 petermw joined
13:24 <jchia_1> c_wraith: OK. Somehow my local hoogle doesn't show it.
13:24 <c_wraith> that seems like a weird qualification
13:24 <ski> jchia_1 : otoh, a value having type `exists a. ..a..' means that there *exists* some type `a' such that the value actually has type `a' .. but we've currently forgotten which type `a' that was
13:24 <jchia_1> ski: I think I understand the basic meaning
13:24 <c_wraith> lemonxah: but even with that weird qualification, the most obvious case is facebook.
13:25 <jchia_1> c_wraith: I do want type changing, e.g. focusing on fst of a tuple.
13:25 <c_wraith> jchia_1: then yeah, you want zoom from lens
13:25 im0nde joined
13:25 <lemonxah> no i meant like some people use haskell for like 1 small thing no eco system
13:25 <ski> jchia_1 : `length :: (exists a. [a]) -> Int' means that as long as there *exists* some type `a' such that the argument has type `[a]', then applying `length' to that argument will yield a result of type `Int'
13:25 <lemonxah> if that makes sense maybe i am just not asking it correctly
13:25 <c_wraith> lemonxah: facebook uses haskell for several large things
13:26 dan_f joined
13:26 northfurr joined
13:26 <jchia_1> ski: Haskell has 'forall'. Can you type 'exists' in haskell?
13:26 uuplusu joined
13:26 <ski> jchia_1 : this is another valid way to think about the type of `length', which hopefully illustrates the logical equivalence between `(exists a. ..a..) -> ...' and `forall a. (..a.. -> ...)' (and similarly for `=>' instead of `->') that i mentioned
13:26 sullyj3 joined
13:26 <c_wraith> jchia_1: technically... ghc has 'forall'. UHC has an extension that enables 'exists', but it's not very useful.
13:27 <Grisha> how do best I type-parameterize a function a -> b -> b -> … -> b -> c (n times b, including n=0)?
13:27 <c_wraith> jchia_1: Haskell as a standard has neither.
13:27 <c_wraith> Grisha: isn't that exactly what lists are for? a -> [b] -> c ?
13:27 <ski> jchia_1 : no, but imho, it helps to think concetually in terms of such an `exists' quantifier (as c_wraith says, UHC (and LHC) supports it, but only in a restricted way, that's not that useful)
13:27 jathan joined
13:27 <Grisha> c_wraith: you’re right, omg
13:27 <c_wraith> Grisha: :)
13:28 <Grisha> c_wraith: I’m deeply in type families now, started thinking about type-valued lists
13:28 teto joined
13:28 <srhb> lemonxah: Facebook, Galois, for instance.
13:28 <srhb> Woops, lag.
13:29 <Grisha> c_wraith: on a second thought
13:29 <ski> jchia_1 : just like `=>' (with left operand being a constraint) corresponds in some sense to `(->)', i find it helpful to also postulate a construction `*>', corresponding to `(,)'
13:29 <sullyj3> So, I've googled a bit, and all the methods I've seen of getting the text of a web page have been severely wordy. Is there anything that comes close to python's ```import urllib.request; with urllib.request.urlopen(url) as response: html = response.read()```?
13:29 <Grisha> c_wraith: I need a family of functions that (depending on the governing type) work on zero, one, two or more String inputs
13:30 <ski> jchia_1 : given a value of type `Cxt => T', *if* you can *provide* evidence of `Cxt', you can treat it as a value of type `T'
13:30 <c_wraith> Grisha: oh, so you want the count to be determined by some other factor?
13:30 mmachenry joined
13:30 <ski> jchia_1 : given a value of type `Cxt *> T', you're provided *both* with evidence for `Cxt', and can get value of type `T'
13:30 soniku joined
13:30 dsfox joined
13:31 <ski> jchia_1 : `=>' would usually be preceded by a `forall'. and `*>' would usually be preceded by an `exists'
13:31 justin2 joined
13:31 <Grisha> c_wraith: exactly
13:31 robatosan joined
13:32 <Grisha> c_wraith: depending on whether a private address, business, government and so on, my makeAddress func should accept different number of fields which are to be combined into the final address
13:32 <ski> jchia_1 : the logical equivalence here is between `(Cxt *> T) -> U', and `Cxt => (T -> U)' .. you can think of this as some kind of currying, roughly (which is also how you can think of the equivalence between `(exists a. ..a..) -> ...' and `forall a. (..a.. -> ...)')
13:32 <ski> jchia_1 : does this make any sense ?
13:32 <Grisha> c_wraith: but there might be another solution for that I guess
13:33 <ski> (btw, note that `(T,U) -> V' is equivalent to `T -> (U -> V)', via currying)
13:33 <c_wraith> Grisha: if you know which you're creating ahead of time, you're probably best off just having different functions for each. If you don't know which you're creating ahead of time, you're getting into the realm of dependent types.
13:33 <Grisha> c_wraith: i’d like to explore the realm
13:34 <Grisha> since the rest of my code is already there
13:34 <Grisha> but it’s new to me
13:34 guardianJ joined
13:34 im0nde joined
13:34 primal__ joined
13:34 primal___ joined
13:34 <c_wraith> It's pretty painful in haskell right now. There's a reason they call it hasochism
13:34 zargoertzel joined
13:34 primal__1 joined
13:35 <c_wraith> And that's related to why I'm putting off learning the details until -XDependentHaskell is up and running. :)
13:35 <sullyj3> Grisha: Have you heard of Idris?
13:35 <Grisha> c_wraith: I could join the dark side alright
13:35 <Grisha> sullyj3: just heard of it
13:35 <jchia_1> ski: I think I got the forall and exists conversion, but don't understand what the *> means.
13:36 umib0zu joined
13:36 jangsutsr joined
13:36 <EvanR> dependent types may cause such side effects as brain exploding, antisocial mathematical behavior, or PhD's
13:36 <c_wraith> Grisha: all I know is that if you're planning to work with this stuff in current ghc, the singletons library does a lot of work for you. https://hackage.haskell.org/package/singletons
13:36 <c_wraith> I do *not* know how to use it. :)
13:36 <Grisha> c_wraith: I see, thanks a lot
13:36 <ski> jchia_1 : consider `data Showable = forall a. Show a => Wrap a'. this means that
13:36 vlatkoB joined
13:36 <ski> Wrap :: forall a. (Show a => (a -> Showable a)) -- brackets added for emphasis
13:36 <ski> er, sorry, should be
13:37 <ski> Wrap :: forall a. (Show a => (a -> Showable)) -- brackets added for emphasis
13:37 <Grisha> c_wraith: does it go beyond type families and funcdeps?
13:37 LHoT10820 joined
13:37 <ski> (no `a' parameter for `Showable'
13:37 <jchia_1> I have a more concrete problem, though, about why GHC sometimes requires forall and sometimes not: http://lpaste.net/355358
13:37 <ski> )
13:37 <ski> jchia_1 : anyway, using one equivalence, we get
13:37 <ski> Wrap :: forall a. (Show a *> a) -> Showable)
13:37 meba joined
13:37 <c_wraith> Grisha: it gives you tools to make types depend on runtime values. That's all I know about it.
13:38 <ski> you can think of the argument of type `Show a *> a' here as both providing evidence for `Show a', as well as actually giving a value of type `a'
13:38 <merijn> hmmm
13:38 <ski> next, using the `exists'-`forall' equivalence, we get
13:38 <ski> Wrap :: (exists a. (Show a *> a)) -> Showable
13:38 `^_^v joined
13:38 <Grisha> c_wraith: my problem is much more humble, I guess. I’ve got a function makeAddress that accepts a number of Strings and produces a String. The number of Strings is parameterized by a type
13:38 <ski> which shows that the type `Showable', conceptually, is wrapping the type `exists a. Show a *> a'
13:39 <Grisha> c_wraith: I thought it was a straight-forward exercise in type families
13:39 ystael joined
13:39 <EvanR> Grisha: you an use typeclasses to encode what this number is
13:39 <c_wraith> Grisha: well.. Sort of. You also need the implementation to vary, which implies you'll need a class
13:39 <Grisha> EvanR: I’m doing it currently
13:39 <Grisha> yes, ppl, that’s what I’m doing
13:40 pie_ joined
13:40 <zaquest> Grisha, you probably could use something like fixed-vector for this specific task, avoiding singletons.
13:40 <Grisha> I’ve got smth like `class Address a where type ParametersOfAddressMaker a`
13:40 <ski> jchia_1 : in the case of `bar :: (Monad m,Num b) => b -> m b', that's an *abbreviation* of `bar :: forall m n. (Monad m,Num b) => b -> m b', which kicks in at the "toplevel" of a type *signature* (right after the `::'), and which automatically `forall'-quantifies all type variables which appear to be free in the type signature, and which aren't already in scope
13:41 <ski> jchia_1 : for an example of the exception at the end, consider
13:41 <ski> @src Functor
13:41 <lambdabot> class Functor f where
13:41 <lambdabot> fmap :: (a -> b) -> f a -> f b
13:41 <ski> where, the method signature abbreviates
13:41 <Grisha> and makeAddress :: Address a => Proxy a -> (ParametersOfAddressMaker a) -> String
13:41 <ski> fmap :: forall a b. (a -> b) -> f a -> f b
13:41 <ski> (note `f' is not included in the `forall', since `f' is already in scope, bound in the head of the `class' declaration)
13:41 stphrolland joined
13:41 OnkelTem joined
13:42 ystael_ joined
13:42 <stphrolland> liste: about aeson and defining ToJSON and FromJSON when some field name are problematic, I have this error I cannot deal with: Failed to load interface for ‘Data.Aeson.Types.Internal’ it is a hidden module in the package ‘aeson-’
13:42 <ski> however, if we consider `fmap' not as a *method* signature belonging to `Functor f', but as "just another type signature", then we add the class "head" `Functor f' as a constraint, and universally quantify the class parameter(s) :
13:43 <ski> fmap :: forall f. Functor f => forall a b. (a -> b) -> f a -> f b
13:43 <ski> which is the same as
13:43 <ski> fmap :: forall f a b. Functor f => (a -> b) -> f a -> f b
13:43 <Grisha> stphrolland: you’ve got to include it explicitly in the dependency list in your .cabal file
13:43 <ski> jchia_1 : ok ?
13:43 <Grisha> stphrolland: i.e. the module `aeson`
13:44 primal joined
13:44 primal_ joined
13:44 <stphrolland> aeson is already in build-depends section of my cabal file ?!
13:44 primal__2 joined
13:44 <ski> (if the `class' head has any context, like in `class Eq a => Ord a where ...', then that context, here `Eq a', is not added to the signatures of the methods, only the actual class we're defining, applied to the parameters, here `Ord a')
13:45 jg_ joined
13:45 <jchia_1> ski: I still don't know what *> really means, but I get that for type declarations, GHC automatically adds the forall. Why doesn't it do it for type synonyms, though? Is there a good logical reason?
13:45 petermw joined
13:45 <Grisha> stphrolland: do you have separate library and executable sections in .cabal?
13:45 chrisM_1 joined
13:45 <stphrolland> yes
13:45 <stphrolland> it is a stack project
13:46 <jchia_1> ski: I mean "type signature" instead of "type declaration"
13:47 <Grisha> stphrolland: that’s strange-o-matic, I usually get that error if the package has been installed as a dependency of another, but is not explicitely mentioned in .cabal
13:47 <ski> jchia_1 : if `exists' ever get added to GHC, it's not clear why an apparently unbound tyvar in a type synonym should abbreviate a `forall' quantificsation of it, rather than an `exists' quantification of it ..
13:47 <Grisha> stphrolland: so `aeson` should be in the right part, be it executable or library
13:48 <Grisha> stphrolland: depending on who’s using it
13:48 <ski> jchia_1 : the same thing also goes for `data' and `newtype', btw
13:49 <ski> jchia_1 : sometimes when one wants to declare a type, with some locally bound tyvar, one wants (conceptually) an existential quantification, sometimes a universal quantification (in both cases over one (or several) arguments of a data constructor, in the case of `data' and `newtype')
13:49 <stphrolland> it is in library, and no mention of it in executable, becuase my mian is relatively simple, calling the library
13:50 <Grisha> stphrolland: and the error pops up when compiling what?
13:50 cyborg-one joined
13:50 <ski> jchia_1 : otoh, for type signatures, it seems to be much more common to want universal rather than existential quantification, and so the former is allowed to be implicit (as long as it's quantified at the "toplevel", as i said)
13:50 <stphrolland> stack build, it compile the whole project, Main and Lib
13:51 <Grisha> stphrolland: it’s usually at least to different compile runs, one for Main.hs and one for Lib.hs. Which of those causes the error exactly?
13:51 <jchia_1> ski: OK
13:51 <ski> jchia_1 : btw, in some ways, i might prefer not having implicit quantification at all (whether universal or existential) .. but that's not the path Haskell took historically
13:51 <Grisha> stphrolland: s/to/two
13:52 <ski> (it would be a bit more verbose, and require newbies to grasp polymorphism (a polymorphic value is one which has a universal type) more fully, earlier)
13:53 <ski> (`Nothing' and `length' are polymorphic values. `forall a. Maybe a' and `forall a. ([a] -> Int)' i call "universal(ly quantified) types". note that a "polymorphic type" would be something else (namely a type having a *kind* of shape `forall k. ..k..'))
13:54 primal__ joined
13:54 primal___ joined
13:54 primal__1 joined
13:54 <c_wraith> ski: that would also require ditching non-GADT data syntax. Which I suppose you'd be fine with..
13:54 <stphrolland> Grishna: when it compiles one of the files used by Lib.hs
13:55 <ski> jchia_1 : .. i could try to explain a bit more about universal and existential quantification, their relation and uses, and how it's related to `ExplicitForall',`PolymorphicComponents',`Rank2Types',`RankNTypes',`ExistentialQuantification',`ScopedTypeVariables' (some of those are now obsolete)
13:56 <Grisha> stphrolland: are those files listed in the `library` section in your .cabal file? if so, is `aeson` included in `build-depends` in that section?
13:56 stphrolland_ joined
13:56 ChristopherBurg joined
13:56 <ski> jchia_1 : .. but i need to leave, presently. if you'd like to continue the conversation later, try to grab hold of me ?
13:56 <ski> c_wraith : why not something like `data forall a. Maybe a = Nothing | Just a' ?
13:57 <jchia_1> ski: Thanks for the explanation of forall and exists. Sure, I'll ping you if I have questions about these topics.
13:57 <c_wraith> ski: that doesn't make it very clear that the Nothing constructor is universally quantified.
13:58 <ski> for every type `a', `Nothing' has type `Maybe a'
13:58 <ski> seems pretty clear to me ..
13:58 n1k joined
13:58 DragonWolf_ joined
13:58 <ski> (and, for every type `a', if `x' has type `a', then `Just x' has type `Maybe a')
13:58 revtintin joined
13:59 RegEchse joined
13:59 Wizek joined
13:59 <c_wraith> ski: it's really not an improvement over the current situation. GADT syntax actually spells those things out explicitly, rather than making you memorize translation rules.
13:59 alfredo_ joined
13:59 <ski> well, i won't argue against that :)
14:00 jship joined
14:00 <EvanR> http://lpaste.net/355359 isnt this some kind of fold...
14:00 <ski> (the main gain of the traditional notation is (a) similarity with BNF; (b) not having to repeat the return type of the data constructors)
14:00 <c_wraith> ski: I also consider the concision to be an advantage
14:01 ystael_ joined
14:01 <ski> yes, that's the (b) part
14:01 <Philonous> Grisha, Here's one way of accomplishing what you wanted: https://gist.github.com/Philonous/637928bffd918ad5a6fcffb5f26a8d3f
14:01 <ski> and, i suppose, slightly shorter way to specify argument types ..
14:01 dhil joined
14:01 fendor joined
14:01 <c_wraith> EvanR: that's a foldl
14:01 <Grisha> Philonous: oh great, thank you!
14:01 <ski> c_wraith : .. only saying that i don't think "require explicit binding" couldn't be combined in a reasonably sensible way with the traditional notation
14:02 <Philonous> Grisha, I'm giving it the the argument type per address type, but you could just as well return nats and take a length-indexed vector with that length
14:02 <c_wraith> EvanR: and in particular, reverse = foldl (flip (:)) []
14:02 <EvanR> c_wraith: i got the effect with a foldl (flip (:)) but doesnt this traverse the first list
14:02 <Grisha> Philonous: I don’t understand it at the first glance, but gonna try to wrap my head around it
14:02 <EvanR> before even beginning
14:02 <c_wraith> no
14:02 <c_wraith> EvanR: they have the same behavior
14:02 <EvanR> uhm
14:03 <EvanR> oh ok
14:03 <EvanR> yeah i cant get anything out of the result until i go through the whole list
14:03 <EvanR> crud
14:03 <ski> btw, otoh i think `data Expr a where Val :: a -> Expr a; App :: Expr (a -> b) -> (Expr a -> Expr b)' is confusing, since the first `a' doesn't have anything to do with the `a' in `App' (and technically not with the `a' in `Val' either)
14:03 Elhamer_ joined
14:04 <c_wraith> EvanR: that's inherent in []. There's no way to get the last element without traversing everything before it
14:04 primal joined
14:04 primal_ joined
14:04 primal__2 joined
14:04 <c_wraith> EvanR: someone *did* write up a lazier reverse a while back, that would produce (:) constructors earlier. But it took just as long to reach the values, so it didn't have much practical value.
14:04 <ski> for this reason i prefer `data Expr :: * -> * where ...', only mentioning explicit parameters in the "head" if i'm actually using that same parameter in the same position in the data constructor return types
14:05 <c_wraith> ski: I agree with that assessment
14:05 systadmin joined
14:06 dfranke joined
14:06 <ski> (i suppose one could imagine `data Foo :: _ where ...' for cases when one doesn't want to have to specify the argument kinds)
14:06 Elhamer joined
14:07 Hunter1_ joined
14:07 Rodenbach joined
14:07 uuplusu joined
14:08 plutoniix joined
14:08 <Grisha> Philonous: would it work with zero Strings?
14:08 Elhamer__ joined
14:08 <* ski> disappears
14:09 <Rodenbach> 11 Mins, Functional Programming is outdated: https://www.youtube.com/watch?v=P0uAs9JRiqQ – Peter van Roy. I think that guy was very involved in Oz.
14:10 <Philonous> Grisha, Sure, just set the argument type to ()
14:10 <Grisha> I see, thanks
14:10 <Philonous> Grisha, The way this is encoded you can make it take _any_ argument type, so (Int, String, Bool) would be fair game too
14:14 luckymerlin joined
14:14 <Grisha> Philonous: and if there are zero args, would it be possible to make a constant out of it instead of a func?
14:14 primal__ joined
14:14 primal___ joined
14:14 primal__1 joined
14:14 tristanp_ joined
14:14 <Philonous> Grisha, Yes. Gimme a minute, I'll show you how
14:15 <Grisha> Philonous: would be great
14:17 flatmap13 joined
14:17 henriksod joined
14:17 uuplusu_ joined
14:17 <Philonous> https://gist.github.com/Philonous/637928bffd918ad5a6fcffb5f26a8d3f
14:19 jgertm joined
14:19 marfoldi joined
14:20 crobbins_ joined
14:20 jgertm joined
14:20 <jchia_1> I can apply Control.Lens.Zoom.zoom to a StateT but what about a MonadState where the StateT is somewhere in the middle of the stack? Is there something simple I can do for, say, ParsecT Dec Text (ConduitM Text (Int, Char) (SS.StateT (Int, HashMap (Int, Int) Text) m)) (), to change the 'state' part from '(Int, HashMap (Int, Int) Text)' to HashMap (Int, Int) Text?
14:21 BoBIzASlOb joined
14:21 Catmaster26 joined
14:21 <Catmaster26> Hi
14:21 <BoBIzASlOb> can somebody hack me and take down my internet?
14:21 <BoBIzASlOb> Please
14:21 <BoBIzASlOb> im begging you
14:21 <Catmaster26> Um
14:21 <Catmaster26> wot
14:21 <EvanR> clearly youre the same person
14:22 <BoBIzASlOb> I am with cat
14:22 <BoBIzASlOb> we are at school
14:22 <BoBIzASlOb> and take it down for us
14:22 <BoBIzASlOb> we got in troube
14:22 <Catmaster26> Um wot are you saying mate
14:22 <BoBIzASlOb> HACK ME
14:22 <BoBIzASlOb> HACK ME
14:22 <BoBIzASlOb> HACK ME
14:22 <BoBIzASlOb> HACK ME
14:22 <shiona> :D
14:23 fendor joined
14:23 teto joined
14:24 primal joined
14:24 hsk3 joined
14:24 <Grisha> Philonous: thanks a lot, I’m meditating over it
14:24 primal_ joined
14:24 uuplusu joined
14:24 primal__2 joined
14:25 <hsk3> Grisha haskell is all about meditation
14:25 <Philonous> Grisha, Do you understand what's going on there or do you want me to elaborate?
14:25 rblaze joined
14:25 <Grisha> Philonous: I kind of understand the idea, but have to look into the singleton library first
14:26 <ph88_> in attoparsec are there more ways i can make the parser fail, or only fail :: String -> m a ?
14:26 <lpaste> jimmy pasted “prompt” at http://lpaste.net/355361
14:26 <merijn> ph88_: empty
14:26 <merijn> :t empty
14:26 <lambdabot> Alternative f => f a
14:27 <merijn> ph88_: And, as a consequence also
14:27 <merijn> :t guard
14:27 <lambdabot> Alternative f => Bool -> f ()
14:27 <ph88_> what's empty ?
14:27 <sullyj3> hey guys, why is it that when I run main, my prompt message isn't printed until I've typed my input and hit enter, but when I run prompt from the repl it works as expected?
14:27 <ertes-w> Rodenbach: other than the usual bullshit reasoning people use against FP i couldn't find much else in that video
14:27 <sullyj3> sorry, I'm jimmy ^^^
14:27 <merijn> ph88_: Do you know MonadPlus?
14:27 <ph88_> no
14:28 <ph88_> what's guard as well ?
14:28 <merijn> ph88_: ok, basically Alternative is a Monoid on Applicative's
14:28 <ertes-w> "FP doesn't work as well as OOP in the real world, because look, i can point to many objects in this room, but you can't point to a single function"
14:28 <ertes-w> that kind of bullshit
14:28 <ph88_> oh ok
14:28 <glguy> sullyj3: buffering mode defaults are different in ghci. see hSetBufferingMode and hFlush
14:28 <merijn> ph88_: So you have "mappend :: Monoid m => m -> m -> m" and "mempty :: Monoid m => m" with mempty being the left and right identity of mappend
14:28 NyanPasu joined
14:29 <glguy> ertes-w: pointing oriented programming sounds interesting
14:29 <merijn> ph88_: Alternative has "(<|>) :: Alternative f => f a -> f a -> f a" with "empty :: Alternative f => f a"
14:29 mizu_no_oto joined
14:29 <stphrolland_> Grishna: it seems I fixed the error importing Data.Aeson.Types instead of Data.Aeson.Types.Internal, just for your information.
14:29 uuplusu joined
14:29 <sullyj3> glguy: perf thanks
14:30 <merijn> ph88_: Common class for things like parsers, where "empty <|> foo = foo = foo <|> empty"
14:30 max3 joined
14:30 carlomagno joined
14:30 <ph88_> so it just means the parser doesn't yield anything ?
14:30 <jchia_1> merijn: is <|> required to be associative like <>?
14:30 <merijn> jchia_1: Yes
14:31 <max3> this is probably a n00b question but how is it possible that Crypto.BCrypt returns True for validiatePassword for the same plain text but two different hashes
14:31 <jchia_1> merijn: So it's a law that you have to ensure when making an instance of Alternative, correct?
14:31 <merijn> jchia_1: Correct
14:31 uuplusu_ joined
14:32 soniku joined
14:32 eliasr joined
14:32 <jchia_1> merijn: Is there a commonly-enough used thing that has both Alternative and Monoid instances?
14:32 <glguy> []
14:32 <ertes-w> more like pointing-oriented opinion persuation
14:32 <ertes-w> or POOP
14:33 <merijn> jchia_1: Also, attoparsec's Parser is both a Monoid and Alternative, iirc
14:33 robkennedy joined
14:33 <ph88_> merijn, what's guard then ?
14:33 <merijn> ph88_: "\b -> if b then pure () else empty"
14:33 bigos_ joined
14:33 <nshepperd> neither FP nor OOP work in the real world, because the real world isn't a program that you can modify by pure thought and pointing
14:34 <merijn> oh, attoparsec has a stupid monoid isntance
14:34 <Philonous> Grisha, Well, we want the _values_ Private and Business to be available at the type level, so the result type can depend on them. Unfortunately, Haskell doesn't allow that (yet). So instead we create new values SPrivate and SBusiness with the type (Sing private) and (Sing Business) respectively. They act as a sort-of bridge between values and types, because whenever we see SPrivate we know it has type (Sing Private), and whenever we see
14:34 <Philonous> (Sing Private) we know the only possible value is SPrivate
14:34 primal__ joined
14:34 primal___ joined
14:34 <nshepperd> none of the objects in my room have runnable methods either
14:34 tomboy65 joined
14:34 primal__1 joined
14:34 <ph88_> merijn, i don't understand the difference between pure () and empty
14:34 <merijn> jchia_1: Trifecta's Parser shows an interesting distinction
14:34 <ertes-w> i've never told my apple to be eaten by me
14:34 <jchia_1> It seems that for [], <|> and <> mean the same thing. Is there something where they mean different things?
14:35 <Grisha> Philonous: I thought rather making Business and Private separate data types and dispatch on them
14:35 <Grisha> *about
14:35 <merijn> jchia_1: Yes, Trifecta, because it has "instance Monoid a => Monoid (Parser a)" and "instance Alternative Parser"
14:35 teto joined
14:35 <Philonous> Grisha, So when we pattern match on the first argument and see that it is SPrivate, the type checker concludes that the type must have been (Sing Private), hence the type variable 'at' is Private, so the return type is (AddressParts at), which is String
14:35 <merijn> jchia_1: So, for example, "foo <> foo <> foo" parser foo 3 times and then mappend's the results
14:36 <EvanR> oop is good for motivating new programmers to begin actual writing of code, convincing them that there is a tangible goal, to model real devices somehow
14:36 <jchia_1> merijn: I see the difference
14:36 <nshepperd> ph88_: mempty is 0, pure () is 1
14:36 <Philonous> (AddressParts Private), I mean
14:36 <merijn> jchia_1: Whereas "foo <|> bar <|> baz" first tries to parse foo, if it fails, it tries bar, etc.
14:36 <EvanR> the difficulties that come after this point are not apparent and not part of the narrative
14:36 <merijn> jchia_1: Also, Maybe is different, I think
14:36 <jchia_1> merijn: So there's no way to intuit what <|> or <> do for each case, and you just have to experiment or read tho docs to make sure, right?
14:36 <merijn> jchia_1: Right
14:36 eschnett joined
14:36 <ph88_> nshepperd, i don't understand that either .. what does 0 and 1 mean in context of attoparsec
14:37 <Philonous> Grisha, You can make them types (i.e. *) and use classes, that's the classical way of achieving this, yes. It also has the advantage of being open, i.e. you can add more types later
14:37 <merijn> jchia_1: In fact, fun fact: each applicative is, by definition at least 2 different Monoids :)
14:37 armyriad joined
14:37 <merijn> jchia_1: Since you can trivially define "mempty = pure mempty; mappend = liftA2 (<>)"
14:37 fizruk joined
14:38 <merijn> jchia_1: And, of course, "mappend = liftA2 (flip (<>))"
14:38 sproingie joined
14:38 afarmer joined
14:38 <nshepperd> ph88_: empty is a parser that always fails. it produces 0 outputs. pure () is a parser that always succeeds. it produces 1 output, namely ()
14:38 <Philonous> Grisha, You couldn't pattern-match on them then, though, because you can only pattern match on values, not on types.
14:39 <ph88_> nshepperd, is fail like emtpy + i can supply a string ?
14:39 cschneid_ joined
14:40 <nshepperd> ph88_: yeah, normally parsers let you fail with an error message
14:40 <nshepperd> I suppose empty uses a default error message of some kind
14:40 <ph88_> ok
14:40 mrkgnao joined
14:42 robatosan joined
14:42 luckymerlin joined
14:43 Elhamer_ joined
14:43 luckymerlin joined
14:44 primal joined
14:44 primal_ joined
14:44 primal__2 joined
14:44 <Grisha> Philonous: thanks a lot once again, have to disconnect now
14:44 <Philonous> yw
14:44 <ertes-w> EvanR: problem is that people tend not to switch paradigms, because they don't think of the problems they face as inherent to their paradigm… instead they start coming up with "solutions" in order to "fix programming"… before you know it, you have factories, facades and directory structures so deep that you could drown trying to find a single semantically meaningful line among the "solution" noise
14:44 dsh joined
14:45 augur joined
14:45 <jchia_1> :t (take 0) (many "a")
14:45 <lambdabot> [[Char]]
14:45 <EvanR> well there is semantic meaning to oop
14:45 <jchia_1> :t fmap (take 0) (many "a")
14:45 <lambdabot> [[Char]]
14:45 <ertes-w> EvanR: nice one =)
14:45 <jchia_1> How come with fmap it's still the same type?
14:46 <EvanR> theory of objects, etc
14:46 <EvanR> not sure how much that matters in practice
14:46 IanKelling joined
14:46 <ertes-w> anyway, enough ranting for today =)
14:47 macrover joined
14:47 <jchia_1> Never mind
14:48 balor joined
14:48 <jchia_1> How can I understand what some & many mean for []? I'm looking at the default definition but not getting anything.
14:49 <merijn> jchia_1: Honestly, some/many aren't really useful for []
14:49 <merijn> jchia_1: They simply result in infinite loops :)
14:49 <jchia_1> merijn: I got an infinite loop.
14:49 <merijn> jchia_1: Right, hence why not so useful ;)
14:49 <jchia_1> merijn: Even if I (take 1) I get an infinite loop.
14:49 <merijn> jchia_1: some/many only really make sense for Alternative's that fail after some number of repetitions
14:49 <nshepperd> i don't think they mean anything, per se
14:50 ChaiTRex joined
14:50 <merijn> jchia_1: For example, for parsers
14:50 <jchia_1> merijn: I get the meaning for parsers.
14:51 <merijn> jchia_1: I spent an hour or so staring at the implementation until I understood why [] infinite looped and concluded: they make zero sense for the list alternative :)
14:52 pera_ joined
14:53 <jchia_1> merijn: An hour well spent?
14:54 <jchia_1> If some & many mean nothing for [] and <|> means the same as <>, why bother making Alternative instance for []?
14:54 primal__ joined
14:54 primal___ joined
14:54 <merijn> jchia_1: Well, because it's lawful, so why not? :)
14:54 primal__1 joined
14:54 <EvanR> o_O
14:54 <jchia_1> merijn: But when is it useful?
14:55 <EvanR> bottom is lawful now?
14:55 <nshepperd> so that you can use 'guard' in a list monad
14:55 <jchia_1> I can always choose the Monoid instance
14:55 <merijn> jchia_1: Well, it's a superclass of MonadPlus and MonadPlus is useful
14:55 <merijn> EvanR: some/many don't have laws
14:56 <merijn> EvanR: They're implemented using <|> and empty, it's just that the way <|> and empty work for list doesn't produce useful code for some/many
14:56 <merijn> EvanR: This doesn't make list's alternative unlawful, nor does it make some/many useless :)
14:56 <nshepperd> some might say that some & many should be in a different class so they would only be available where it makes sense
14:56 <lpaste> hexagoxel pasted “CZip” at http://lpaste.net/355362
14:57 <nshepperd> but then again 'many (pure 1)' is bottom even for parsers, so whatever
14:57 bencryption joined
14:58 fendor joined
14:58 <hexagoxel> the above CZip class seems to have some similarity to a "lifted" Distributive. Does this make sense? Does this "lifting" have a proper (CT?) name?
14:58 <hexagoxel> Distributive as in http://hackage.haskell.org/package/distributive-0.5.2/docs/Data-Distributive.html#t:Distributive
14:59 Dookie12 joined
14:59 jleon joined
15:00 flatmap13 joined
15:00 teggi joined
15:00 PlasmaStar joined
15:01 eklavya joined
15:01 justin2 joined
15:01 <rightfold> Is there a way to disable let generalization so that typed holes in let/where bindings become useful?
15:01 sellout- joined
15:02 student001 joined
15:02 jleon joined
15:02 <lyxia> https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#ghc-flag--XMonoLocalBinds may help
15:02 <merijn> rightfold: Might be easier to insert holes directly in the expression and only move them to there where/let when you start implementing (although not really a solution, I know)
15:02 <jchia_1> Regarding the MonadPlus instance for IO, v >> mzero = mzero, but if v is 'putStrLn "abc"', I get some console output before the exception from mzero. How can you say that v >> mzero and zero are equal?
15:02 nickolay joined
15:03 <jchia_1> mzero just throws an exception without printing "abc"
15:03 sfcg joined
15:03 n1 joined
15:03 guampa joined
15:03 shangxiao joined
15:03 <merijn> jchia_1: mzero is the left identity of mplus, not of >>
15:04 primal joined
15:04 94KAAR0F4 joined
15:04 92AAA1JVJ joined
15:04 jer1 joined
15:04 oisdk joined
15:04 gehmehgeh joined
15:04 <jchia_1> merijn: There are two things mzero needs to satisfy: http://hackage.haskell.org/package/base-
15:05 <merijn> jchia_1: hmmm
15:05 <jchia_1> v >> mzero = mzero is one of them
15:06 <rightfold> merijn: Perhaps MonoLocalBinds will help. I think I'd like that anyway.
15:06 <merijn> jchia_1: You're right, actually
15:06 <merijn> jchia_1: IO didn't use to be an instance of MonadPlus, I wonder when they added that...
15:06 kritzcreek joined
15:07 michaelw joined
15:07 <rightfold> Applying for a Haskell job tomorrow, excited.
15:07 <merijn> Looks like they added it in 4.9
15:08 ridho joined
15:09 Wuzzy joined
15:10 <quchen> MonadPlus’ laws are awkward :-(
15:10 <nshepperd> yeah, that law doesn't look right
15:10 <nshepperd> 'u >> mzero >> v = u >> mzero' would be more accurate, for IO anyway
15:10 <rightfold> MonadPlus IO is not lawful.
15:11 ridho joined
15:11 <nshepperd> that says that 'u >> mzero' is a zero-like thing, but doesn't necessarily have to be mzero itself
15:11 <rightfold> Oh wait, maybe it is.
15:11 heurist` joined
15:12 <lyxia> print () >> mzero prints something, mzero doesn't
15:13 <merijn> Looks like they added it to remove orphans from base to make it work for transformers?
15:13 wonko7 joined
15:14 primal_ joined
15:14 primal__ joined
15:14 primal___ joined
15:14 <nshepperd> '(u >> mzero) >>= f = u >> mzero' for full generality i suppose
15:16 cschneid_ joined
15:16 <rightfold> I like `(x <|> y) >>= f == (x >>= f) <|> (y >>= f)`
15:16 jer1 joined
15:16 <lyxia> why not simply mzero >>= f = mzero
15:17 FreeBirdLjj joined
15:17 <rightfold> lyxia: that's what PureScript does.
15:17 kmels joined
15:17 <jchia_1> I want to learn what all these instances of Alternative, MonadPlus etc do for different types like [] and IO. I go to hackage (http://hackage.haskell.org/package/base- and click on the 'Source' next to the '#' next to, say, 'MonadPlus (Proxy *)' under instances. This links to http://hackage.haskell.org/package/base- , which according to my browser is in
15:17 <jchia_1> the middle of nowhere. Is haddock broken or is it something about my browser?
15:17 <nshepperd> lyxia: that's also a law
15:18 <lyxia> nshepperd: I mean it's sufficient to derive yours
15:18 <nshepperd> lyxia: nope
15:19 MDA2 joined
15:19 <lyxia> (u >> mzero) >>= f = u >> (mzero >>= f)
15:19 oisdk joined
15:19 balor joined
15:20 <nshepperd> oh, ofc
15:21 <nshepperd> well then I don't see much need for the right zero law at all in that case
15:21 <hexagoxel> jchia_1: haddock. if you follow source from Proxy docs, it correctly points to http://hackage.haskell.org/package/base-; i don't think the 102 is a coincidence.
15:21 <lyxia> > let x = Just 0 ; y = Just (1 :: Int) ; f = guard . odd in ((x <|> y) >>= f, ((x >>= f) <|> (y >>= f))) -- rightfold
15:21 <lambdabot> (Nothing,Just ())
15:22 doomlord_ joined
15:22 <jchia_1> hexagoxel: Thanks
15:23 cschneid_ joined
15:23 tomphp joined
15:23 sirreal joined
15:23 <nshepperd> btw i think that mzero >>= f = mzero should be almost always true because of parametricity. mzero can be :: m Void, so you can't do anything useful with f because you can't produce a Void to pass to it
15:24 <nshepperd> not sure how to prove things like that though
15:24 primal joined
15:24 primal__1 joined
15:24 primal__2 joined
15:24 eacameron joined
15:25 sampuka joined
15:26 <jchia_1> hexagoxel: At first I thought the haddock bug could be circumvented, but it seems that the link on the type's page has the same problem, e.g. the 'Source' for the MonadPlus Maybe instance also points to the middle of nowhere. http://hackage.haskell.org/package/base-
15:27 <jchia_1> hexagoxel: Not always but at least sometimes.
15:27 <rightfold> lyxia: yeah
15:27 uuplusu joined
15:29 path[l] joined
15:29 nakal_ joined
15:30 <hexagoxel> jchia_1: it seems to point to this from the class and the type: http://hackage.haskell.org/package/base-
15:31 <hexagoxel> that's not nowhere, i see "instance MonadPlus Maybe" at top.
15:31 <jchia_1> hexagoxel: You're right. Basically, it's pointing to the default instance
15:32 beanbagula joined
15:32 <hexagoxel> right
15:32 <lyxia> for Proxy it looks like a bug
15:33 unyu joined
15:33 <lyxia> it should point to Data.Proxy
15:33 <hexagoxel> yeah, some of the reexporting confuses haddock probably for the MonadPlus source link for Proxy instance.
15:34 primal_ joined
15:34 primal__ joined
15:34 primal___ joined
15:35 <hexagoxel> but is the same "instance MonadPlus Proxy" only-defaults for Proxy.
15:36 balor joined
15:36 shivansh joined
15:36 shivansh left
15:36 JagaJaga joined
15:37 trism joined
15:38 tzh joined
15:38 splanch joined
15:39 systadmin joined
15:41 Wizek_ joined
15:43 dsh joined
15:44 uuplusu joined
15:44 primal joined
15:44 primal__1 joined
15:44 primal__2 joined
15:44 pja joined
15:44 NeverDie joined
15:45 augur joined
15:45 SuprDewd joined
15:46 panosk joined
15:46 panoskk joined
15:46 balor joined
15:47 jleon joined
15:49 etehtsea joined
15:49 DataComputist joined
15:50 hackebeilchen joined
15:50 kuribas joined
15:50 urodna joined
15:51 lavalike joined
15:54 primal_ joined
15:54 primal__ joined
15:54 primal___ joined
15:54 augur joined
15:55 ADG joined
15:55 SlashLife joined
15:55 noexcept_ joined
15:56 Elhamer__ joined
15:56 <ADG> using stack `ghc -- o bin/2.o src/2.hs` -O2 still produces `2.hi` and `2.o` in `src/`
15:57 <brynedwardz> Should it be -o not just o?
15:57 <ADG> yes it is -o
15:57 <brynedwardz> Oh ok
15:57 jmelesky joined
15:58 balor joined
15:59 <brynedwardz> https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/flags.html#redirecting-output
15:59 dm3 joined
15:59 <brynedwardz> Says you can use -hidir and -odir to set output directory for .hi and .o
16:01 _sg2 joined
16:01 ragepandemic joined
16:03 cloudhead joined
16:03 roconnor_ joined
16:03 rkazak joined
16:04 primal joined
16:04 primal__1 joined
16:04 primal__2 joined
16:05 fresheyeball joined
16:05 obadz joined
16:06 mmhat joined
16:07 <hsk3> Why can't I name my program hello-300 ?
16:07 <hsk3> hello-300.cabal name: hello-300 executable hello-300
16:07 <fresheyeball> hsk3: what happens if you run `cabal clean` first?
16:07 <hsk3> I get this error when doing "stack build": NoParse "name" 1
16:07 dbmikus joined
16:07 hackebeilchen joined
16:07 <hsk3> i'll try 1sec
16:08 Sonolin joined
16:08 flatmap13 joined
16:08 <fresheyeball> hsk3: or `stack clean` in your case
16:08 <hsk3> fresheyeball yeah. don't have cabal. tried stack clean. still same error
16:08 <hsk3> (i also tried manually doing rm -rf .stack-work)
16:08 slomo joined
16:09 <fresheyeball> can you paste your full cabal file via some paste service?
16:09 <fresheyeball> I think you might just have a syntax issue
16:09 <lyxia> "stack new hello-300" says: "Package names consist of one or more alphanumeric words separated by hyphens. To avoid ambiguity with version numbers, each of these words must contain at least one letter."
16:09 <fresheyeball> given that parse is failing
16:09 <fresheyeball> ahh
16:09 <hsk3> thanks mates!
16:10 <fresheyeball> hsk3: I guess you are going to have to go with `hello-thisissparta` or something
16:10 descender joined
16:10 <hsk3> yeah. it was supposed to be port number of a web app, so i'll probably go for hello-p300 or something
16:11 <fresheyeball> why not accept the port number as an argument?
16:11 <lyxia> yeah it seems odd to make it part of the package name
16:11 <hsk3> i do that :) just wanna be able to see it at a glance
16:11 robatosan joined
16:12 <hsk3> good point thought..
16:12 <hsk3> i could have a special app-ports.txt file for that..
16:13 meandi_3 joined
16:14 sleffy joined
16:14 primal_ joined
16:14 primal__ joined
16:14 primal___ joined
16:15 tromp joined
16:17 <fresheyeball> hsk3: I think the standard methods for port assignment, are cli flag and environment variables. If not provided use a default.
16:17 <fresheyeball> .txt is also kinda weird
16:17 beanbagu1 joined
16:18 <fresheyeball> if you are looking to make it part of a text based conf, I recommend looking at Data.Configurator
16:20 tomphp joined
16:20 balor joined
16:20 guampa joined
16:21 preyalone joined
16:23 flatmap13 joined
16:23 danthemy_ joined
16:24 primal joined
16:24 taksuyu joined
16:24 primal__1 joined
16:24 primal__2 joined
16:26 BlueRavenGT joined
16:28 <hsk3> you make a good point. i have decided not to hardcode the port.
16:28 <hsk3> that was a bad idea indeed.
16:29 Elhamer__ joined
16:30 <ph88_> does anyone know a function to go from a integer to a bytestring ? when i have 7241 i want "7241"
16:32 <ReinH> ph88_: pack . show or use a builder, depending on your needs
16:32 <dmj`> ph88_: cereal / binary could work too
16:33 <ReinH> also using a ByteString for text is generally a bad idea
16:34 <dmj`> encode :: Binary a => a -> ByteString
16:34 Wizek__ joined
16:34 primal_ joined
16:34 primal__ joined
16:34 primal___ joined
16:34 osa1 joined
16:36 SpinTensor joined
16:36 eazar001 joined
16:36 dhil joined
16:37 slackman joined
16:38 mizu_no_oto joined
16:40 <ReinH> (that would be Data.ByteString.Char8.pack)
16:43 danthemyth joined
16:43 <shapr> blackdog: have you tried scalpel for web scraping in Haskell?
16:43 rkazak joined
16:44 jutaro joined
16:44 primal joined
16:44 primal__1 joined
16:44 primal__2 joined
16:46 firef1y joined
16:46 northfurr joined
16:47 jordan3636363 joined
16:47 <jordan3636363> https://ideone.com/rFxvQZ
16:47 <jordan3636363> i dont understand why this doesn't work :/ im new to pattern matching
16:48 <Athas> jordan3636363: your code is fine, but you are trying to compile it as a standalone executable.
16:48 t7 joined
16:48 <Athas> To do that, you must have a 'main' function. Probably this is not what you want, though. Instead, you can load your code into GHCi and play with it interactively.
16:49 magneticduck joined
16:49 ludat joined
16:50 <jordan3636363> https://thepasteb.in/p/qjhLZqnlKxZfB
16:50 <jordan3636363> Athas
16:51 <ChaiTRex> jordan3636363: You need to import isNumber from Data.Char. You also need to convert the digit Chars to Ints.
16:51 <ChaiTRex> jordan3636363: You can't sum a bunch of Chars.
16:51 bvad joined
16:52 blackdog joined
16:53 <ChaiTRex> jordan3636363: See https://ideone.com/oVQGEV
16:54 <ReinH> How do you know that "12" is the numbers 1 and 2 rather than the number 12?
16:54 primal_ joined
16:54 primal__ joined
16:54 primal___ joined
16:54 tomphp joined
16:55 im0nde joined
16:55 <jordan3636363> u just assume that its 1 and 2
16:55 <ChaiTRex> jordan3636363: I've edited that to a simpler version with `digitToInt`, which needs to also be imported from Data.Char.
16:56 <jordan3636363> thanks a lot, it works like a charm ChaiTRex !
16:56 <ChaiTRex> jordan3636363: You're welcome.
16:56 <shapr> blackdog: You were asking about Haskell web scraping on twitter a month or so ago, have you tried scalpel?
16:58 trism joined
17:00 stphrolland joined
17:02 al-damiri joined
17:02 <stphrolland> Using Aeson, I could not find why decode someByteString :: Maybe MyType was always returning me Nothing with my data. I made an HSpec test, and with a valid it put ( as far as I can judge) it still returns me nothing. What do you do to debug with aeson in general ? I have no error message so I have no clue what may go wrong.
17:02 <stphrolland> it put = input
17:03 oisdk joined
17:03 primal joined
17:03 <lyxia> stphrolland: how do you know your input should be valid
17:03 primal__1 joined
17:04 primal__2 joined
17:04 <ChaiTRex> stphrolland: I'm not sure, but my first try would be to encode a MyType value and see if it looks like what you're trying to decode.
17:04 ragepandemic joined
17:04 <stphrolland> I think so, I'm not sure, that's why I'd like Aeson to tell me what it did not like
17:04 <lyxia> stphrolland: also try eitherDecode to get the error message
17:04 ragepanda joined
17:04 <stphrolland> okay, that sounds good
17:06 flatmap13 joined
17:08 flatmap13 joined
17:09 pgiarrusso joined
17:09 frampton joined
17:10 baldrick1 joined
17:12 <stphrolland> lyxia: thanks very much, the error message was good to indicate me the problems
17:12 <stphrolland> I'll always use eitherDecode now
17:14 primal_ joined
17:14 primal__ joined
17:14 primal___ joined
17:14 carlomagno joined
17:18 <lyxia> Great, you're welcome.
17:20 Wizek joined
17:20 Wizek__ joined
17:20 featherlessbiped joined
17:21 afarmer joined
17:22 balor joined
17:23 Swizec joined
17:23 primal joined
17:23 primal__1 joined
17:24 bodisiw joined
17:24 primal__2 joined
17:24 Gurkenglas joined
17:24 connrs joined
17:24 featherlessbiped joined
17:25 dejanr joined
17:26 <bsima> Are exceptions used in anger? I've only done toy apps and learning exercises
17:26 <bsima> like Control.Exception
17:26 <EvanR> exceptions are good in IO related things
17:26 <Cale> They're used quite sparingly
17:27 <lyxia> never heard of a package named anger.
17:27 <Cale> It's generally a safer design decision to go without using them, but there are some cases where they're the right thing.
17:27 dejanr left
17:27 whaletechno joined
17:28 <bsima> I done my best to avoid them, but wreq uses them a lot so I guess I gotta learn how to do this
17:28 <* bsima> needs another cup of coffee first
17:29 DataComputist joined
17:29 dhil joined
17:30 <tsahyt> when I build two structures using the same references, does the data behind the references get duplicated?
17:30 <tsahyt> e.g. I have x :: Foo in scope, and I return ([x], (x,x)), how many instances of x are there in memory?
17:30 <ChaiTRex> tsahyt: Not usually.
17:30 <tsahyt> assuming Foo is something nontrivial
17:31 tromp joined
17:31 <EvanR> let x = complicated in ([x],(x,x)) there will only be 1 x
17:32 <tsahyt> EvanR: and this remains the case when I say deconstruct the outer tuple and pass the list and the other tuple around etc?
17:32 fotonzade joined
17:32 <EvanR> well once you start operating on x directly, you could be allocating more stuff
17:32 <EvanR> if you need to modify the x
17:32 <tsahyt> but if I only read it?
17:33 <EvanR> you can read to your hearts content
17:33 <tsahyt> great
17:33 dm3 joined
17:33 primal_ joined
17:33 primal__ joined
17:33 primal___ joined
17:33 soniku joined
17:33 northfurr joined
17:34 Hunter1_ joined
17:34 path[l]_ joined
17:34 <EvanR> remember lazy evaluation though, the x may not be fully evaluated, and whatever does the reading will be the thing doing the initial work to materialize the parts
17:34 <stphrolland> I'm using extension DuplicateRecordFields for two structure which are somewhat really similar. However I don't find the way to disambiguate one selector for one structure or another.
17:34 <stphrolland> How do you do it ?
17:35 balor joined
17:35 oisdk joined
17:39 <lyxia> selector (myRecord :: RecordA)
17:40 danthemyth joined
17:41 bollu joined
17:42 balor joined
17:42 <lyxia> stphrolland: c.f. the GHC user guide https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#duplicate-record-fields
17:43 primal joined
17:43 ludat joined
17:43 primal__1 joined
17:44 primal__2 joined
17:44 guampa joined
17:46 jsgrant_om joined
17:48 simukis joined
17:49 mizu_no_oto joined
17:49 Lambda joined
17:49 <Lambda> Hey
17:49 <shapr> hi Lambda, are you anonymous?
17:49 romank joined
17:49 <Guest87245> No haha
17:50 <Lambda_> I'm currently learning haskell and took a guess hoping this was a server
17:51 <shapr> It worked!
17:51 <Lambda_> What worked?
17:51 <shapr> You guessed correctly?
17:51 <Clint> this isn't a server
17:51 <Clint> this is a channel
17:51 <shapr> Lambda_: got any questions about Haskell?
17:52 <Lambda_> Got my stuff mixed up sorry Clint
17:53 <szhwump> guys can you help me with my hoogle-fu: I'm working with gnuplot, and need to figure out how to take a type from T to IO(). What should I search for?
17:53 <Lambda_> I'm almost finished the book Learn You A Haskell, Any recommendation on where to go after that book?
17:53 <szhwump> (T is Graphics.Gnuplot.Private.Plot.T)
17:53 <rom1504> recode pandoc
17:53 <rom1504> then you can recode ghc
17:54 codesoup joined
17:55 flatmap13 joined
17:55 <Lambda_> Haskell is also my first Funtional Programming language
17:55 <shapr> ooh, me too!
17:55 <shapr> Lambda_: Have you seen haskellbook.com ?
17:56 <Lambda_> No I haven't I'll check it out now
17:56 <Cale> http://chimera.labs.oreilly.com/books/1230000000929/index.html
17:56 <Cale> is a good follow up once you have a handle on the basics
17:56 <Clint> szhwump: is that like https://hackage.haskell.org/package/gnuplot- ?
17:56 <Cale> (Simon Marlow's Parallel and Concurrent Programming in Haskell)
17:56 <Lambda_> Is it worth the 59 dollars
17:56 <Lambda_> ?
17:57 <EvanR> + 0.95 :: Centi
17:57 <bsima> Lambda_: I can vouch for haskellbook.com, it's really great
17:57 <pikajude> > 10 / 3 :: Centi
17:58 <lambdabot> 3.33
17:58 <pikajude> no kidding
17:58 <EvanR> <3
17:58 <Cale> szhwump: Oh no, you've falling into another Henning Thielemann package
17:58 <Cale> fallen*
17:59 <lambdamu> Is it really not possible to automatically generate working complete lowest level bindings for c libraries?
17:59 <Lambda_> I'll read the free sample when I'm not at work and that's for the recommendation
17:59 <Cale> szhwump: The fact that he names all his types T and all his classes C makes it impossible to actually use
17:59 <stphrolland> lyxia; great I add this documentation to my bookmarks, I often have doubts about how to use extensions
18:00 <pikajude> doesn't ocaml name all the types t
18:00 <lambdamu> Cale: He tries to leverage the module system
18:00 <lambdamu> Cale: Your supposed to import qualified, but you probably know that
18:00 FreeBirdLjj joined
18:00 <Cale> I do
18:01 pja joined
18:01 Goplat joined
18:01 replay joined
18:01 <Lambda_> I haven't seen a chat this active in awhile
18:01 <lyxia> pikajude: it somehow works better with ocaml's module system
18:01 <Cale> The thing is, the fact that you can choose to import things qualified doesn't help you when you have to click on each occurrence of T to figure out which type it refers to in the documentation.
18:02 <Cale> cons :: T graph -> T graph -> T graph
18:02 <lambdamu> Cale: haha yes he considers haddock broken on that account
18:02 <pikajude> lyxia: that i agree with
18:02 <Clint> what does he think haddock should do?
18:03 <lambdamu> Clint: I didn't actually here him say that, to be clear, it just appears that way
18:03 <Cale> Probably preserve qualifications in top level signatures, except while that helps him somewhat, it doesn't really make any sense, because you can't just import the module and get things qualified like that.
18:04 sssilver joined
18:04 <Cale> You'd have to know how everything was imported.
18:04 ikke joined
18:05 pie_ joined
18:05 <Cale> I still don't understand why he'd be so adamant in sabotaging all his packages like that
18:05 chaosmasttter joined
18:05 <Cale> It's not any more convenient in any way.
18:05 taksuyu joined
18:05 <Philonous> Well you can choose to work with the tools that exist or against them. Disregarding established conventions and demanding that existing infrastructure be changed to accommodate your personal style choices while making your code neigh unusable is pretty immature and borderline antisocial
18:05 fizruk joined
18:05 <lambdamu> I guess one way to fix it is to prefix types with their source modules when there are name conflicts in scope scope
18:05 richi238 joined
18:05 <Cale> and yeah, it means you're fighting against all the existing tools
18:06 Soft joined
18:06 ragepanda joined
18:06 <Cale> Yeah, that would "fix" it... though it would still be much uglier than if he didn't do this.
18:06 <lambdamu> actually I don't think it should be hard to fix
18:06 Ke joined
18:06 Ke joined
18:07 <Cale> It might not be so bad for Haddock. I once took a halfhearted shot at writing a source to source dehenning tool
18:07 <szhwump> okay, so what am I supposed to do to actually plot this T plot?
18:07 <Cale> and that's tricky, because modules can and will be imported as the same name
18:08 coot joined
18:08 <Philonous> Honestly, if someone flaunts his disregard for convention and helpfulness so proudly, I wouldn't trust his code enough to use it in anything serious anyway
18:08 zomg joined
18:08 <Cale> szhwump: If it were me, I would either give up entirely on this package, or fork it and rewrite all the types in it to not all be called T.
18:08 balor joined
18:08 Hunter1_ joined
18:08 <szhwump> I think I'd still have that problem though
18:09 <Cale> maybe
18:09 <lambdamu> I think the idea has some merit to it, our module system just sucks and doesn't take well to this kind of abuse
18:10 <Tuplanolla> Could we get HT to write an un-HT compiler in HT style and then apply it to itself?
18:10 northfurr joined
18:10 <szhwump> so anyone know of some other good plotting libs that can do 3d?
18:10 <lambdamu> on fixing haddock in their source modules all types have to be unambiguous. no? so one could always take that as prefix
18:10 ystael joined
18:10 <Cale> szhwump: The problem is, there are literally 19 different types in that package all named T. So nobody understands what you're asking.
18:10 baldrick2 joined
18:10 <szhwump> oh
18:10 <szhwump> okay
18:11 <szhwump> cloud :: (Graphics.Gnuplot.Value.Tuple.C a, Graphics.Gnuplot.Value.Atom.C z, Graphics.Gnuplot.Value.Atom.C y, Graphics.Gnuplot.Value.Atom.C x) => gnuplot- x y z a -> [a] -> T x y z
18:11 <Cale> The guy who wrote it is super stubborn and while he does a lot of interesting stuff, he ruins it all like this.
18:11 <EvanR> you could try to help anyway
18:11 <szhwump> ^ exists, so how do I actually plot this plot?
18:11 <szhwump> does that help?
18:11 <Cale> What's the last T?
18:11 <Cale> wait, maybe I can find it
18:11 connrs joined
18:11 kmels joined
18:12 <Cale> Graphics.Gnuplot.Plot.ThreeDimensional
18:12 <szhwump> I'm looking to try to use anything from Graphics.Gnuplot.Plot.ThreeDimensional that can just plot a list of 3D points
18:12 <Cale> oh, and that T is a type synonym
18:12 <szhwump> type T x y z = gnuplot- (gnuplot- x y z) -- Defined in ‘Graphics.Gnuplot.Plot.ThreeDimensional’
18:12 <lyxia> for another T?
18:12 <Cale> for Graphics.Gnuplot.Private.Plot (Graphics.Gnuplot.Private.Graph3D.T x y z)
18:12 <Gurkenglas> If you want to annoy him, you could write a tool that automatically forks all his projects and fixes them.
18:12 <EvanR> interesting i only thought these C and T packagers were for esoteric advanced math... this is gnuplot bindings
18:13 <Cale> Gurkenglas: I thought about it, it's trickier than I thought it would be.
18:13 <lyxia> But our T is in another module!
18:13 <szhwump> Cale: what is the advantage of wrapping them in T or C in the first place?
18:13 <Cale> szhwump: All the T's are completely different things
18:13 <Cale> szhwump: This guy names all his types T
18:13 <szhwump> ... that doesn't sound very advantageous
18:14 <Cale> That's why I was recommending we just abandon the whole package, or else carefully fork it all.
18:14 <Philonous> szhwump, I think the basic idea is that the type names are often redundant, like you have a type Plot in a module Plot. So (I'm guessing here) he decided to cut some boilerplate.
18:15 <mnoonan> it's like a weird module-level version of Hungarian notation
18:15 <Cale> cloud :: (C x, C y, C z, C a) => T x y z a -> [a] -> T x y z
18:15 <Cale> But then you end up with haddock telling you stuff like this
18:15 <Cale> which is totally unreadable
18:15 sz0 joined
18:15 <Gurkenglas> Cale, could you preprocess the source with that new haddock thing that inserts all the right hyperlinks?
18:15 <Cale> (and even with the qualified names, it's awkward to read)
18:15 <Cale> The hyperlinks are correct
18:15 <Cale> Haddock knows where things go
18:16 dsh joined
18:16 <Cale> So, maybe a tool based on Haddock (or just the GHC API) could do it.
18:16 <Gurkenglas> Right, so you can use Haddock's output to find out how to dehen
18:16 <szhwump> I don't think I'm qualified enough to hate this guy yet, so can someone at least recommend some other 3d plot library?
18:16 antoine9298 joined
18:17 <Philonous> szhwump, It's not about hating the person.
18:17 dddddd joined
18:18 <mnoonan> so I successfully wrote some Template Haskell for a nontrivial task last night, and I kind of enjoyed it. Am I ill?
18:18 <Philonous> mnoonan, Nope. Welcome to the club.
18:18 <Cale> I hate him in the friendliest possible way. He ruined Haskore.
18:18 <Cale> Which was actually one of the original reasons that I found Haskell in the first place.
18:18 <lambdamu> szhwump: Did you take a look at diagrams? I think it can do 3d, too
18:19 <Philonous> Did he write it himself or did he "improve" it?
18:19 <Cale> He took over maintainership and "improved" it
18:19 <Philonous> Oh, well, that's actually a shame.
18:19 <Cale> It was Paul Hudak's thing originally
18:22 dm3 joined
18:22 Bassetts joined
18:22 entuland joined
18:22 <Cale> diagrams has somewhat limited 3D support
18:22 <szhwump> :(
18:23 dejanr_ joined
18:24 <antoine9298> Cale: «him»?
18:25 guampa joined
18:27 dm3 joined
18:27 <Cale> antoine9298: Henning Thielemann
18:27 Bassetts joined
18:28 <Cale> He does so much cool stuff, but sabotages it all with this dumb convention that renders it practically unusable
18:29 <Cale> Gurkenglas: Here's another good example of something which is tricky to fix fully automatically: https://hackage.haskell.org/package/gnuplot-
18:30 <Cale> Gurkenglas: He's got both a class and a type in this module, and they can't both be named the same thing.
18:30 <Cale> You could prefix the class names with Is or something as a best effort though.
18:30 <EvanR> CI CII CIII CIV
18:30 <Cale> "Is"
18:31 <Cale> i.e. in this case, you'd end up with a type Terminal, and a class IsTerminal
18:32 meoblast001 joined
18:32 <Rembane> Well, as a first step, a tool that makes it easier to do these changes manually.
18:32 <Cale> szhwump: https://hackage.haskell.org/package/easyplot-1.0/docs/Graphics-EasyPlot.html seems to have some 3D support
18:32 robertkennedy joined
18:32 <cocreature> as anybody ever tried to convince Henning to use a different convention?
18:32 <cocreature> *has
18:33 <Cale> I don't know. A long time ago, I think there was some mailing list traffic about it.
18:33 <* magneticduck> wonders how Hanning would write the Prelude
18:34 govg joined
18:34 <Tuplanolla> We could sign a really passive-aggressive petition.
18:34 <Tuplanolla> I have all the good solutions.
18:34 <Cale> szhwump: I'll help you use that package if you have any trouble :)
18:34 <Philonous> Or you could spend the same effort making better packages
18:35 <Cale> The tool which makes it easier to repair his packages sounds good.
18:35 meoblast001 joined
18:35 <Cale> Maybe just something which is split into two parts: one makes a file per source input with suggested renamings, one per line, and the other takes that file and the source, and performs the renamings.
18:36 guampa joined
18:36 <Cale> So you have a chance to edit the mapping, and can save the mapping files between releases of his packages.
18:37 <Philonous> Easiest case: An emacs macro that searches for T and C and suggests the current filename (without extension) as the replacement
18:37 <Rembane> Maybe ask first if he would be cool with a pull request to make the names easier to understand for people who aren't him.
18:37 <Philonous> Oh, right, you have to redo it after every release
18:37 <Rembane> It might save quite some time.
18:37 revprez_atlanta joined
18:37 <Cale> Philonous: right
18:38 jzeus joined
18:38 <Cale> Rembane: Given that he's been at this for over a decade, I'm not sure that he'd merge :)
18:38 <Cale> I'm pretty sure that he must be aware that other people are annoyed by ut
18:38 <Cale> it*
18:39 <Philonous> It's not a new complaint. He knows about this. And yet he continues doing it. The prior probability that it would work is small
18:39 mda1 joined
18:40 <Rembane> Cale: I like the concept of one last chance. :)
18:40 <glguy> It's licensed GPL, so if someone wanted to maintain a version without that naming they'd be free to
18:40 cereal_killer_ joined
18:41 <Philonous> Cale, I don't think just de-obfuscating his packages automatically would work even in the medium-term. People using the translated version would still need to talk to HT for support and bug fixes, which would become awkward if they where using the modified version
18:41 <Cale> glguy: Looks BSD from here...
18:41 litchblade joined
18:41 unyu joined
18:41 <Cale> Or which package?
18:41 <cocreature> it looks like he has even written a wikiarticle about this https://wiki.haskell.org/Qualified_names
18:41 <glguy> Oh, I thought you were talking about haskore
18:41 <Philonous> So it's either forking it and maintaining it yourself or keeping it as-is
18:41 <Cale> ah, haskore
18:42 <lyxia> haddock could have a way to qualify types, that may alleviate the problem a bit
18:42 <Cale> glguy: We started off with gnuplot, I mentioned haskore somewhere along the way
18:42 locallycompact joined
18:42 unyu joined
18:42 <glguy> I haven't been reading carefully, but BSD works too, if someone wants to maintain the package with a different naming convention they can
18:42 <lyxia> it would also be useful for the Strict/Lazy situation.
18:42 unyu joined
18:42 <Cale> Sure
18:44 macrover joined
18:46 oish joined
18:47 northfurr joined
18:49 meoblast001 joined
18:49 deank joined
18:50 revprez_atlanta joined
18:50 ralu joined
18:51 caumeslasal joined
18:57 twanvl joined
18:57 romank joined
18:59 jordan23 joined
19:00 <jordan23> hi i need to go through a list of tuples that have tuples in them in which are two numbers
19:00 <jordan23> [((2,20), (3,20), (1,19))] for example
19:00 Mutter joined
19:01 <jordan23> i try to check if the fst of the tuples is 1 or 2 or 3
19:01 <jordan23> how do i check that?
19:01 baldrick1 joined
19:01 `^_^v joined
19:02 <Philonous> pattern-match on the tuples. map (\(((x,_), (y,_), (z, _)) -> x `elem` [1..3] && y `elem` [1..3] && z `elem` [1..3]) xs
19:03 <Philonous> Oh, that may have too many opening parens
19:03 ryantrinkle joined
19:03 <jordan23> what does the backslash mean?
19:03 <ryantrinkle> is it possible to have cabal fail to build if haddocks aren't complete?
19:03 sproingie joined
19:03 sproingie joined
19:04 <Philonous> jordan23, It creates an anonymous function. \x -> y is a function with one parameter x that returns y
19:04 <Philonous> You may want to read an introductory text for Haskell
19:05 sssilver joined
19:05 <ph88_> is it possible to see Wall in ghci ?
19:05 <jordan23> alright
19:05 gawen joined
19:05 simendsjo joined
19:05 <Philonous> ph88_, :set -Wall
19:05 <Philonous> you can also start it with -Wall
19:06 unK_ joined
19:06 <byorgey> jordan23: why do you have a list of tuples with tuples in them?
19:06 <ph88_> when i reload i don't get any warnings
19:06 <ph88_> Philonous, ^
19:06 psychicist__ joined
19:07 <jordan23> its like a program that analyzes darts
19:07 <Philonous> ph88_, Maybe it's warning-clean? :D
19:07 <jordan23> [((2,20), (3,20), (1,19))] means the player has scored a double 20, a triple 20 and a single 19
19:07 <ph88_> :D
19:07 litchblade joined
19:07 ragepanda joined
19:07 <byorgey> jordan23: I see. Did you create this yourself or was it given to you as an assignment?
19:07 <jordan23> i wanna check if the input is correct, there are only 0 (miss) 1 (single) and so on possible
19:07 <jordan23> assignment
19:08 <ph88_> hmmm i restart ghci and reload again and now i see warnings ^^
19:08 <byorgey> ok
19:08 <jordan23> im stuck tho
19:08 <jordan23> i keep thinking in python terms
19:08 zeroed joined
19:08 <byorgey> jordan23: we are happy to help, e.g. if you have some code and want help figuring out some errors, but we won't do your assignment for you
19:09 <jordan23> https://ideone.com/WnMoX2
19:09 <lyxia> ph88_: -Wall doesn't do anything for some reason.
19:09 <jordan23> yeah i just need some info on why this and that doesnt work every now and then
19:09 <jordan23> i wanna understand what im doing ^
19:09 <byorgey> jordan23: ah, ok
19:10 codesoup joined
19:10 <byorgey> jordan23: the syntax error is because you are missing an opening parentheses before (2,20). Or perhaps you have an extra one after (1,19).
19:10 <ph88_> lyxia, try restart ghci and reload again .. after that it worked
19:10 <byorgey> jordan23: is this supposed to be a list containing three pairs, or a list containing a single triple containing pairs?
19:11 <jordan23> i forgot the opening parentheses
19:11 <jordan23> its supposed to be a list that has triples of tuples inside a tuple each
19:11 <byorgey> ok, then yes, you were missing an opening parentheses
19:11 <jordan23> [((3,20),(3,20),(3,20)), ((3,20),(3,19),(2,25))]
19:11 <jordan23> for example
19:12 <byorgey> right
19:12 <jordan23> now i get this error
19:12 <jordan23> https://thepasteb.in/p/RghnE28EmlvSz
19:12 <byorgey> jordan23: in line 4, what type is x ?
19:13 jzeus joined
19:13 <jordan23> a tuple of tuples?
19:13 <byorgey> jordan23: correct
19:13 <jordan23> i need to go deeper right
19:13 <byorgey> jordan23: specifically a 3-tuple of 2-tuples
19:13 <byorgey> jordan23: so what are you trying to check in check_first_elem ?
19:14 robkennedy joined
19:14 takle joined
19:14 <jordan23> the first element in the 2-tuples
19:14 <jordan23> mhm
19:14 mada joined
19:15 <jordan23> how can i change line 3 to go one instance deeper into the list?
19:15 <byorgey> jordan23: I think you probably need to write check_first_elem using pattern matching. Right now you refer to 'fst' but fst is a function, and it is not applied to anything.
19:15 <byorgey> jordan23: I don't understand what you mean by 'one instance deeper'
19:15 <jordan23> right now im checking the tuples inside of the list
19:15 <jordan23> but í wanna check the tuples inside of the tuples inside of the list
19:16 <byorgey> jordan23: in Haskell you can't iterate over tuples.
19:16 <byorgey> tuples in Haskell are very different than tuples in Python.
19:16 <jordan23> : /
19:16 <byorgey> Python tuples and lists are basically the same except tuples are immutable.
19:16 <Philonous> jordan23, You said you where thinking like a Python programmer, so this might be not obvious to you: Tuples in Haskell have a fixed length and the only way to get the elements is to pattern-match them
19:16 <jordan23> map (\((x,_), (y,_), (z, _)) -> x `elem` [1..3] && y `elem` [1..3] && z `elem` [1..3]) xs
19:17 <jordan23> ill try to work with this
19:17 <byorgey> but in Haskell a list is an arbitrary-length sequence of elements all of the same type, whereas a tuple is a fixed-length sequence of elements which could all have different types
19:17 <magneticduck> jordan23: or [...] all (flip elem [1..3]) [x, y, z] [...]
19:18 <byorgey> if I were you I would forget about that and write it myself.
19:18 <byorgey> magneticduck: that's not helpful.
19:18 yqt joined
19:18 hybrid joined
19:18 <magneticduck> I haven't read context
19:19 <byorgey> magneticduck: no worries, it's just that jordan23 isn't yet at a stage where that will make any sense
19:19 <jordan23> ^
19:20 <jordan23> first_component (x,_) = x
19:20 <byorgey> jordan23: try to fix check_first_elem x = ... using pattern matching: check_first_elem (some pattern goes here) = ...
19:20 cereal_killer_ joined
19:20 robkennedy joined
19:20 Hunter1_ joined
19:20 <byorgey> yes, that function is also known as 'fst'
19:20 <Philonous> jordan23, Maybe a better pattern to understand what's going on is: check_first_elem x = case x of ((x1, x2), (y1, y2), (z1,z3)) -> «your code here»
19:20 chaosmasttter joined
19:22 path[l] joined
19:22 locallycompact joined
19:22 carlomagno1 joined
19:24 theelous3 joined
19:25 yellowj joined
19:26 dejanr_ joined
19:26 eschnett joined
19:28 bennofs joined
19:28 connrs joined
19:30 psychicist__ joined
19:30 jbgi joined
19:31 <xplat|work> is there some kind of way to do haskell scripting when your script has actual deps? runhaskell doesn't really handle that iirc, and stack has a way to do it but it isn't quite satisfactory
19:32 Durbley joined
19:32 <kadoban> xplat|work: The stack way works pretty well for me. What's unsatisfactory about it?
19:32 <byorgey> xplat|work: well, I was about to say 'stack can do that' but apparently that's not satisfactory.
19:32 <xplat|work> or at least, it wasn't last i checked -- it would drool on either stdout or stderr and didn't allow custom dependency versions
19:33 <xplat|work> have those things changed?
19:33 insitu joined
19:33 <kadoban> You can specify verbosity options, if that's what you mean. A long time ago I think it used to default to normal verbosity instead of quiet maybe, that could be what you're talking about.
19:33 dhil joined
19:33 <kadoban> As for specific versions, I'm not really sure. Does the --package syntax not support version numbers? I've never tried to be honest.
19:34 augur joined
19:34 <davean> xplat|work: You can specify what packages should be in scope with runhaskell if you REALLY wanted to
19:34 fosterite joined
19:35 <xplat|work> istr --package on stack would only let you use whatever was in the specified resolver
19:36 <kadoban> If you really want to I think you can make new resolvers in your config, but I've never bothered. Maybe that'd work the hopefully rare times you need that?
19:36 leshow joined
19:36 soniku joined
19:36 <xplat|work> davean: but only out of things in whatever global and local package database you have active for that runhaskell
19:37 <davean> xplat|work: sure, otherwise how is it different then building an executable?
19:37 <athan> In STM, is there something like `head :: TChan a -> TMVar a`?
19:37 <davean> xplat|work: if that isn't what you want I really am not sure what you could be wanting here
19:38 psychicist__ joined
19:39 <frampton> Recently started learning Haskell. I have a question about about functions being first class citizens. When you pass a function as an argument, what is then actually passed?
19:39 bobakk3r joined
19:39 <xplat|work> davean: i'd actually want it to be as much like building an executable in capabilities as reasonably possible, but without doing a whole cabal init and having a source directory for a single file's worth of code
19:39 <jordan23> still stuck
19:39 <davean> xplat|work: so, where do you want it to know which packages you want?
19:40 merijn joined
19:41 <xplat|work> davean: a structured comment, a pragma, a header section before the actual source starts. something of that sort.
19:41 <athan> frampton: That's theoretically not important :) you can just see it as "the function itself is passed as an argument"
19:43 foolswoo1 joined
19:43 <xplat|work> well, what is theoretically important is that the code of the function is passed, along with bindings for all the variables it uses other than its arguments
19:43 balor joined
19:43 <davean> athan: and the exact how would very by implimentation
19:44 oisdk_ joined
19:44 guampa joined
19:44 path[l] joined
19:44 <frampton> athan: I get the concept. But it does mean that the function you are passing has to be statically encoded in the program? If you have a client/server program, could the server execute functions that are completely client supplied?
19:45 <davean> frampton: in theory, but how would you serialize them?
19:45 <xplat|work> so references to resources/constants/whatever are resolved in the scope where the function is defined, not where it is used. this is important in that it makes the type of the function a complete description of what is needed to call it
19:45 <davean> (In fact you CAN but it is hard to convy the function to the server)
19:45 <xplat|work> cloud haskell!
19:45 <davean> xplat|work: :(
19:46 <davean> xplat|work: Also, that doesn't
19:46 <davean> it just has a name for functions present in the server
19:46 <frampton> davean: That is one of the things I was thinking about. Since functions don't have a show instance you could not serialize them into a format that could be 'transported'.
19:47 <frampton> davean: Similarly, if the actual instruction encodings would somehow be passed then you are tied to a certain architecture.
19:47 <xplat|work> well, you could maybe build a function on the server side by using functions it already knows about and point-free style to assemble a function over there
19:49 <foolswoo1> Hi, I'm trying to write a composable bidirectional stateful processing pipeline without using threads for each stage, Pipes.Proxy was close but could have one end that was an event source. I have a gist of something that is similar and kinda does what I want, but am concerned that it doesn't form a category. https://gist.github.com/foolswood/d5891e320abbd31305318c668799a313 I'm new to Haskell, so if it
19:49 <foolswoo1> seems like I've missed something obvious, I probably have. Thanks.
19:49 roconnor_ joined
19:50 <foolswoo1> The idea is eventually to make something that manages serialisation and other middleware-like functions for a networked application.
19:52 <lyxia> "could have one end that was an event source", are you saying pipes was too expressive?
19:53 user001 joined
19:53 cyborg-one joined
19:53 mizu_no_oto joined
19:53 <xplat|work> i guess i'll check if the stack method has improved enough
19:54 sleffy joined
19:54 guampa joined
19:54 <Philonous> frampton, If you have some function without knowing anything about it than you can't send it over the wire, obviously. But if you know how the function was created you have a chance. Many functions are created by starting with a static functions a filling in data. For example plusOne x = x + 1 starts with the (static) (+) function and adds the value 1 to the environment, creating what's called a closure. You can capture a pointer to the
19:54 <Philonous> static function and the environment, serializing both, send it over the wire and then re-create the function from that. That's what cloud Haskell does
19:54 ChaiTRex joined
19:55 ryantrinkle left
19:55 <foolswoo1> lyxia: The crux of the issue with pipes was that the application isn't request response so there was more than one trigger for a state update.
19:56 <xplat|work> so you needed multiple event sources, but they were all still on one end?
19:57 <foolswoo1> Think of a UI on one end and a network on the other, you don't know which is going to fire next and they're kinda on opposite ends.
19:57 <xplat|work> oh
19:57 <frampton> Philonous: Like I wrote, just started with Haskell. So things like that are quite a way off. I was thinking a bit how the implementation works. Did not think that there were function pointers being passed around, but more 'call-by-name' instances that would get lazily evaluated.
19:57 darjeeling_ joined
19:58 balor joined
19:58 fosterite joined
19:59 ragepanda joined
19:59 <Tuplanolla> Haskell is kind of a low-level language in that types, names and intermediate data structures may be erased by the compiler, frampton.
19:59 <lyxia> foolswoo1: I see, that design doesn't work very well with multiple asynchronous sources on both ends. How about putting them both on the same end?
20:00 <Tuplanolla> If you want reflection, you'll have to ask the compiler for it explicitly.
20:00 <Guest48926> So...any people who love low level fiddling around? I need help fixing/making a low level spinloop work
20:00 <frampton> Philonous: But I was also hoping that you could add things dynamically. For instance, you have a function byteStream -> hash (or digest). That you could then plug in whatever function matched that signature. So when new ones come along (like the Blake family) that you could just supply those.
20:01 <frampton> Tuplanolla: Ok. When all those disappear after compilation, that does mean you can only use things that are statically known at compile-time, right?
20:02 <xplat|work> foolswoo1: i feel like that gist could use a few more comments. e.g. what 'a' and 'b' parameters mean on block, what 'inStep' and 'outStep' represent
20:02 <Philonous> frampton, I'm not sure I follow. You can store functions in Map (Haskell's name for Dictionary) and dynamically select one from it e.g. depending on user input and use that
20:03 <Tuplanolla> I'm afraid to say yes, because that sounds so vague, frampton.
20:03 <xplat|work> there are ways to add functions to a program at runtime, e.g. hs-plugins
20:03 <blackdog> frampton: are you talking about plugging new functions into a running program, a la lambdabot?
20:03 <Tuplanolla> You certainly don't get `eval` for free.
20:03 romank joined
20:04 montag451___ joined
20:04 <lpaste> merijn pasted “Fix the spinloop!” at http://lpaste.net/7143201469959766016
20:04 <foolswoo1> lyxia: You might be able too, you'd need feeder threads and I couldn't get it to drop out easily.
20:04 jgertm joined
20:04 <foolswoo1> xplat|work: Thanks for giving it a read, I'll annotate it up.
20:05 <frampton> Philonous, Tuplanolla: Probably my question is vague too. I will take the empirical route and look at various 'layers' of GHC output (as a good exercise too) and see if that reveals what I am wondering about.
20:05 <merijn> I have this spinloop using atomic-primops, but it's not working, so clearly I'm missing some memory barrier somewhere that I need, but I'm unsure how to fix it
20:05 danthemyth joined
20:06 buttbutter joined
20:06 mrjake left
20:07 <frampton> blackdog: I was not really talking about that ... although if a server would be able to use a client supplied function (that the server did not previously know about, except that the type signature has to match of course) then that would be a practical consequence.
20:07 northfurr joined
20:08 takle joined
20:08 splanch joined
20:09 <edwardk> merijn: code?
20:10 Trendrrr joined
20:10 <merijn> edwardk: http://lpaste.net/7143201469959766016
20:10 <merijn> edwardk: I'm also open to any other primitive for doing as cheap as possible synchronisation you might have
20:12 <merijn> edwardk: Right now I have implemented benchmarks for AtomicCounter, Chan, IORef, MVar, QSem, QSemN, TVar, TMVar, and a bunch of other STM primitives. But I suspect there's probably something faster to cobble together using GHC primitives
20:12 cdg joined
20:12 balor joined
20:12 <merijn> But I haven't really had a good look at what's available there
20:12 <foolswoo1> xplat|work: I've added some comments, let me know what remains unclear :)
20:12 <edwardk> shouldnt you yield in your spin loop?
20:12 <merijn> edwardk: I dunno, should I? :)
20:12 <merijn> edwardk: This is for the threaded backend
20:13 <merijn> ok, yield works, at least, but I don't understand why :)
20:14 Trendrrr joined
20:14 <xplat|work> a spinloop that doesn't allocate can still block an entire capability, and if some thread is bound to that capability a la forkOS or just sticky scheduling ...
20:14 <edwardk> yeah but while you're spinning nobody else is using your capability until it times out from doing constant allocation in the loop
20:14 <merijn> xplat|work: I don't have bound threads, but I suppose sticky scheduling might be an issue
20:14 <merijn> yield works, at least
20:14 <edwardk> if it doesnt allocate then you own the capability until you let the scheduler run
20:15 <edwardk> i think ghc changed its policy a while back to allow loops to not allocate, no?
20:15 <edwardk> which means that tight loops can hog a capability
20:15 <merijn> Which means it's time to move on to the next issue: Any recommendations for dark low level voodoo to implement even cheaper synchronisation?
20:16 <Sornaensis> woodoo
20:16 <lyxia> foolswoo1: I don't think compose is associative in general. inStep ((x `compose` y) `compose` z) calls outstep x twice, (x `compose` (y `compose` z)) calls it once.
20:17 <edwardk> anyways nothignstops you from easing in, doing a couple of spins, then yielding, then doing exponential backoff and yielding, etc
20:17 <edwardk> depends on how long your critical sections take
20:17 <lyxia> foolswoo1: maybe you have stronger assumptions about inStep and outStep
20:17 simendsjo left
20:17 <edwardk> designing nice barriers is a bit of an art
20:18 <merijn> edwardk: Basically I'm trying to write some benchmarks for concurrent operations (i.e. channels, etc.) because the existing benchmarks for, e.g. unagi-chan are just bad. But that means I need a cheap way of detecting when all threads have terminated (so I can end my timing measurement)
20:19 user001 joined
20:19 <merijn> edwardk: So right now I'm writing a bunch of benchmarks to figure out the fastest/most efficient way to do that
20:19 <lyxia> foolswoo1: outStep bs1 >=> outStep bs2 = outStep (bs1 ++ bs2) seems like a good candidate for a stronger assumption to make
20:19 <edwardk> that answer will depend on expected task duration
20:19 <merijn> edwardk: So really all I care about is: Thread marking they have terminated and have another thread wait until they've all terminated
20:20 <merijn> edwardk: Expected duration is microseconds (the actual operations are nanoseconds, but criterion batches them)
20:20 <edwardk> anyways you may want to rummage through sbahra's concurrencykit code forma dozen different spinlock variants to benchmark
20:20 <xplat|work> and it needs to be either super fast, or at least super consistent in delay
20:20 <merijn> maybe milliseconds, if the batches get really large
20:20 epsilonhalbe joined
20:20 ziocroc2 joined
20:21 <edwardk> milliseconds is big for spinning
20:21 Guest67133 joined
20:21 <edwardk> you'd probably want exponential backoff for that
20:21 <merijn> edwardk: Well, hence why I'm also benchmarking MVar/TVar, IORef, etc.
20:21 <edwardk> fair nuff
20:21 <merijn> edwardk: Well, since only 1 thread is ever spinning I don't particalurary care about the CPU efficiency
20:22 <edwardk> like i said, i expect your answer for "best" to flip a few times based on task duration
20:22 ph88^ joined
20:22 <merijn> edwardk: Quick termination after the stop condition is more important. If I have a single thread spinning, burning 100% CPU, but having almost no latency between threads finishing and that being detected, then that's fine for just benchmarking
20:22 <jordan23> still stuck
20:23 <foolswoo1> lyxia: I'm intending for them to compose serially, so I'm not sure how that assumption would (in general) not have problems with a mixed type list.
20:23 <merijn> I mean, not very efficient in a library or something, but that's not what I'm using it for anyway :)
20:23 Trendrrr joined
20:24 <merijn> Anyway, time to see how the current ones perform/scale before I start the real low level voodoo ;)
20:24 <lyxia> foolswoo1: sorry I don't understand
20:25 <lyxia> foolswoo1: what is a mixed type list
20:25 umib0zu joined
20:25 <foolswoo1> lyxia: an outstep can return a different type to its input, so I don't think you could concatanate their inputs or outputs (since lists are homogenously typed)
20:25 <davean> merijn: one core spinning can lower the performance of other cores too.
20:25 <merijn> davean: True
20:25 mmn80 joined
20:26 <merijn> Concurrency and benchmarking are hard! Let's go shopping!
20:26 <foolswoo1> lyxia: If I understand correctly you'd need to be able to have 2 different types of things in that concatenated list, which isn't allowed. (Hence my confusing mixed type list statement).
20:27 <merijn> The one thing I can conclusively state already is that TMVar's performance is absolutely dreadful under contention...
20:27 <merijn> Because even with a single iteration that one takes several seconds...
20:27 <merijn> Now it's time for sleep and we'll see what criterion tells us tomorrow :)
20:28 Durbley joined
20:28 <xplat|work> that's why they say lock free ain't wait free'
20:28 <lyxia> foolswoo1: actually that should have been outStep x bs1 >=> outStep x bs2 = outStep x (bs1 ++ bs2), with x :: Block s a b; bs1, bs2 :: [b]
20:28 <lyxia> foolswoo1: I'm not concatenating lists of different types
20:28 <c_wraith> STM in general is really bad under contention.
20:29 <lyxia> foolswoo1: and this >=> is in the Writer monad, that is ((,) [a]).
20:29 dquarks_ joined
20:29 rockfordal joined
20:29 <jordan23> > succ 69
20:29 <lambdabot> 70
20:30 RegEchse joined
20:30 <xplat|work> thx mr hunt
20:30 <lpaste> Gurkenglas annotated “CZip” with “CZip (annotation)” at http://lpaste.net/355362#a8279940933659656192
20:31 <Gurkenglas> Got a tentative CZip wrap of Distributive. I think there's more in CZip than in Distributive
20:31 danthemyth joined
20:32 Achylles joined
20:32 <Gurkenglas> Because CZip can be heterogenous
20:32 <foolswoo1> lyxia: is bs1 what I'm calling b1 in compose?
20:33 <lyxia> foolswoo1: bs1, bs2 :: [b], these are simple lists.
20:33 <lpaste> Gurkenglas revised “CZip”: “Corrected the last sentence to what I think hexagoxel meant” at http://lpaste.net/355362
20:33 WF-BATCH joined
20:33 <lyxia> foolswoo1: the law I'm proposing does not involve compose.
20:33 epsilonhalbe left
20:34 ziocroc2 joined
20:34 <lyxia> foolswoo1: but I guess you could say x :: Block s a b corresponds to b1.
20:34 Itkovian joined
20:36 M_ joined
20:37 carlomagno joined
20:39 <shapr> oh wow, #haskell's 16th birthday was two weeks ago!
20:39 <foolswoo1> lyxia: I'm not sure I understand, might need to do some reading and working through on paper. Is what you're saying that the final state (and result) doesn't depend on the chunks that you break the input list into?
20:40 <lyxia> foolswoo1: that's right
20:40 <lyxia> is that true in your application?
20:42 osa1 joined
20:42 osa1 joined
20:43 jdreaver joined
20:43 <foolswoo1> Yes, the lists represent chunks of streams.
20:44 <foolswoo1> (sometimes of bytes, sometimes of semantic messages)
20:44 <jdreaver> Say I have a Haskell project and I want to write tons of docs and a tutorial. What's the best way to do that while having it all be type checked?
20:44 <jdreaver> Should I make a MyLibrary.Tutorial module? Can that be done in literate Haskell?
20:44 <jdreaver> Something with doctest maybe?
20:44 <lyxia> foolswoo1: if inStep and outStep took one element at a time, you would get that behavior for free
20:45 <jdreaver> I'm basically just afraid of my docs and tutorial becoming out of date with the library
20:45 <ChaiTRex> jdreaver: I haven't done it, but people tend to write blog posts in Literate Haskell, which they typecheck before posting.
20:45 <Gurkenglas> Is there "Distributive g => g a -> g b -> g (a, b)" that doesn't need to promise anything to the compiler?
20:46 <jdreaver> ChaiTRex: Thanks for the suggestion. Hmm, compiling a literate Haskell file to HTML docs is a good idea.
20:46 luckymerlin joined
20:46 <c_wraith> Gurkenglas, isn't that the exact opposite of what Distributive does?
20:46 <jordan23> Int is not the same as Integer okay im done for today
20:46 <Gurkenglas> Wait. There's a promising "Distributive g => g ()" too. Why isn't Applicative a superclass of Distributive? Lemme write this up.
20:47 <lyxia> jdreaver: The MyLibrary.Tutorial module is a nice idea
20:47 <foolswoo1> lyxia: Yes, they'd still need to return lists (as for instance one message can result in many bytes), but I think taking input one element at a time would work.
20:47 <c_wraith> Gurkenglas, because Distributive is the contravariant version of Applicative
20:47 <Gurkenglas> No it isnt wat lol
20:47 <jdreaver> lyxia: Yeah I saw that with the pipes library, and their tutorial module is outstanding. I looked though and it looks like literate haskell but it isn't type checked via doctest or anything.
20:48 ziocroc2 joined
20:48 <jdreaver> I'm still actively developing my library so I just want an automated way to tell me to update the tutorial and docs :)
20:48 <exio4> what is Distributive?
20:48 <c_wraith> Gurkenglas, hmm, I seem to have been thinking of Divisible
20:49 <exio4> what does Distributive offers that `pure () and liftA2 (,)` can't do?
20:50 balor joined
20:52 <lpaste> Gurkenglas pasted “c_wraith and everyone, here's an Applicative instance for Distributive (yea yea omniinstance overlaps with everything, Applicative should be a superclass of Distributive)” at http://lpaste.net/312022691085287424
20:53 <Gurkenglas> Do we need another AMP for this?
20:53 <xplat|work> i think Distributive is a container equipped with a type-changing Grate, much as Traversable is a container equipped with a type-changing Traversal
20:54 <nshepperd> hm, that is odd
20:54 xcmw joined
20:54 <Gurkenglas> Distributive is isomorphic to some ((->) x), so obviously there's a zippy Applicative instance
20:54 sproingie joined
20:54 sproingie joined
20:55 <xplat|work> Monad too then
20:56 <Gurkenglas> ...huh. I think you're right. *back to lpasting*
20:56 <lyxia> jdreaver: since it is included as part of the library, the Tutorial module is type checked. It is not run, but you can just add a test to your project for that.
20:56 jzeus joined
20:57 oisdk joined
20:57 <nshepperd> Gurkenglas: can we do this without any partial functions though
20:57 <xplat|work> Gurkenglas: what's the reason for 'hack'?
20:57 <Gurkenglas> nshepperd, I don't know, I thought of this in the process of trying to shrink a question on how to get rid of that hack
20:58 <jdreaver> lyxia: Ah I was implicitly implying that if I did a Tutorial module the output would be haddock. I guess I could to literate Haskell and throw the resulting HTML on a website somewhere
20:58 <Tuplanolla> Does the isomorphism that relates indices with lexicographically ordered tuples have a name?
20:58 <xplat|work> what happens if you just use 'f' instead of 'hack' and 'id' instead of 'fmap Left' and 'fmap Right' ?
20:59 frampton left
20:59 <lyxia> jdreaver: There is a misunderstanding somewhere... the Tutorial module will be included by haddock too
20:59 <Tuplanolla> The binary `0 -> (0, 0); 1 -> (0, 1); 2 -> (1, 0); 3 -> (1, 1)` is one example.
20:59 <nshepperd> xplat|work: distribute lets you turn (f a, f a) into f (a,a)
20:59 frampton joined
21:00 frampton left
21:00 <Gurkenglas> xplat, a and b need to be identical for distribute to work, so I turned them both into Either a b
21:00 <nshepperd> xplat|work: in order to get the Applicative operator (f a, f b) -> f (a,b) we have to make both halves the same type
21:00 balor joined
21:00 <nshepperd> do that by putting them in Either a b
21:01 <jdreaver> lyxia: Hmm, I've never actually used literate haskell before, I think I'm the source of the misunderstanding haha. I'll dive into it. Thanks for the help!
21:01 frampton joined
21:01 <xplat|work> oh, because you're using the Pair container
21:01 joelburget joined
21:02 frampton left
21:02 frampton joined
21:03 tromp joined
21:03 <lyxia> jdreaver: actually Pipes.Tutorial is not written in literate haskell. It's just one big haddock comment
21:03 refold joined
21:03 <Gurkenglas> Might it be possible that Distributive non-constructively implies Monad?
21:03 danthemy_ joined
21:03 <lyxia> jdreaver: with a few doctests
21:04 ziocroc joined
21:04 <jdreaver> lyxia: Ah the doctests are what I was looking for, I couldn't find them in the repo.
21:05 <xplat|work> i feel like you'd want to use the traverse-like thing (??) instead of the sequence-like thing (distribute)
21:06 <Gurkenglas> collect's the name
21:06 <lyxia> jdreaver: doctests are lines starting with >>>
21:06 <Gurkenglas> And I don't think so, collect also wants the a and b to be equal so I also need to do the hack before passing to collect
21:07 <lyxia> jdreaver: they are part of haddock comments
21:07 <xplat|work> no, collect is the wrong thing
21:08 alx741 joined
21:09 <xplat|work> you want Functor f => (f a -> b) -> (f (g a) -> g b)
21:09 vimalloc joined
21:10 zeroed joined
21:10 zeroed joined
21:10 zeroed joined
21:10 <Gurkenglas> oh, cotraverse. Makes sense.
21:11 <xplat|work> i guess that's (. distribute) . fmap
21:11 <vimalloc> Is there any sort of naming convention for two recursive functions, one that is the 'public' function (maybe calculates some extra data, etc), and then calls a helper function actually do the recursion?
21:11 <lpaste> Gurkenglas revised “c_wraith and everyone, here's an Applicative instance for Distributive (yea yea omniinstance overlaps with everything, Applicative should be a superclass of Distributive)”: “With xplat|work's suggestion.” at http://lpaste.net/312022691085287424
21:12 <vimalloc> Something like doThing :: <blah> / doThing_ :: <blah>
21:12 <hexagoxel> vimalloc: i have seen doThing / go
21:12 <vimalloc> hexagoxel: awesome, thx
21:13 <Tuplanolla> You must use `let` with `go` though, vimalloc. Otherwise the pun is ruined.
21:13 Arizona6882 joined
21:13 <vimalloc> hehehe
21:13 mojjo joined
21:14 <xplat|work> i've also seen 'loop' for the local function
21:14 Anaxagorian joined
21:14 <xplat|work> and many instances of slides where people switched from using 'go' to 'loop' of vice versa midway through their function
21:15 <Gurkenglas> I usually replace the recursion with schemes and monad transformers. I did that to exference and now it's frozen, so take that with a side of salt.
21:16 <Tuplanolla> You can ruin anything with `hylo`.
21:16 carlomagno joined
21:16 <xplat|work> Gurkenglas: i feel if you want to get rid of 'hack' you should be using 'cotraverse' twice instead of once
21:16 eschnett joined
21:16 <xplat|work> because you'd have to use it at two different concrete types
21:16 <Gurkenglas> cotraverse is what glues the two g's together. You are implying that I want to use it on a single g, transforming it into a single g?
21:17 <Gurkenglas> -glues+zips
21:18 <xplat|work> alternately i guess you could use cotraverse and fmap
21:18 <Gurkenglas> I am. Two fmaps even :P
21:18 <Gurkenglas> *do. I am do.
21:20 <mojjo> Hi!! I'm writing a function that inserts a value at key in a hashmap of type `M.Map a [b]` . When the key exists the val should be added to the list, otherwise it should be added to an empty list. Looks like a common enough pattern to question my implementation...
21:20 <mojjo> add :: Ord k => k -> v -> M.Map k [v] -> M.Map k [v]
21:20 <mojjo> add k v m = M.insert k (v:(maybe [] id $ M.lookup k m)) m
21:20 <foolswoo1> lyxia: I'll have a go at writing it to operate one element at a time, see what that tells me. Thanks for your help.
21:20 <Gurkenglas> Can we run a tool on hackage that shows us the subset relation of the instance for each class? Coz it's improbable that I happen to have found the last missing superclass relation
21:21 <xplat|work> ok, what if you use the datatype '(-> a)' as f
21:21 <foolswoo1> xplat|work: Thanks for getting me to clarify what I mean.
21:21 joelburget joined
21:21 <Gurkenglas> :t M.alter -- mojjo, this one makes for a nicer implementation
21:21 <lambdabot> Ord k => (Maybe a -> Maybe a) -> k -> M.Map k a -> M.Map k a
21:22 <Gurkenglas> xplat|work, see the Applicative instance, or if you want it in terms of Distributable see the lpaste :P
21:22 <Tuplanolla> How are you supposed to understand Gurkenglas by the way?
21:23 <mojjo> Gurkenglas: nice, this is what I need here..
21:23 <Tuplanolla> My poor command of north European languages suggests it's something like "cucumber and ice cream".
21:23 zero_byte joined
21:23 <mauke> more like pickle glass
21:23 oish joined
21:24 <Gurkenglas> https://www.google.de/search?q=gurkenglas&client=firefox-b-ab&source=lnms&tbm=isch&sa=X&ved=0ahUKEwiqjOa_3-PTAhUHYVAKHdngCLAQ_AUICigB&biw=1712&bih=938
21:24 <Gurkenglas> I imagine myself full.
21:24 <Arizona6882> isnt it central europe?
21:24 <Tuplanolla> Oh, neat. It's an actual thing.
21:24 <xplat|work> then cotraverse :: ((a -> b) -> c) -> (a -> g b) -> g b
21:25 carlomagno joined
21:25 mrus joined
21:25 <xplat|work> *then cotraverse :: ((a -> b) -> c) -> (a -> g b) -> g c
21:26 <Gurkenglas> g's the ((->) r), not f
21:26 <xplat|work> no reason they couldn't both be
21:26 <xplat|work> in a specific case
21:26 xcmw joined
21:27 ragepanda joined
21:27 <Gurkenglas> You'll want a to be Bool then, if you want to use this to implement Applicative for g.
21:27 <Gurkenglas> (or Void, for the case of pure)
21:28 <xplat|work> no, i don't want a to be Bool, because then i'd just need hack again
21:28 <xplat|work> which would be pointless
21:28 Guest45076 joined
21:28 <Gurkenglas> You only have two g's, though. Where will you take more, if a has more than two elements?
21:30 northfurr joined
21:30 <xplat|work> i could make more, by fmapping things
21:30 <xplat|work> or by using pure
21:31 phyrex1an joined
21:31 <xplat|work> what if i let a be 'g d'
21:32 augur joined
21:32 <xplat|work> then cotraverse :: ((g d -> b) -> c) -> (g d -> g b) -> g c
21:33 <xplat|work> i guess that one won't work
21:33 tomboy65 joined
21:34 mmachenry joined
21:34 <Gurkenglas> No, my counterargument fails against that one, you might be on to something, lemme see
21:35 <Gurkenglas> It's kinda cheating because if each g generates a g to give back then where'd the original 2 gs come in?
21:35 sfcg joined
21:37 <thang1_> So I have a question I'm stuck on
21:37 <thang1_> (and by stuck I mean way overthinking everything)
21:38 oisdk joined
21:38 <mojjo> Gurkenglas: still struggleing with the `add` implementation using `alter`, wouldn't I rather need `(Maybe a -> a)` in there instead of `(Maybe a -> Maybe a)`?
21:38 tzh joined
21:39 soniku joined
21:39 <mauke> :t Just . (?v :) . fromMaybe []
21:39 <lambdabot> (?v::a) => Maybe [a] -> Maybe [a]
21:39 <Gurkenglas> mojjo, the fact that you can add elements, but not remove them, leads to an asymmetry. You can express it by attaching "Just ." to the left of the (Maybe a -> a).
21:40 <nshepperd> i'm not sure about the Applicative superclass if <*> can only be written with the partial function
21:40 <Gurkenglas> mojjo, take a note to look at non from the lens library once you are fully grown as a Haskeller
21:40 tomphp joined
21:40 <thang1_> "fully grown as a Haskeller" such a cute way to phrase that
21:40 mrus joined
21:41 balor joined
21:41 <hexagoxel> (mojjo: perhaps using `unionWith (++)` and `singleton` would be prettier than `alter`, if less efficient)
21:41 <Gurkenglas> nshepperd, if it's a superclass we don't need to x)
21:41 <Gurkenglas> nshepperd, what in a case where it's even worse where the superclass relation can be proven, but not constructed?
21:42 <Gurkenglas> Oh hey, that can't be true, can it? We can just look at the Free Distributive. *lpaste*
21:43 <edwardk> gurkenglas a lot of folks consider lens rather overgrown :)
21:43 <Gurkenglas> Maybe edwardk's already through this. Why isn't Monad a superclass of Distributive?
21:44 <edwardk> instance Distributive (Compose f g)
21:44 <edwardk> go convince everyone that representable composition is the one true way to make that a Monad
21:45 <thang1_> While you're at it, convince them that bikesheds should always be painted orange
21:45 <edwardk> i'm likely to make it have an Applicative superclass
21:45 <edwardk> easier sell, instances all exist
21:45 <edwardk> and an explicit join member could be added
21:45 <thang1_> That'd be pretty nice (I think; I'm still far from groking lenses)
21:45 <edwardk> which would recover the missing bit of functionality
21:46 <mojjo> hexagoxel: the unionWith looks like a very clean way to express this.. is it way slower?
21:46 <Gurkenglas> I'm eager for join's implementation
21:46 <edwardk> just needs a reasonable name
21:46 <nshepperd> which 'join'
21:46 <edwardk> itd be an extra obligation for all providers
21:46 <Gurkenglas> no I mean how does one construct it from distribute
21:46 <edwardk> you cant
21:47 <thang1_> Forgive me if I sound stupid but is join not an acceptable name for join?
21:47 <edwardk> hence missing bit of functionality
21:47 justin2 joined
21:47 <edwardk> thang1_ it'd collide with the monad version
21:47 carlomagno joined
21:47 <nshepperd> you're talking about the Monad join?
21:47 <edwardk> it usually gets imported unqualified
21:47 <edwardk> yes
21:47 <thang1> oh right, that makes sense
21:47 <Gurkenglas> huh my guess was right :D so wouldn't this mean that Monad can't be a superclass of Distributive because of the Free Distributive?
21:48 <edwardk> i dont know this free distributive
21:48 balor joined
21:48 <edwardk> monad should be a superclass of distributive
21:48 oisdk joined
21:48 <edwardk> it cant be for cultural reasons
21:48 <edwardk> if your free distributive cant be a monad then it really isnt distributive
21:48 <edwardk> at least what distributive is modeling
21:48 <hexagoxel> mojjo: no, especially when you are inserting single elements anyways. and if you have multiple, you can unionWith two maps.
21:49 <edwardk> the current class is a rough approximation of the real thing
21:49 <edwardk> representable is a better distributive anyways
21:49 <Gurkenglas> Oh, I thought the dictionary record that can be abused for a free Foldable works for any class
21:49 <edwardk> distributive just needs fewer extensions
21:50 <edwardk> Distributive f is exists x such that forall a. f a is isomorphic to x -> a
21:50 <edwardk> that is what it means
21:50 <edwardk> the current impl is an approximation of that in haskell 98
21:51 <mojjo> Gurkenglas: now I'm getting what you meant with the `Just .`. Didn't know that alter can delete as well in case of a Nothing.. Not fully grown Haskellers take their time..
21:51 <edwardk> representable gives access to 'x'
21:51 <edwardk> distributive forces you to talk about it obliquely
21:51 e14 joined
21:52 <Gurkenglas> Wouldn't it be advantageous in some cases to not explicitly talk about x?
21:52 <edwardk> giving distributive a monad superclass lets you state the rest of the things you can't currently say out of the side of your mouth about distributive
21:52 hiratara joined
21:53 <Tuplanolla> Say, is there a function for turning two collections into an isomorphism?
21:53 <Tuplanolla> That would be something like `f a -> f b -> (a -> b, b -> a)`.
21:53 <edwardk> gurkenglas: it can be nice to not have to write the "logarithm"/representation
21:53 carlomagno joined
21:53 rrampr joined
21:53 <edwardk> but there are no thpes thay can be really distributive and not representable except due to information hiding
21:53 <edwardk> er thpes
21:54 <edwardk> er types
21:54 <edwardk> anyways, plane tsking off
21:54 <edwardk> gotta go
21:54 <thang1> have a good flight!
21:55 <Gurkenglas> Tuplanolla, you mean \x y -> let xy = zip x y in (fromJust (`lookup` x), fromJust (`lookup` y))?
21:55 <Gurkenglas> Wah composition missing, imagine points there
21:56 darjeeling_ joined
21:57 <Tuplanolla> So that I could derive `(ord, chr)` from approximately `magicIso ['\NUL' ..] [0 ..]`, Gurkenglas.
21:58 okuu joined
21:58 <Gurkenglas> Tuplanolla, yea lookup. Or do you want something faster?
21:59 arcsin joined
21:59 jship joined
21:59 <Tuplanolla> I certainly expected the perfect solution to already exist.
21:59 ragepanda joined
21:59 JeanCarloMachado joined
22:01 sproingie joined
22:02 <Gurkenglas> :t \x y -> ((M.fromList (zip x y) M.!), (M.fromList (zip y x) M.!)) -- Tuplanolla. Or do you want something faster than logarithmic time?
22:02 <lambdabot> (Ord k, Ord a) => [a] -> [k] -> (a -> k, k -> a)
22:02 chao-tic joined
22:03 <Gurkenglas> Oh, um, HashMaps probably get you O(1) right
22:03 <Tuplanolla> I'd do it with `Vector` if I needed to, Gurkenglas.
22:03 Fairy joined
22:04 inr_ joined
22:04 ziocroc joined
22:05 sfcg joined
22:07 nille joined
22:10 <vimalloc> Dumb question of the hour. With all the magic that is haskell (lazy evaluation and functional programming), is inserting an element into a list O(1) or O(n)?
22:11 <int-e> yes.
22:11 <Rembane> vimalloc: It depends.
22:11 mmachenry joined
22:11 <vimalloc> This whole learning haskell thing is making my brain twist in ways I didn't even know was possible :P
22:11 revprez_atlanta joined
22:11 <Rembane> vimalloc: But you're on the safe side if you just assume the worst. :)
22:11 <int-e> If you make it fully lazy then insertion will be O(1) but getting elements from the resulting list gets more expensive for every "pending insertion" operation.
22:12 <Rembane> vimalloc: Fun!
22:12 <magneticduck> vimalloc: for algorithmic purposes, a haskell list is more or less a singly linked list
22:12 JeanCarloMachado joined
22:12 perrier-jouet joined
22:12 <vimalloc> awesome. Thanks guys :)
22:12 <magneticduck> patterns like "tying the knot" and libraries like lens are the things that should be twisting your brain :p
22:13 <vimalloc> Hopefully I'll get there soon :)
22:13 <int-e> In the end you won't escape the linear time cost per insertion (assuming you're inserting at random places in the list).
22:14 <vimalloc> Is that different if you are always inserting at the front of the list, ie 'a' : "foobarbaz"?
22:14 takle joined
22:14 <magneticduck> `:` is quite literally a constructor
22:14 <int-e> vimalloc: So it's worthwhile to use data structures like finger trees (as used in Data.Sequence) which have constant time access to head and tail and O(log(n)) random insertion.
22:15 <vimalloc> Wonderful. Thx
22:15 jleon joined
22:16 <int-e> Hmm, somehow I'm thinking about insertion by index here... if you want insertion by key, the usual search trees are probably best. Do we have finger tree variants of those?
22:17 cyborg-one joined
22:18 Itkovian joined
22:22 conal joined
22:28 Hunter1_ joined
22:28 northfurr joined
22:28 Tharbakim joined
22:28 Tharbakim joined
22:29 JeanCarloMachado joined
22:29 `0660 joined
22:32 jmcarthur joined
22:34 tromp joined
22:34 doomlord_ joined
22:35 jleon joined
22:36 <dmwit> vimalloc: (:) is O(1)
22:36 <dmwit> Well. O(whatever you believe your allocator costs) ;-)
22:37 <vimalloc> heh
22:37 <EvanR> isnt any 2-arg function O(1) in haskell ;)
22:37 <vimalloc> O(1 magical rabbit)
22:37 uglyfigurine joined
22:37 <EvanR> (:) x :: [a] -> [a], completes instantly
22:37 perrier-jouet joined
22:37 takle joined
22:38 <dmwit> EvanR: I bet I can write a two-argument function which is nevertheless expensive even with only one argument.
22:38 <kadoban> Depends what model you use I suppose. I think you have to consider more than just what it costs to build the thunk.
22:38 <EvanR> youre right
22:38 matthewbauer joined
22:38 <dmwit> > let f x = case last [1..1000000000] of x -> \y -> x in f 3 `seq` ()
22:38 <lambdabot> ()
22:40 uglyfigu_ joined
22:40 <dmwit> > let f x = last [1..] `seq` \y -> 3 in f 3 `seq` ()
22:40 <lambdabot> mueval: ExitFailure 1
22:41 NoCreativity joined
22:42 matthewbauer joined
22:43 e14 joined
22:43 tromp joined
22:44 ragepanda joined
22:44 erisco joined
22:45 joelburget joined
22:46 HoierM joined
22:46 luckymerlin joined
22:47 oldsk00l joined
22:48 sagax joined
22:50 Hunter1_ joined
22:53 hive-mind joined
22:53 justanotheruser joined
22:54 JeanCarloMachado joined
22:54 ertes joined
22:57 mjora7 joined
22:58 Levex joined
22:59 joelburget joined
22:59 <Gurkenglas> > let f x = \y -> last [1..1000000000] in f 3 `seq` () -- Why not write the first one like so?
22:59 <lambdabot> ()
23:00 cschneid_ joined
23:00 uuplusu_ joined
23:03 path[l] joined
23:05 pgiarrusso joined
23:06 JeanCarloMachado joined
23:07 dan_f joined
23:09 Dance_ joined
23:10 Seb_ joined
23:11 jleon joined
23:12 perrier-jouet joined
23:12 joelburget joined
23:14 uglyfigurine joined
23:17 soniku joined
23:19 Koterpillar joined
23:21 fosterite joined
23:22 soniku joined
23:23 Elhamer_ joined
23:26 joelburget joined
23:27 dual joined
23:27 Awad joined
23:28 <Awad> Hey
23:28 <Awad> Are there any good hacker in here
23:28 nakal joined
23:28 <glguy> Awad: Did you have a question about Haskell?
23:29 a3Dman joined
23:29 cschneid_ joined
23:29 <Awad> I need to know if there are any good hacker in the chat room
23:29 <glguy> OK, looks like you're on the wrong IRC server
23:29 <Gurkenglas> I mean, I had that course about network security. What do you want to know?
23:29 <hpc> please to asking #ops they knows what do for hacking the gibson
23:30 <ChaiTRex> Eddie Haskell was sneaky.
23:30 <ChaiTRex> Maybe that's why they're asking here.
23:30 <Awad> I need someone to hack a snapchat account password
23:31 <pacak> Awad: Would you like to learn Haskell instead?
23:31 was kicked by glguy: offtopic
23:32 dual_ joined
23:32 <hpc> pacak: A for effort, but i don't think "smother them with kindness" would have worked here
23:32 <pacak> hpc: It works sometimes,
23:33 prophile joined
23:34 justin2 joined
23:34 <Tuplanolla> I wonder what would happen to this place if I wrote a free book called Haskell for Hackers featuring nothing but simple exploits.
23:34 aarvar joined
23:35 <Koterpillar> Tuplanolla: in Haskell?
23:35 <EvanR> how about a book about exploiting haskell programs
23:35 <Tuplanolla> Of course, Koterpillar.
23:35 <pacak> unsafeCoerce :: [a] -> Maybe a? :)
23:35 <ChaiTRex> Find the flaws in the RTS!
23:36 Jesin joined
23:36 benl23 joined
23:37 <hpc> pacak: i have debated off and on writing an acme-coerce package that defines a bunch of useful things in terms of nothing but unsafeCoerce ;)
23:37 cjwelborn joined
23:37 jetho joined
23:37 <hpc> yours is safeHead
23:37 chao-tic joined
23:37 <erisco> or maybe it is safeLast
23:38 <hpc> it would be ghc-specific
23:38 <erisco> Tuplanolla, like Hacker's Delight but for Haskell?
23:39 <Tuplanolla> No, erisco. This one looks educational and legal. Ideally it would be neither.
23:39 dual joined
23:42 giraffe joined
23:43 fosterite joined
23:43 luckymerlin joined
23:43 Freundlich joined
23:43 theDon_ joined
23:46 markus1189 joined
23:46 revprez_atlanta joined
23:46 markus1199 joined
23:47 aminb joined
23:48 matthewbauer joined
23:48 matthewbauer joined
23:49 ploop joined
23:50 balor joined
23:50 oisdk joined
23:52 sellout- joined
23:53 hybrid joined
23:54 darlan joined
23:55 root_____ joined
23:56 balor joined
23:58 infinity0_ joined
23:58 infinity0_ joined
23:58 YongJoon joined
23:59 frampton left