saketrule 2017-02-25 08:04:06
hello
Aku 2017-02-25 08:04:06
hello
saketrule 2017-02-25 08:04:15
akash kay katos
saketrule 2017-02-25 08:04:34
how do i start learning haskell
saketrule 2017-02-25 08:04:36
?
saketrule 2017-02-25 08:04:38
??
saketrule 2017-02-25 08:04:39
?
saketrule 2017-02-25 08:04:45
From the start :>
Aku 2017-02-25 08:04:45
type username : and then your query!
Aku 2017-02-25 08:05:04
saketrule: Hey!
saketrule 2017-02-25 08:05:04
Aku: Hi Akash
Aku 2017-02-25 08:05:09
^this way
Aku 2017-02-25 08:05:15
yup
saketrule 2017-02-25 08:05:24
Ajun konich nahiye aapala
shapr 2017-02-25 08:05:27
howdy Aku
saketrule 2017-02-25 08:05:41
shapr: yo man
shapr 2017-02-25 08:05:45
saketrule: är du sakert det är en bra idee?
shapr 2017-02-25 08:06:17
eftersom jag tror att det finns en kanal för din språk :-)
saketrule 2017-02-25 08:06:34
shapr: You from Sweden?
shapr 2017-02-25 08:06:56
saketrule: nah, I'm from Alabama
shapr 2017-02-25 08:07:09
The Swedish speaking part of Alabama
saketrule 2017-02-25 08:07:10
shapr: I know where you live
shapr 2017-02-25 08:07:14
saketrule: ooh, really?
shapr 2017-02-25 08:07:22
where? I'm lost :-(
saketrule 2017-02-25 08:07:25
shapr: yes
mw 2017-02-25 08:07:33
shapr: finns det en svensktalande del av alabama?
saketrule 2017-02-25 08:07:36
shapr: look to your left
shapr 2017-02-25 08:08:12
mw: naturligtvis! var jag sitter!
shapr 2017-02-25 08:08:18
saketrule: that's not you
saketrule 2017-02-25 08:09:07
shapr: Jag menar, till din andra vänster
Aku 2017-02-25 08:09:24
han skojar
mw 2017-02-25 08:09:52
haha, antar att det är en hel del google translate inblandat här
Aku 2017-02-25 08:09:59
howdy saketrule
mw 2017-02-25 08:10:04
sorry for OT, I was mostly surprised :)
mauke 2017-02-25 08:10:14
that sounds like a very small part
shapr 2017-02-25 08:10:21
mw: jag bodde i svenska fem år :-)
Tuplanolla 2017-02-25 08:10:24
I had to learn Swedish... for this.
shapr 2017-02-25 08:10:37
wait, you speak Swedish too?
shapr 2017-02-25 08:10:48
mw: sverige, whatever
Tuplanolla 2017-02-25 08:10:55
I'd rather not.
shapr 2017-02-25 08:11:01
aww, ok
shapr 2017-02-25 08:11:11
puhutko suomea?
saketrule 2017-02-25 08:11:13
ja
saketrule 2017-02-25 08:11:18
shapr: ja
shapr 2017-02-25 08:11:26
saketrule: I don't believe you.
Tuplanolla 2017-02-25 08:11:34
The same answer applies.
mw 2017-02-25 08:11:49
saketrule: there are a few pretty good online resources that'll get you started, for the beginner stuff "learn you a haskell for great good" and "real world haskell" are pretty good places to start (I think)
saketrule 2017-02-25 08:11:54
shapr: Joo
shapr 2017-02-25 08:12:14
saketrule: mujhi nahi pata
saketrule 2017-02-25 08:12:36
kyu nahi pata
Tuplanolla 2017-02-25 08:12:42
@google github learn haskell repository
lambdabot 2017-02-25 08:12:43
https://github.com/bitemyapp/learnhaskell
Tuplanolla 2017-02-25 08:12:57
That should get you started and some.
saketrule 2017-02-25 08:13:08
Thanks Tuplanolla
saketrule 2017-02-25 08:13:13
Thanks mw
saketrule 2017-02-25 08:13:26
I am off to learn Haskell
saketrule 2017-02-25 08:13:35
Good Night
saketrule 2017-02-25 08:13:42
Sweet Dreams
centril 2017-02-25 08:18:03
I have a bunch of deriving instance ForallXE MyClass p => MyClass (MyType p) declarations i need to automate... is there some way to do this with template haskell ?
centril 2017-02-25 08:18:49
Otherwise I will have approx 25 * 7 standalone derives in the file, which is a lot...
Tuplanolla 2017-02-25 08:19:44
Short answer: yes, centril.
edwardk 2017-02-25 08:20:05
there is always a way to do it with template haskell, the question is, is it worth your soul?
jmcarthur 2017-02-25 08:20:14
It is possible, but I claim that duplication which is obviously and highly regular is usually just not that bad. Sometimes there are ways that the regularity is less obvious, and then these space-saving abstractions can become worth it.
centril 2017-02-25 08:20:30
Tuplanolla: do you have some reading to do ?
centril 2017-02-25 08:20:58
jmcarthur, edwardk: right, but this is 175 derives...
centril 2017-02-25 08:21:05
Tuplanolla: reading to link to *
edwardk 2017-02-25 08:21:12
stare too long into template haskell and template haskell stares back into you. Your code start sprouting random Qs, and quasiquoters and never again is understood by mere mortals
Tuplanolla 2017-02-25 08:21:15
You should be able to start from the GHC user guide and related library documentation, centril.
centril 2017-02-25 08:21:50
btw, is edwardk Edward Kmett ?
Tuplanolla 2017-02-25 08:21:51
Basically you want to define a function that returns `Q [Dec]` and then splice it in with `$(f x y z)`, centril.
edwardk 2017-02-25 08:21:53
centril: to be honest? it'd be a one liner to write the function that makes that instance for a given type constructor, and a mapM would spew out all the declaration you needed over a list of such constructors
edwardk 2017-02-25 08:21:54
yeah
centril 2017-02-25 08:22:51
edwardk: right, I have some reading to do then =)
edwardk 2017-02-25 08:24:18
you basically need to make some function like foo x = [d| instance ... $x ... |] with some $x in there for the bits you want to replace, or to use the combinators rather than such a splice, then just put in a splice $(forM ['Whatever, 'You, 'Need] foo)
edwardk 2017-02-25 08:24:59
its actually pretty straightforward
centril 2017-02-25 08:25:21
edwardk: right, im a total newbie to writing my own template haskell, so where is d defined ([d|...|] ?
edwardk 2017-02-25 08:25:28
that is one of the splice types, saying you're splicing together a declaration, rather than an expression
edwardk 2017-02-25 08:25:41
the result of that is a Q Dec
edwardk 2017-02-25 08:25:53
the forM or mapM us being used to make a Q [Dec]
edwardk 2017-02-25 08:26:01
which is suitable to being spliced in at the top level
centril 2017-02-25 08:26:15
edwardk: yeah, the forM part I get, it is the Q [Dec] part that was more tricky =)
edwardk 2017-02-25 08:26:46
$(...) takes a Q Exp if you use it in an expression context like foo = $(whatever)
edwardk 2017-02-25 08:26:57
and it takes a Q Dec or a Q [Dec] when used at the top level
edwardk 2017-02-25 08:27:20
basically you can splice a single or multiple statements
centril 2017-02-25 08:27:41
I guess it would be optimal to take two lists of names, one for the class, one for the types, and then "multiply" them and forM it
edwardk 2017-02-25 08:27:59
you can make your own quasiquoters for your own little languages and then use them with [$whatever| ... |] but the [d| |] one is magic
edwardk 2017-02-25 08:28:14
centril: yeah
centril 2017-02-25 08:28:23
edwardk: right, but the [d||] one, where is it defined? like in what module/package ?
edwardk 2017-02-25 08:28:34
foo x y = [d| instance ... $x ... $y ... |]
edwardk 2017-02-25 08:28:52
its baked into the language when you turn on QuasiQuotes and TemplateHaskell or whatever you get it
centril 2017-02-25 08:29:05
edwardk: ah, nice =)
edwardk 2017-02-25 08:29:06
[d| is syntax
centril 2017-02-25 08:29:38
edwardk: btw... have you like written every package that is on hackage? it is impossible to not find your name on like everything :P
edwardk 2017-02-25 08:29:53
i gave it a good ole college try =)
centril 2017-02-25 08:31:00
;)
edwardk 2017-02-25 08:32:12
at last check i think i had more packages on there than anybody, but snoyman may have caught up while i was sick ;)
edwardk 2017-02-25 08:32:52
yeah, he has me beat
centril 2017-02-25 08:34:43
edwardk: damn, you have some work to do
Tuplanolla 2017-02-25 08:34:43
What if you measure dependencies instead, edwardk?
edwardk 2017-02-25 08:34:43
Tuplanolla: i'm pretty sure i come out ahead there
glguy 2017-02-25 08:34:43
Snoyman wins on using dependencies
glguy 2017-02-25 08:34:43
stack used so many it wouldn't compile on macOS until they adapted in 8.0.2
edwardk 2017-02-25 08:34:43
or not i guess
edwardk 2017-02-25 08:34:43
i was thinking more about people who incur dependencies on the package than the number you incur going out
glguy 2017-02-25 08:34:43
Oh, I wasn't attempting to weigh in on that case :)
edwardk 2017-02-25 08:34:43
e.g. http://packdeps.haskellers.com/reverse/lens vs. http://packdeps.haskellers.com/reverse/yesod
edwardk 2017-02-25 08:34:43
there i know i get a bunch of random support emails from folks in the strangest walks of life using my code for things i never anticipated.
mangobot 2017-02-25 08:36:22
why do i get the parse error on '|' in this case? http://lpaste.net/352970 using the guards wrong? i want to compare w1 to w2
glguy 2017-02-25 08:36:52
mangobot: You shouldn't have "= (((wert (f1 w1)) (wert (f2 w2)))" before the guards
lpaste_ 2017-02-25 08:36:59
Centril pasted "template-haskell-standalone-deriving" at http://lpaste.net/352972
centril 2017-02-25 08:37:06
edwardk: ^
mangobot 2017-02-25 08:37:18
glguy how do i apply ths function first to get the wert of f1 and f2?
centril 2017-02-25 08:37:50
edwardk: found this: http://stackoverflow.com/questions/14316656/standalone-deriving-declaration-in-template-haskell-quotation dont know if it still applies...
edwardk 2017-02-25 08:37:53
does TH do standalone deriving statements?
glguy 2017-02-25 08:37:59
mangobot: In this case you don't need to, you're not using the result of that application
mangobot 2017-02-25 08:38:19
i can just use f1 == f2 = true?
mangobot 2017-02-25 08:38:23
w1 == w2*
edwardk 2017-02-25 08:38:42
which classes are you looking to produce btw?
glguy 2017-02-25 08:38:44
mangobot: Yeah. You don't even need to use guards. You can just return w1 == w2 as the result
mangobot 2017-02-25 08:39:01
glguy thanks!
centril 2017-02-25 08:39:04
edwardk: Eq, Ord, Show, Read, Typeable, Generic, Data
edwardk 2017-02-25 08:39:26
ok. you're in luck. modern TH has a StandaloneDerivD constructor in Dec
mangobot 2017-02-25 08:39:42
glguy i wantt o learn to use the guards though, even without the wert function it says that there is a parsing error :( dont get it
edwardk 2017-02-25 08:39:42
:t Language.Haskell.TH.StandaloneDerivD
lambdabot 2017-02-25 08:39:45
Language.Haskell.TH.Syntax.Cxt -> Language.Haskell.TH.Syntax.Type -> Language.Haskell.TH.Syntax.Dec
glguy 2017-02-25 08:39:45
edwardk, centril: Yes it does
edwardk 2017-02-25 08:39:51
:t Language.Haskell.TH.standaloneDerivD
lambdabot 2017-02-25 08:39:53
Language.Haskell.TH.Lib.CxtQ -> Language.Haskell.TH.Lib.TypeQ -> Language.Haskell.TH.Lib.DecQ
edwardk 2017-02-25 08:40:14
so you just need to build the context and the type manually if it won't parse
glguy 2017-02-25 08:40:25
e.g. Prelude Language.Haskell.TH> $(stringE . show =<< [d| deriving instance Show Int |])
glguy 2017-02-25 08:40:25
"[StandaloneDerivD [] (AppT (ConT GHC.Show.Show) (ConT GHC.Types.Int))]"
edwardk 2017-02-25 08:40:45
oh it did parse
glguy 2017-02-25 08:41:26
mangobot: I won't be able to guess what you're doing wrong. You'll have to show the changed code
centril 2017-02-25 08:41:44
edwardk: wel, it claimed it was a malformed instance... so I dont know
glguy 2017-02-25 08:42:00
centril: Then show us what you did so we can see how you malformed it
centril 2017-02-25 08:42:23
glguy: i did =) http://lpaste.net/352972
glguy 2017-02-25 08:42:23
mangobot: If I did guess, I'd guess you left the = before the |
edwardk 2017-02-25 08:43:14
you probably can't use antiquotation there and will have to write the standaloneDerivD call
edwardk 2017-02-25 08:43:21
this isn't that bad though
mangobot 2017-02-25 08:44:25
glguy got it, yeah, had to delete the '='
mangobot 2017-02-25 08:44:26
glguy thanks
centril 2017-02-25 08:44:39
edwardk: ah, so I have to write the creating function manually then, ... , but I guess I can learn some TH-haskell in the process
edwardk 2017-02-25 08:44:48
its not bad
centril 2017-02-25 08:45:43
seeps pretty straight forward once you know where to begin
centril 2017-02-25 08:46:52
edwardk: the link to the API helped a lot