Search Haskell Channel Logs

Tuesday, January 31, 2017

#haskell channel featuring lambdabot, orzo, jchia_, Cale, nshepperd, kqr,

kqr 2017-01-31 19:53:51
Is "const (f . g) = f . const g" true? May be the lack of morning coffee but I'm really struggling to see it, yet there is some intuitive sense to it
kqr 2017-01-31 19:56:41
Types check out so I'll roll with it!
kqr 2017-01-31 19:57:10
Wait no they don't
kqr 2017-01-31 19:57:36
Or wait yes they do
kqr 2017-01-31 19:57:43
(you see my suffering!)
nshepperd 2017-01-31 19:58:57
:t \f g -> (const (f . g), f . const g)
lambdabot 2017-01-31 19:58:59
error:
lambdabot 2017-01-31 19:58:59
• Occurs check: cannot construct the infinite type: b1 ~ a -> b1
lambdabot 2017-01-31 19:58:59
Expected type: b2 -> b1
nshepperd 2017-01-31 19:59:43
:t \f g -> (const (f g), f . const g) -- actually this i think
kqr 2017-01-31 19:59:44
Hm
lambdabot 2017-01-31 19:59:45
(a -> c) -> a -> (b -> c, b1 -> c)
nshepperd 2017-01-31 20:02:40
(f . const g) x = f (const g x) = f g -- checks out
kqr 2017-01-31 20:12:27
yeah you're right. they don't line up quite as neatly as I'd like them to
orzo 2017-01-31 20:26:36
is a case statement matching String compiled similarly to an if-else chain? Or does the compiler do a binary search or something?
Cale 2017-01-31 20:28:10
It's compiled to a guard that uses (==)
orzo 2017-01-31 20:29:28
well, i mean beyond core
orzo 2017-01-31 20:29:48
i guess an == guard would be hard to do a binary search with
Cale 2017-01-31 20:32:48
It's sort of a weird thing to worry about because if you cared about performance, you likely wouldn't be using String. You can use string-literal pattern matches with Text, using the OverloadedStrings extension, and in that case, the fact that it compiles to a guard with (==) is reasonably good.
orzo 2017-01-31 20:33:53
it's not that i'm woried, i just like to know the run-time effects when i reorganize code
nshepperd 2017-01-31 20:33:56
it would most likely be a chain of == calls, at asm level
orzo 2017-01-31 20:34:29
changing a case to a dumb traveral over a list
nshepperd 2017-01-31 20:36:10
for data types with lots of options like data X = A | B x | C y | D, case match could be compiled into one of those fancy array dispatch thingys based on the constructor tag
orzo 2017-01-31 20:36:13
if case match is always an order-n scan, then i should feel freer to write it that way
nshepperd 2017-01-31 20:36:25
but i dunno if that ever really happens
jchia_ 2017-01-31 20:37:54
When I do the following, it's possible to get back "defabc" as well as "abcdef" when I enter "abc\ndef\n" on the console, correct?
jchia_ 2017-01-31 20:37:55
(++) <$> getLine <*> getLine
orzo 2017-01-31 20:38:12
no
orzo 2017-01-31 20:38:27
it'll always give you abcdef
jchia_ 2017-01-31 20:38:40
orzo: Why? >>= has sequencing, but <*>?
orzo 2017-01-31 20:39:20
well, you mean <*> for IO right
Cale 2017-01-31 20:39:22
af <*> ax = do f <- af; x <- ax; return (f x)
jchia_ 2017-01-31 20:39:25
orzo: yes
nshepperd 2017-01-31 20:39:30
'mf <*> mx' runs mf first, then mx, then applies the result of the first to the second
nshepperd 2017-01-31 20:39:32
in IO
jchia_ 2017-01-31 20:39:48
so the sequencing is because of how <*> is defined for IO, right?
orzo 2017-01-31 20:39:52
and probably all other side-efecting monads
orzo 2017-01-31 20:40:29
you mean, does doing different break the applicative rules?
Cale 2017-01-31 20:40:42
Yeah, generally if something is an instance of Monad, you'll have (<*>) = ap
jchia_ 2017-01-31 20:41:23
orzo: I mean generally in a Monad, >>= enforces a an order between the LHS & RHS but <*> does not, but IO defines <*> in a way that there's also an order.
jchia_ 2017-01-31 20:42:14
i mean if you define <*> with ap, you get the sequencing, but generally you don't have to.
orzo 2017-01-31 20:42:23
but <*> does and I'd be surprised if i encountered a <*> that reversed it
jchia_ 2017-01-31 20:42:24
for IO it happens to have the sequencing
orzo 2017-01-31 20:42:58
the documentation describes <*> with the word "sequence": sequence computations and combine their results (<*>).
Cale 2017-01-31 20:43:14
jchia: Well, the documentation for Applicative now states that if the functor in question is also an instance of Monad, it should satisfy (<*>) = ap
Cale 2017-01-31 20:43:39
jchia: This is mildly controversial, but a reasonably nice thing to be able to assume.
orzo 2017-01-31 20:44:36
what was the argument against
Cale 2017-01-31 20:45:12
Well, there are some very rare cases where you might want the Applicative and Monad instances to disagree.

#haskell channel featuring jle`, mrkgnao, _sras_,

mrkgnao 2017-01-31 18:45:16
and the typechecker wants me to expand this out into the (a -> f a) -> b -> f b form and add an Applicative constraint
mrkgnao 2017-01-31 18:45:40
should I change this to a Traversal'? I don't know anything about those though
jle` 2017-01-31 18:46:27
mrkgnao: have you turned on RankNTypes?
jle` 2017-01-31 18:47:06
oh, but yeah, if your function only works on Applicative f, it'd be Traversal'
mrkgnao 2017-01-31 18:47:15
I have, at intero's suggestion
jle` 2017-01-31 18:47:23
Traversal' is basically Lens' constrained to all Applicatives instead of just all Functor's
jle` 2017-01-31 18:48:28
Lens' a b = forall f. Functor f => (b -> f b) -> (a -> f a)
jle` 2017-01-31 18:48:39
Traversal' a b = forall f. Applicative f => (b -> f b) -> (a -> f a)
mrkgnao 2017-01-31 18:49:15
uh, why does my a-type need to be a Monoid?
mrkgnao 2017-01-31 18:49:28
pretty sure I'm making a dumb mistake somewhere
jle` 2017-01-31 18:51:21
hm, what do you mean?
mrkgnao 2017-01-31 18:51:41
jle`: I'm trying to get an AsmInst from a VMState
mrkgnao 2017-01-31 18:52:09
so I tried doing vm ^. instAt i, and it says AsmInst doesn't have a Monoid instance
mrkgnao 2017-01-31 18:57:49
I'm very confused now
mrkgnao 2017-01-31 19:04:36
oh, I should've done vm ^?! instAt i instead. huh.
_sras_ 2017-01-31 19:43:17
Using TH, how can I generate a toplevel call to a template haskell function. I mean, I want to generate a bunch of code, one of which is a call to an external TH function....

#haskell channel featuring jle`, steve___, kadoban, MP2E, jchia_1, mrkgnao, and 5 others.

Squarism 2017-01-31 17:47:15
theres no easy way to create a singleton list wo using [...]
Squarism 2017-01-31 17:47:16
?
kadoban 2017-01-31 17:48:00
pure, return, or what's wrong with using [a] ?
jle` 2017-01-31 17:48:22
> pure 10 :: [Int]
lambdabot 2017-01-31 17:48:24
[10]
jchia_1 2017-01-31 17:52:08
Where can I go to learn what exactly exceptions are in Haskell from first principles? Neither modules like Control.Monad.Error nor packages like safe-exceptions, nor any of the schools of thoughts about how exceptions should be used, nor how async exceptions should handled, per se, but mainly the meaning of exceptions, async exceptions, masks, they relationship to one another and to the RTS, and what they mean for the behavior of a program?
jchia_1 2017-01-31 17:52:56
once i understand these, i can understand those modules and packages in their context
jchia_1 2017-01-31 17:54:12
i know what it means in another language like C++ to catch and throw. in haskell, it seems it's not so straight-forward given the existence of 'async' and 'mask' and I'm not sure what those mean exactly to program behavior.
jle` 2017-01-31 17:56:04
jchia_1: for me, it was that exceptions chapter in Parallel & Concurrent haskell
Squarism 2017-01-31 17:56:16
kadoban, sometimes you want to cram a big expression in that that list constructor.. then it just gets messy with matching brackets
Jello_Raptor 2017-01-31 17:56:46
Hmm, do any of you know if it's possible to get TypeApplication to play nicely with infix operators? or failing that a suggestion that lets me get a vaguely nice syntax for my edsl? http://lpaste.net/351856 line 4 and 9 are what I want, but line 38 is the only thing that works.
Squarism 2017-01-31 17:56:48
...sure, one could argue, defenine the element first. But it could be good to know a non infix(?) version
jchia_1 2017-01-31 17:56:50
jle`: OK, I'll look that up.
jle` 2017-01-31 17:57:48
jchia_1: http://chimera.labs.oreilly.com/books/1230000000929/ch08.html#sec_exceptions
Jello_Raptor 2017-01-31 17:58:56
Right now, it seems like TemplateHaskell is the only way to get something approximating record syntax and that's horrible overkill for what I'm aiming to do
steve___ 2017-01-31 18:00:04
:q
kadoban 2017-01-31 18:01:53
Squarism: Well, pure or (:[]) then ?
geekosaur 2017-01-31 18:02:04
Jello_Raptor, I don';t think anything requires TH for this; it's a convenience to auto-derive typeclass instances
Squarism 2017-01-31 18:02:22
kadoban, thanks
Jello_Raptor 2017-01-31 18:09:35
geekosaur: I'm not looking for an actual record syntax, it's just that my edsl uses a lot of record-like structures and I want a nice looking way to enter record-like data. I've updated the paste with some examples http://lpaste.net/351856
Jello_Raptor 2017-01-31 18:12:37
barring that, some way to get nice looking for record-like things would be nice
Squarism 2017-01-31 18:35:43
running stack to compile it seems cpu utilization is mostly 100% on 1 and like 2-4% on the 3 rest cores. Does one need to do something to get a better spread/utilization?
Squarism 2017-01-31 18:36:01
core
Squarism 2017-01-31 18:36:03
that is
Squarism 2017-01-31 18:36:34
100% on 1, just barely alive on the 3 rest
qmm 2017-01-31 18:36:39
what is the difference between Float, Double, and Rational?
Squarism 2017-01-31 18:37:55
rational numbers are integer/integer right?
Squarism 2017-01-31 18:38:44
float and double are just different precision - float beeing of less
Jello_Raptor 2017-01-31 18:38:45
yup
Jello_Raptor 2017-01-31 18:39:33
Squarism: also yes, with the caveat that there's more precision the closer you are to 0 with floating point.
Squarism 2017-01-31 18:39:55
oh ok, didnt know that
MP2E 2017-01-31 18:40:04
yep. Floating point corresponds to a 32-bit floating point value, Double corresponds to a 64-bit floating point value, and Rational represents it in fractional form using integers
MP2E 2017-01-31 18:40:16
float*
MP2E 2017-01-31 18:40:46
Float and Double would usually be faster than Rational, but may (read: most likely will) lose some precision
Squarism 2017-01-31 18:41:57
Jello_Raptor, but isnt the mantisa larger for double - regardless of exponent?
mrkgnao 2017-01-31 18:44:47
I wrote a function with this signature:
mrkgnao 2017-01-31 18:44:49
instAt :: Int -> Lens' VMState AsmInst

#haskell channel featuring mrkgnao, steve___, Koterpillar, fiddlerwoaroof, geekosaur,

fiddlerwoaroof 2017-01-31 16:47:37
Set of tests for compliance to the standard?
fiddlerwoaroof 2017-01-31 16:47:54
s/^/Is there a /
Koterpillar 2017-01-31 16:48:32
which standard?
fiddlerwoaroof 2017-01-31 16:48:51
I was thinking of the Haskell98 report
geekosaur 2017-01-31 16:54:47
it'd be the haskell2010 report, but ghc is known noncompliant in several areas (Num no longer requires Eq or Show; Monad requires Applicative and thereby Functor)
fiddlerwoaroof 2017-01-31 16:56:26
Yeah, I've been doing some archeology to try to get the yale-haskell compiler running
fiddlerwoaroof 2017-01-31 16:56:54
Mostly for fun, and because I'm interested in embedding functional languages in a common lisp environment.
fiddlerwoaroof 2017-01-31 16:57:10
I sort of wanted to see how complete it is.
mrkgnao 2017-01-31 17:17:00
is there a way to not have to use liftIO when using monad transformers?
mrkgnao 2017-01-31 17:17:28
I guess what I want is things like putStrLn :: MonadIO m => String -> m ()
Koterpillar 2017-01-31 17:21:05
mrkgnao: http://hackage.haskell.org/package/safer-file-handles
steve___ 2017-01-31 17:24:29
If one were creating a module that had multiple types that all required a similar field, say "name" and there were a need to have dedicated types for each one, what is the canonical way to create several types that share the same field? Do I create the various types, all with prefixes to the name? use Ghc8s duplicate record label feature? For example data Book = Book { name :: String} data Movie = Movie
steve___ 2017-01-31 17:24:35
{ name :: String}. I often see this problem and think I must be needing to use a feature like typeclasses...but i'm not sure. Hope that makes sense! :)
mrkgnao 2017-01-31 17:30:39
steve___: you might want to check out what haskell-gi does with overloaded labels
steve___ 2017-01-31 17:34:40
So I took a quick look, but I don't see anything special. What am I missing? :(

#haskell channel featuring noan, sm, Cale, Welkin, geekosaur, Koterpillar,

noan 2017-01-31 16:03:50
https://gist.github.com/AlexaDeWit/5cb6b2a6c0462f53cde300c3fa110813
Squarism 2017-01-31 16:03:55
ive learned i can define functions in this manner : \n data Lal = Lal { a :: Int } \n let f Lal { a = x } = 2*x
noan 2017-01-31 16:04:06
so close, got so far, but in the end, fucking tls problems
Squarism 2017-01-31 16:04:58
but if i make Lal a lens.. compiler complains '_a' is not a (visible) field of constructor of Lal
Squarism 2017-01-31 16:06:01
sorry.. my bad
Cale 2017-01-31 16:06:27
Squarism: you figure out what was wrong?
Squarism 2017-01-31 16:06:38
yep
Squarism 2017-01-31 16:06:43
thanks anyway
noan 2017-01-31 16:09:16
sm, don't suppose you've seen anything like that before? Firefox seems happy with the cert from haskell.org....
Koterpillar 2017-01-31 16:11:31
noan: GHC might be using the certificate store from mingw or somewhere like that (guessing, I'm not using windows)
Koterpillar 2017-01-31 16:11:43
noan: I wanted to say strace, but heh
noan 2017-01-31 16:13:24
thanks
noan 2017-01-31 16:13:46
For now, since it's just a baby test project, I'll just use the shitty workaround. I'll worry about real fixes later.
sm 2017-01-31 16:13:46
noan: your paste is truncated, but it gives the appearance of the first failure being a timeout
sm 2017-01-31 16:13:52
I assume you've retried a few times
noan 2017-01-31 16:15:04
commented it in full properly, sorry
sm 2017-01-31 16:15:14
oh, maybe not a timeout
noan 2017-01-31 16:15:45
nope, it just doesn't accept the CA from haskell.org, but does from stackage and others.
sm 2017-01-31 16:19:11
noan: I see some related-looking discussion eg at https://github.com/commercialhaskell/stack/issues/1922, but no mention of how to fix on windows
sm 2017-01-31 16:20:17
I'd open an issue in the hoogle tracker
Squarism 2017-01-31 16:21:17
ive learned that cabal-the-library is quite a primitive building framework dont offering much in conveniance. Like complete rebuilds happening when the arent needed. Issues where you have to restate your dependendencies even if information is available. I wonder why its so - is it extra hard to build a builder for haskell code?
sm 2017-01-31 16:24:35
noan: one or two possible workarounds mentioned at https://github.com/commercialhaskell/stack/issues/234
sm 2017-01-31 16:25:26
"It can be fixed by opening the correct webpage in Internet Explorer (which automatically adds the certificate)"
noan 2017-01-31 16:26:00
yet firefox doesn't
noan 2017-01-31 16:26:00
lol
geekosaur 2017-01-31 16:27:09
doesn't firefox use its own cert store?
Welkin 2017-01-31 16:28:35
Squarism: use nix
noan 2017-01-31 16:29:12
opening it in ms edge really did fix it. What a laugh
Squarism 2017-01-31 16:29:24
Welkin, many people do that? Or is it highly experimential / bleeding edge?
Welkin 2017-01-31 16:30:31
nix is popular
Squarism 2017-01-31 16:33:44
ok.. good to know. Ill try it

#haskell channel featuring sm, Cale, Welkin, markasoftware, noan, Koterpillar,

noan 2017-01-31 14:47:58
should hoogle be a local dependency, or a global install, as it is a user choice? I assume the later, and then gitignore all project-local hoogle data?
Jello_Raptor 2017-01-31 15:02:26
is there a package where I can find `newtype Fix f = In (f (Fix f))` defined somewhere?
Jello_Raptor 2017-01-31 15:03:00
It's easy enough to add my own, but I'd rather use a standard one somewhere if possible.
Koterpillar 2017-01-31 15:03:59
Jello_Raptor: http://hayoo.fh-wedel.de/?query=Fix -> data-fix?
Jello_Raptor 2017-01-31 15:05:39
huh, I guess it's not in stackage yet
noan 2017-01-31 15:08:33
anyone around doing haskell on windows?
markasoftware 2017-01-31 15:09:23
hopefully not
markasoftware 2017-01-31 15:09:35
hopefully nobody's doing anything on windows
Cale 2017-01-31 15:09:51
Eh, some people do -- SPJ works on Windows, from what I recall
Cale 2017-01-31 15:10:08
and Neil Mitchell
Cale 2017-01-31 15:10:41
I don't know about anyone who is around right now :)
noan 2017-01-31 15:10:42
markasoftware, I am because game development. Was thinking of doing the rest backend in haskell, but a lot of dependencies can't install via stack
markasoftware 2017-01-31 15:11:11
well, i guess with game dev you don't have much of a choice
noan 2017-01-31 15:11:12
fast-logger build results in this. Trying to install hoogle...
noan 2017-01-31 15:11:12
error: macro names must be identifiers
noan 2017-01-31 15:11:12
#ifdef !MIN_VERSION_win32(2,3,1,0)
noan 2017-01-31 15:11:12
^
noan 2017-01-31 15:11:12
`gcc.exe' failed in phase `C pre-processor'. (Exit code: 1)
Koterpillar 2017-01-31 15:11:21
noan: you can add arbitrary packages with stack.yaml
ROBOT9001 2017-01-31 15:12:36
Is this the place to ask for help?
Koterpillar 2017-01-31 15:12:53
ROBOT9001: with Haskell, surely
sm 2017-01-31 15:13:05
noan: basically, a certain portion of hackage includes C as well as haskell, and these often won't build easily on windows
sm 2017-01-31 15:13:39
so when choosing packages, you should scan their dependencies (eg for "unix")
Cale 2017-01-31 15:13:49
That right there is kinda weird though, because I wouldn't expect that macro name to be an issue
noan 2017-01-31 15:13:49
sm, sooo, am I SOL or is there a workaround that isn't such a pain in the ass that I just swap off haskell for this project entirely?
sm 2017-01-31 15:14:06
well, why do you need fast-logger ?
noan 2017-01-31 15:14:20
it is a dependency of hoogle, which I kind of wanted to use.
sm 2017-01-31 15:14:41
I see it does also depend on Win32, which means it almost certainly should work on windows. Also hoogle's author uses windows
sm 2017-01-31 15:14:58
how did you set up your haskell environment
noan 2017-01-31 15:15:19
installed stack. Stack setup.
ROBOT9001 2017-01-31 15:15:29
I'm having trouble opening WinGHCi, it opens, but it stops responding as soon as it does. Then after clicking in the window, Windows 7 just asks to close the program.
sm 2017-01-31 15:17:05
noan: installed stack using the installer from https://haskell-lang.org/get-started I guess ?
Welkin 2017-01-31 15:17:08
to fix windows problems, use linux
Welkin 2017-01-31 15:17:14
you could even just install a vm
Koterpillar 2017-01-31 15:17:50
Welkin: and tell your customers to?
noan 2017-01-31 15:17:57
Welkin, https://www.stackage.org/stack/windows-x86_64
sm 2017-01-31 15:17:58
please let's not waste time going down that thread :)
noan 2017-01-31 15:18:06
er, wrong response. sm sorry
noan 2017-01-31 15:18:41
Welkin, I generally prefer linux, but flipping between windows and a VM would drive me mad.
sm 2017-01-31 15:19:21
noan: well, you seem to be doing the right things and like Cale I'm surprised it's not working. Time to search/report in fast-logger & stack issue trackers perhaps
noan 2017-01-31 15:19:22
that's a recipe for a really shitty frustrating workflow in my eyes
noan 2017-01-31 15:19:42
sm, it's not -just- fast-logger though
noan 2017-01-31 15:20:52
or, it is this time. last time I tried from git-bash I got a full page of different errors out
sm 2017-01-31 15:21:25
hm. Have you tried from a regular cmd prompt
noan 2017-01-31 15:24:32
sm, yes, fast-logger still throws a shitfit. a friend found the error report somewhere that said it had recently been fixed specifically for fast-logger. Gonna try using nightly as a resolver just for a second and see if that gets me anywhere.
noan 2017-01-31 15:25:16
sadly she didn't link me and has since gone to shower
sm 2017-01-31 15:26:19
https://github.com/kazu-yamamoto/logger/issues/118
noan 2017-01-31 15:27:35
*cheers nightly on*
noan 2017-01-31 15:39:17
hoogle has successfully installed via nightly resolver.
noan 2017-01-31 15:39:28
incase anyone asks you later the same question, sm
sm 2017-01-31 15:40:23
thanks noan, I figured it would from fast-logger's changelog etc.
noan 2017-01-31 15:40:45
I just feared additional dependencies may fail.
sm 2017-01-31 15:41:42
glad you got it resolved. A little alarming I guess if you're used to things in stackage LTS just working
Cale 2017-01-31 15:42:34
sm: haha "resolved"
sm 2017-01-31 15:43:34
eh what I can't hear you
sm 2017-01-31 15:44:17
well, it does seem resolved ?
noan 2017-01-31 15:44:27
sm, he was making a pun
noan 2017-01-31 15:44:30
resolved via a resolver.
sm 2017-01-31 15:44:33
Owwwww
noan 2017-01-31 15:44:34
I belive.

#haskell channel featuring barryburd, glguy, markasoftware, Boomerang, qmm, Welkin, and 5 others.

qmm 2017-01-31 13:45:37
a = [188.38354691296536,180.9969223840326,173.89993154565036,167.08121769837453,160.5298694453072,154.23540323155294,148.187746568276,142.3772219145808,136.79453119137543,131.43074090246682]
qmm 2017-01-31 13:45:41
sum a / length a
qmm 2017-01-31 13:45:50
i would like to know how to do something like this...
qmm 2017-01-31 13:46:15
toInteger (sum a) / realToFrac $ length sum
glguy 2017-01-31 13:46:43
sum a / fromIntegral (length a)
qmm 2017-01-31 13:47:01
(sum a) :: Fractional a => a
qmm 2017-01-31 13:47:24
ah, i did the exact opposite
qmm 2017-01-31 13:47:36
fromIntegral $ sum a / length a
qmm 2017-01-31 13:48:18
Could not deduce (Foldable ((->) (t0 a0)))
qmm 2017-01-31 13:48:19
arising from a use of 'length'
qmm 2017-01-31 13:48:28
from the context: Fractional a
qmm 2017-01-31 13:48:38
bound by the inferred type of it :: Fractional a => a
qmm 2017-01-31 13:48:48
oh, right a pastebin, sorry
glguy 2017-01-31 13:48:51
qmm: That's because you wrote: length sum
qmm 2017-01-31 13:49:06
doh!
qmm 2017-01-31 13:51:17
glguy: i really appreciate you helping me. i now feel so embarassed, i will have to study https://wiki.haskell.org/Converting_numbers
Taslem 2017-01-31 13:54:05
I'm running into an incomprehensible error for what I think is a relatively simple use-case for GADTs:
Taslem 2017-01-31 13:54:07
http://lpaste.net/351841
Taslem 2017-01-31 13:54:30
(I'm using GHC 7.8.3 for the record)
Taslem 2017-01-31 13:55:29
The gist is that I want a length-encoded result list with a different type of element than the input to a certain function; but ghc explodes when I try to pattern match on the result, even though it knows what type it is
glguy 2017-01-31 13:56:45
Taslem: Add a type signature to example'
Taslem 2017-01-31 13:57:22
@glguy Wow, thanks. Why didn't ghc infer it as Bool?
lambdabot 2017-01-31 13:57:22
Unknown command, try @list
glguy 2017-01-31 13:57:53
Taslem: Because you're on an outdated GHC
Taslem 2017-01-31 13:58:12
Well that's simple. Thanks!
glguy 2017-01-31 13:59:00
pattern matching on GADTs tends to require explicit type signatures because of the restrictions around information flow of type information
glguy 2017-01-31 13:59:29
and it's an area that GHC is getting smarter about over time
Taslem 2017-01-31 13:59:40
I see. Does current GHC need a signature there?
glguy 2017-01-31 13:59:44
no
barryburd 2017-01-31 14:19:49
Dumb question alert!! I've defined k = (1, 2, "xyz") When I do :type k, the result is (num t1, Num t) => (t, t1, [Char]) Why isn't the result (Num, Num, [Char]) and why isn't the result (Num t1, Num t, Num t2) => )[t, t1, [t2]) ?
Welkin 2017-01-31 14:22:02
Num is not a type
Welkin 2017-01-31 14:22:05
it is a typeclass
Boomerang 2017-01-31 14:22:13
barryburd: Num is a type class, when on the left of => it is a constraint on t and t1. For example t and t1 could be Int, Float...
barryburd 2017-01-31 14:22:36
Type vs. typeclass. Thank you.
Boomerang 2017-01-31 14:23:29
barryburd: In your second example it cannot be [t2] because Char don't have a Num instance
barryburd 2017-01-31 14:24:23
Yeh, I meant (Num t1, Num t, Char t2), but I see why that wouldn't work.
Boomerang 2017-01-31 14:25:41
Right, haskell doesn't infer that 1 and 2 are Ints but rather that they have a Num instance, this way they could be Int, Float, Double or other depending on the use case
barryburd 2017-01-31 14:26:17
Thank you.
Welkin 2017-01-31 14:29:41
hi zipper
Welkin 2017-01-31 14:29:49
are you building anything lately?
noan 2017-01-31 14:35:03
is there a stack command to build and run on file change?
Koterpillar 2017-01-31 14:37:19
noan: --file-watch
noan 2017-01-31 14:38:51
Koterpillar, is there a way to compose that will run? sorry, very new to stack and coming from sbt
Koterpillar 2017-01-31 14:39:05
noan: stack build --file-watch --exec ...
noan 2017-01-31 14:39:19
ah thanks
Welkin 2017-01-31 14:40:06
sbt?
noan 2017-01-31 14:40:11
Scala Build Tool
Welkin 2017-01-31 14:40:14
ew
noan 2017-01-31 14:40:17
XD
noan 2017-01-31 14:40:34
Koterpillar, got it working, thanks
noan 2017-01-31 14:40:48
.... why is atom crashing with my haskell project open O.o
Welkin 2017-01-31 14:41:07
could be anything
Welkin 2017-01-31 14:41:17
but if you want a stable haskell editor, use emacs with haskell-mode
noan 2017-01-31 14:42:04
I've never been able to get into emacs. Maybe with evil mode I could try. I'll look around for a decent editor
Sonolin 2017-01-31 14:42:21
spacemacs + haskell-mode + evil = bliss
markasoftware 2017-01-31 14:42:22
vim <-- found one right here
Sonolin 2017-01-31 14:42:33
but yea vim works just as well (maybe not as shiny)
markasoftware 2017-01-31 14:42:36
noan: rearrange the letters of your name to find a decent editor
markasoftware 2017-01-31 14:42:44
;)
noan 2017-01-31 14:43:40
markasoftware, but nano sucks. also my name is a bad attempt at writing nån XD
markasoftware 2017-01-31 14:43:51
nano .vimrc
markasoftware 2017-01-31 14:44:45
are emacs keybindings as bad for your hand as the legend says
markasoftware 2017-01-31 14:44:48
?
Koterpillar 2017-01-31 14:45:04
vim with haskell-mode isn't bad either

#haskell channel featuring hpc, lambdabot, erisco, pikajude, antalsz, mr_sm1th, and 9 others.

janos 2017-01-31 12:47:12
dmj`, lambdabot, hpc: thanks guys! No I have something to read.
janos 2017-01-31 12:47:18
*now
jle` 2017-01-31 12:53:22
Jello_Raptor: there's one in type-combinators
jle` 2017-01-31 12:53:29
type-combinators has an HList too
hpc 2017-01-31 12:54:15
antalsz: ".Lazy" refers to the ByteString data type, not the IO
hpc 2017-01-31 12:54:27
antalsz: a lazy bytestring is a list of strict bytestring "chunks"
antalsz 2017-01-31 12:54:48
@hpc: And `writeFile` will force the whole thing and write it out?
lambdabot 2017-01-31 12:54:48
Unknown command, try @list
Jello_Raptor 2017-01-31 12:55:01
jle`: Thanks :)
glguy 2017-01-31 12:55:10
antalsz: @ is for bot commands
hpc 2017-01-31 12:55:18
yes, unless the documentation says it uses lazy IO
hpc 2017-01-31 12:55:30
which is usually very explicit because it's a source of bugs
antalsz 2017-01-31 12:55:32
glguy: I know, I've just been using Slack too much lately :-)
antalsz 2017-01-31 12:55:49
hpc: And that even answered my second question about how to know the answer! Thanks :-)
antalsz 2017-01-31 12:55:56
s/know/learn/
hpc 2017-01-31 12:56:23
https://hackage.haskell.org/package/bytestring-0.10.8.1/docs/Data-ByteString-Lazy.html#v:hGetContents - an example of lazy IO documented
antalsz 2017-01-31 12:58:21
awesome
Jello_Raptor 2017-01-31 12:58:32
jle`: This looks more like a type level Either, I want something like `HEither :: [*] -> *` with stuff like `_3 :: HEither (_:_:c:_) -> Maybe c`
erisco 2017-01-31 13:09:13
how can I tell ghci to run lifted IO without printing (because it then complains there is no Show instance)
Koterpillar 2017-01-31 13:11:04
erisco: void?
erisco 2017-01-31 13:11:54
never mind there should be a function in the lib somewhere
Koterpillar 2017-01-31 13:12:20
:t void
lambdabot 2017-01-31 13:12:22
Functor f => f a -> f ()
mr_sm1th 2017-01-31 13:12:24
Is there a Haskell function that groups concurrent occuranses in a list and makes a list of list out of them?
Koterpillar 2017-01-31 13:12:32
erisco: that is the function you want
jle` 2017-01-31 13:12:33
Jello_Raptor: that's this here http://hackage.haskell.org/package/type-combinators-0.2.4.3/docs/Data-Type-Sum.html
erisco 2017-01-31 13:12:37
no, it isn't
kadoban 2017-01-31 13:12:52
:t group -- mr_sm1th, this?
mr_sm1th 2017-01-31 13:12:53
e.g. "ssdddabb" -> ["ss", "dd", "a", "bb"]
lambdabot 2017-01-31 13:12:54
Eq a => [a] -> [[a]]
jle` 2017-01-31 13:12:55
Jello_Raptor: your HEither = HList Identity
kadoban 2017-01-31 13:13:06
Ya, group
mr_sm1th 2017-01-31 13:13:28
Nice.
mr_sm1th 2017-01-31 13:13:31
Thx.
Koterpillar 2017-01-31 13:13:38
erisco: hmm, I could run my function in GHCi without problems
kadoban 2017-01-31 13:13:42
Anytime
Koterpillar 2017-01-31 13:14:07
erisco: http://lpaste.net/351838
erisco 2017-01-31 13:14:56
no, I have m () for some MonadIO
Koterpillar 2017-01-31 13:15:33
and you want to liftIO it?
erisco 2017-01-31 13:15:42
no
Koterpillar 2017-01-31 13:16:00
well, GHCi can't run any MonadIO, just IO
erisco 2017-01-31 13:16:27
yes that's right, so I need to locate the correct function to tear away Symbolic
erisco 2017-01-31 13:16:33
from this heap of stuff http://hackage.haskell.org/package/sbv-5.15/docs/Data-SBV.html#t:Symbolic
Koterpillar 2017-01-31 13:16:54
Oh. So this is not about "without printing" or a Show instance
erisco 2017-01-31 13:17:10
it was
erisco 2017-01-31 13:17:16
then I realised I needed something else
erisco 2017-01-31 13:19:11
unfortunately I am mystified oO
barrucadu 2017-01-31 13:25:32
erisco: I think you might need to get a `Symbolic SBool` and then use `prove`, `sat`, or `allSat` to get the variable assignment the solver comes up with.
erisco 2017-01-31 13:25:58
seems so barrucadu
Sonolin 2017-01-31 13:26:41
I'm starting to learn lenses, and can anybody explain why "view (_ix 3)" requires a list of Monoids?
Sonolin 2017-01-31 13:26:44
https://ptpb.pw/YUZO/haskell
Sonolin 2017-01-31 13:27:15
I tried inspecting the :i of Const, and it seems there's a Monoid instance for Const... not sure if that's related, but I can't for the life of me figure out where Monoid comes in here
Sonolin 2017-01-31 13:30:08
ah! I think I get it now :)
Sonolin 2017-01-31 13:30:15
Applicative requries Monoid (for Const)
pikajude 2017-01-31 13:30:15
Sonolin: view requires a Monoid iirc
noan 2017-01-31 13:30:29
oh wow I feel a certain special sort of dumb. I can't get a haskell hello world happening for me with stack right now
Sonolin 2017-01-31 13:30:43
yea I understand now thanks pikajude :)
pikajude 2017-01-31 13:30:56
Sonolin: because if the getter fails, it needs to return mempty
Sonolin 2017-01-31 13:31:13
...which completely makes sense... I was just trying to wrap my head around why my custom code was requiring Monoid
pikajude 2017-01-31 13:31:26
oh
Sonolin 2017-01-31 13:31:44
(i.e. I implemented view with "\l s -> getConst (Const l s)" and was confused)
noan 2017-01-31 13:31:53
got it.
Sonolin 2017-01-31 13:32:39
erm "getConst (l Const s)"
noan 2017-01-31 13:32:40
haskell exec somefoo-exe just needed to be haskell exec somefoo-exe.exe because windows.
glguy 2017-01-31 13:32:54
Sonolin: The issue is specifically that: instance Monoid m => Applicative (Const m)
Sonolin 2017-01-31 13:33:18
cool thanks for clarification glguy