Search Haskell Channel Logs

Friday, March 3, 2017

#haskell channel featuring mauke, hongminhee, cocreature, lyxia, Ch3ck, EvanR, and 9 others.

lyxia 2017-03-03 06:45:22
hongminhee: InstanceD _ _ t _ here t is not the type for which the instance is being defined.
lyxia 2017-03-03 06:45:53
When you write instance Monoid (), here t corresponds to the whole "Monoid ()"
lyxia 2017-03-03 06:45:59
rather than just "()"
hongminhee 2017-03-03 06:46:34
oh
hongminhee 2017-03-03 06:47:23
lyxia: really thanks for your advice! :-) it was my first TemplateHaskell coding, so I'd mistaken...
hongminhee 2017-03-03 06:47:33
🙏
lyxia 2017-03-03 06:48:34
you're welcome
Ch3ck 2017-03-03 07:02:28
is there any GHC playground online?
Ch3ck 2017-03-03 07:02:38
Where I can run my haskell code on the browser
danza 2017-03-03 07:04:27
Ch3ck, a web search should bring you some, this was added lately https://repl.it/site/blog/haskell
Tuplanolla 2017-03-03 07:07:34
@let m = Data.Map.fromList [(1, 'a'), (2, 'b')] :: Map Int Char
lambdabot 2017-03-03 07:07:36
.L.hs:164:47: error:
lambdabot 2017-03-03 07:07:36
Not in scope: type constructor or class 'Map'
lambdabot 2017-03-03 07:07:36
Perhaps you meant 'M.Map' (imported from Data.Map)
Tuplanolla 2017-03-03 07:07:46
@let m = M.fromList [(1, 'a'), (2, 'b')] :: M.Map Int Char
lambdabot 2017-03-03 07:07:49
Defined.
Tuplanolla 2017-03-03 07:07:56
> has (at 3) m -- Why?
lambdabot 2017-03-03 07:07:59
error:
lambdabot 2017-03-03 07:08:00
Ambiguous occurrence 'm'
lambdabot 2017-03-03 07:08:00
It could refer to either 'Debug.SimpleReflect.m',
Tuplanolla 2017-03-03 07:08:07
> has (at 3) M.m -- Why?
lambdabot 2017-03-03 07:08:09
error:
lambdabot 2017-03-03 07:08:09
Not in scope: 'M.m'
lambdabot 2017-03-03 07:08:09
Perhaps you meant 'L.m' (line 164)
Tuplanolla 2017-03-03 07:08:37
> has (at 3) L.m -- Once more why? And lambdabot's imports are the worst.
lambdabot 2017-03-03 07:08:41
True
mauke 2017-03-03 07:11:03
@undefine
lambdabot 2017-03-03 07:11:03
Undefined.
mauke 2017-03-03 07:11:10
just don't define single-letter variables
Tuplanolla 2017-03-03 07:12:40
Shouldn't import `SimpleReflect` or use single-letter module aliases.
c_wraith 2017-03-03 07:33:09
SimpleReflect is valuable for lambdabot's main purpose.
lyxia 2017-03-03 07:33:56
Yeah, lambdabot is no ghci
Tuplanolla 2017-03-03 07:40:08
It's nice that you undefined my example and didn't answer my question. I don't need variables for it though.
Tuplanolla 2017-03-03 07:40:14
> has (at 3) (mempty :: Data.Map.Map Int Char)
lambdabot 2017-03-03 07:40:18
True
Tuplanolla 2017-03-03 07:40:23
Why does this happen?
lyxia 2017-03-03 07:43:11
at is a lens, it always matches.
Tuplanolla 2017-03-03 07:44:29
Is there something I can compose it with to make it behave like `ix`? Perhaps `each`?
c_wraith 2017-03-03 07:46:03
why not just use ix?
Tuplanolla 2017-03-03 07:46:35
The lens is an argument and it's used in more than one spot.
lyxia 2017-03-03 07:47:19
at 3 . _Just
c_wraith 2017-03-03 07:47:36
yeah, I was just hoping to check that.. since at points to a Maybe, the _Just works.
Tuplanolla 2017-03-03 07:48:13
Great.
michalrus 2017-03-03 07:50:51
Hey, is there a "deterministic" code formatter in the sense that it will always output the same whitespace, irregardless of formatting it gets as its input?
lyxia 2017-03-03 07:51:53
Just parse the code and print it?
mauke 2017-03-03 07:54:35
"irregardless" :-(
c_wraith 2017-03-03 07:56:03
mauke, now accepted by dictionaries as a synonym of regardless! :)
mauke 2017-03-03 07:57:49
but not by me!
mauke 2017-03-03 07:57:54
infidels
michalrus 2017-03-03 07:59:36
lyxia: but isn't there some commonly used solution for that? I wanted to setup a CI (or update/post-receive hook) script to reject unformatted changes. Writing the formatter myself seems wrong. (:
michalrus 2017-03-03 08:00:32
I tried hindent once, but I think it behaved strangely…
michalrus 2017-03-03 08:01:13
(And arguing over formatting in CRs is time lost.)
lyxia 2017-03-03 08:12:19
michalrus: why is it important for it to be deterministic
lyxia 2017-03-03 08:12:59
I think the way you worded it implies every AST has a unique source code representation
lyxia 2017-03-03 08:13:13
but this is not really desirable because you may want to choose yourself how to break some lines
lyxia 2017-03-03 08:13:50
I bookmarked this some time ago but have never tried it https://github.com/lspitzner/brittany
michalrus 2017-03-03 08:13:51
AST might be too much, but every source… has one best whitespace arrangement?
Tuplanolla 2017-03-03 08:14:09
I reckon it would still be desirable to have a generalized isomorphism between source code and syntax trees.
michalrus 2017-03-03 08:15:05
I just wanted to limit formatting discussions to 0. I might be spoiled by this one(!) part of Scala ecosystem (scalafmt). =)
michalrus 2017-03-03 08:15:05
Thank you for the link!
lyxia 2017-03-03 08:15:30
I like the idempotence requirement
cocreature 2017-03-03 08:15:32
iirc brittany tries even harder to preserve the original formatting than hindent
monochrom 2017-03-03 08:15:36
For each person, there exists uniquely a canonocial source code format.
monochrom 2017-03-03 08:16:00
The problem is different people demand different, conflicting canonical formats.
shapr 2017-03-03 08:16:22
monochrom: but I don't like line noise
Tuplanolla 2017-03-03 08:16:22
That is, f . g . f = f and g . f . g = g instead of just f . g = id and g . f = id.
dolio 2017-03-03 08:16:41
Scala is spoiling you because there are 0 best arrangements for all source? :P
michalrus 2017-03-03 08:16:50
Haha.
lyxia 2017-03-03 08:17:16
Tuplanolla: Okay that one's much more reasonable
Tuplanolla 2017-03-03 08:18:15
Doesn't Go have this?
monochrom 2017-03-03 08:18:25
This lack-of-consensus problem is mitigated in the Scala community (similarly the Python community) by a strong leader and the rest being docile (even religious) followers.
monochrom 2017-03-03 08:18:44
But the Haskell community is very close to being a diverse democracy.
michalrus 2017-03-03 08:19:23
But time! Time is lost on these discussions. And they don't necessarily contribute much… value? :)
monochrom 2017-03-03 08:19:39
(Just look at how many web frameworks to choose from!)
shapr 2017-03-03 08:19:50
michalrus: On the other hand, if you don't have multiple valid approaches, how do you advance?
monochrom 2017-03-03 08:20:06
You don't have to discuss. You can just go ahead implement your ideal.
shapr 2017-03-03 08:20:11
michalrus: Whatever programming will be in 100 years, I hope it's not just like it is now, I want to steal those things from the future and use them now!
monochrom 2017-03-03 08:21:06
For example the GHC people do implement first then let the community discuss. And it is a good idea because the discussion is based on actual usage experience not armchair what-ifs.
monochrom 2017-03-03 08:22:23
And the perk up is that if everyone else merely propose ideas, but you have a ready-to-use implementation of your idea, you gain de facto followers. This is what happened to lens.
michalrus 2017-03-03 08:22:50
shapr: that would be awesome and is one of my greatest sorrows, that we're in the Middle Ages of programming… =( Maybe in the next incarnations⸮
michalrus 2017-03-03 08:22:52
Mhm. :)
shapr 2017-03-03 08:24:25
michalrus: we can rebuild it! We have the technology!
EvanR 2017-03-03 08:24:25
congratulations youre what conal called a "priestly caste"
EvanR 2017-03-03 08:24:42
people who can comprehend and officiate over the arcane processes of software
EvanR 2017-03-03 08:26:01
hopefully in the future the distilled essence of programming language becomes available to everybody
monochrom 2017-03-03 08:30:43
That is only half of the story. The other half is: Do people actually want it?
shapr 2017-03-03 08:30:47
EvanR: my girlfriend has been learning Python the past few months. When we started she had never heard of a terminal or command line.
shapr 2017-03-03 08:31:17
I realize that anyone who joins this channel is almost certainly part of that priestly caste.
EvanR 2017-03-03 08:31:32
yes when the sales girl remarked/jokes she wanted to learn "coding" i just sent her iterm2
monochrom 2017-03-03 08:31:35
The distilled essence of programming language is available today. It is a solved problem. Denotation semantics and stuff. But look at the programmers, they actually hate it.
EvanR 2017-03-03 08:31:37
technically all you need
dolio 2017-03-03 08:31:39
Do you folks call mechanics the, "priestly class of auto repair," too?
monochrom 2017-03-03 08:32:20
Everyone is a priestly caste member of something.
EvanR 2017-03-03 08:32:25
electricians and mechanics have well defined environments and ways to solve every problem
EvanR 2017-03-03 08:32:34
they have been doing X for 100 years
EvanR 2017-03-03 08:33:05
outside microsoft certified IT stuff, you can do anything, and we get in trouble for it on a regular basis
EvanR 2017-03-03 08:33:22
no ones right
shapr 2017-03-03 08:33:27
dolio: I've seen people break their cars because they didn't understanding anything about them, so maybe?
EvanR 2017-03-03 08:34:13
the complexity of car maintenance pales in comparison to "coding"
shapr 2017-03-03 08:34:31
Don't recent cars have many millions of lines of code in them?
EvanR 2017-03-03 08:34:33
even the computer parts which is just a thing you plug a thing into and press a button
EvanR 2017-03-03 08:35:06
the mechanic is readin or writing the code in the car
EvanR 2017-03-03 08:35:08
isn*
monochrom 2017-03-03 08:35:28
I doubt that electrician jobs have existed for 100 years. :)
EvanR 2017-03-03 08:36:03
the 19th century screwing-around with electricity and radio, yeah that seems like where we are
monochrom 2017-03-03 08:36:21
True.
monochrom 2017-03-03 08:36:49
Car mechanics are still not touching the software.
EvanR 2017-03-03 08:37:04
now you plug in LCD shield, internet shield, accelerometer shield... even the potentiometer shield
monochrom 2017-03-03 08:38:07
Also, car manufacturers have been modularizing cars so much that car mechanics do not have to understand intra-module things. They just have to replace modules.
monochrom 2017-03-03 08:38:38
(Some car mechanics can choose to dig deeper. They personal preference. Not a majority.)
EvanR 2017-03-03 08:39:33
i go to work, hope that i can choose to not dig deeper and just use 2 gems together, it explodes in my face, i now need to understand the code of 2 terrible projects
monochrom 2017-03-03 08:39:37
So these days car mechanics are more at the level of Cisco Certified Network persons.
monochrom 2017-03-03 08:39:58
(who do not have to code up TCP/IP stacks, clearly)
maerwald_mob 2017-03-03 08:40:07
EvanR: xD
monochrom 2017-03-03 08:42:15
Consider "FPComplete Certified XMonad Engineer" :)
monochrom 2017-03-03 08:43:25
No no, re-order the words, "XMonad FPComplete Certified Engineer", XFCE.
maerwald_mob 2017-03-03 08:43:40
where can I apply for certified for complete jobs?!
maerwald_mob 2017-03-03 08:44:10
oh wait. this is not -offtopic