old1101 2017-02-08 01:53:23
hello, why haskell has a weird syntax for "multiline"? It has a name or influence? like this http://lpaste.net/2033144488934768640
old1101 2017-02-08 01:53:42
the commas
osa1 2017-02-08 01:54:10
old1101: it's not for "multiline". commas used to separate elements in lists, you can put them wherever you want
old1101 2017-02-08 01:54:40
osa1: yes, but why this has become the standard?
osa1 2017-02-08 01:54:52
old1101: it's not standard, some people like this style some don't
old1101 2017-02-08 01:55:24
osa1: I think I haven't found a code on github without this style haha
osa1 2017-02-08 01:55:54
old1101: spend more time reading Haskell and you'll see for sure :)
hpc 2017-02-08 01:56:09
old1101: that style is a lot like K&R
hpc 2017-02-08 01:56:56
old1101: it largely exists because some of the language creators preferred it, but it has some rather weird parts and not as many people use it as you would expect
hpc 2017-02-08 01:57:50
as for not seeing lists written in any other way, it's pretty rare to see multi-line lists like that
merijn 2017-02-08 01:58:30
It has the advantage of allowing a nice consistent pattern for line wrapping
merijn 2017-02-08 01:58:40
the commas lining up with the opening [
old1101 2017-02-08 01:58:46
hpc: thanks, influence on ghc/prelude makes sense
merijn 2017-02-08 01:59:00
I've grown rather fond of this style, I use it in C now too
merijn 2017-02-08 01:59:47
And I think most people grow fond of it after a while
hpc 2017-02-08 02:00:10
i personally write it in more of a json-like style
hpc 2017-02-08 02:00:27
makes it easier to see where things start and end
tfc 2017-02-08 02:00:41
hi there. i wrote a function whileM :: (Monad m) => m Bool -> m () which i can execute like "whileM my_monadic_function" in a loop until it errors out.
tfc 2017-02-08 02:00:52
but i was told that there should be a library function like that. i cannot find it.
hpc 2017-02-08 02:01:09
it's not indexed by hoogle for some reason
hpc 2017-02-08 02:01:10
@hayoo
lambdabot 2017-02-08 02:01:10
Unknown command, try @list
hpc 2017-02-08 02:01:13
@where hayoo
lambdabot 2017-02-08 02:01:13
http://hayoo.fh-wedel.de/ -- See also Hoogle: http://haskell.org/hoogle http://fpcomplete.com/hoogle
hpc 2017-02-08 02:01:29
hayoo has a more complete index, but is slower and doesn't always put the most relevant stuff at the top
merijn 2017-02-08 02:02:09
tfc: Have a looke at the monad-loops package
systadmin 2017-02-08 02:02:18
I use Hoogle
merijn 2017-02-08 02:02:37
Hoogle doesn't index everything that exists on Hackage
merijn 2017-02-08 02:02:42
(sadly)
tfc 2017-02-08 02:02:57
merijn: oh that looks useful.
tfc 2017-02-08 02:03:04
for what reason isn't that listed on hoogle?
tfc 2017-02-08 02:03:09
not stable or whatever?
old1101 2017-02-08 02:03:32
merijn, hpc: it's weird at first glance, I'll stick with json-style until perhaps I like it
merijn 2017-02-08 02:03:34
tfc: No particular reason, hoogle covers only a rather small portion of common libraries
merijn 2017-02-08 02:03:45
I have no idea what json-style means
lyxia 2017-02-08 02:04:16
old1101: I would indent lines 9 and 23 less. This style makes the amount of whitespace in front of each line in a block more consistent.
systadmin 2017-02-08 02:04:34
Well... The only thing I *Hoogle* for are what the built-in functions do
merijn 2017-02-08 02:05:01
Incidentally, you can setup a local Hoogle and config cabal to add any package you install to the Hoogle database
tfc 2017-02-08 02:05:17
merijn: ok, hayoo has it. so i will query both search engines in the future. thank you
hpc 2017-02-08 02:05:56
merijn: the typical style you see from most imperative languages, but in haskell i find it reminds me more of json than of blocks of code
old1101 2017-02-08 02:05:59
lyxia: true, I actually just borrow the code I was reading hah
hpc 2017-02-08 02:05:59
Foo {
hpc 2017-02-08 02:06:05
record = [
hpc 2017-02-08 02:06:07
1,
hpc 2017-02-08 02:06:10
2, ...
lyxia 2017-02-08 02:07:38
hpc: good point.
ahihi 2017-02-08 02:09:17
help, I'm stuck in an unclosed list
hpc 2017-02-08 02:13:16
there's probably a bunch of unclosed lists in the channel history by now
hpc 2017-02-08 02:13:21
]]]]]]]]]]]]]]]]}}}}}}}}}}}}}}}}}}}}))))))))))))))))))))))))
hpc 2017-02-08 02:13:23
you're welcome
ahihi 2017-02-08 02:13:29
:-)
merijn 2017-02-08 02:14:30
hpc: syntax error
lyxia 2017-02-08 02:15:42
What have you done? You matched your { with a ].
hpc 2017-02-08 02:17:18
pppsh, that's not how parenthesis work silly
lyxia 2017-02-08 02:20:42
How much suffering can a language cause with 9 kinds of brackets corresponding to all possible pairings of ([{ and }])?
hpc 2017-02-08 02:22:04
people use php every day
old1101 2017-02-08 02:23:46
and js callback hell
merijn 2017-02-08 02:26:05
Is there a pre-defined "[minBound..maxBound]" somewhere?
Phyx- 2017-02-08 02:26:27
hpc: some even like it.. so i've heard..
merijn 2017-02-08 02:33:07
Any typeclass(es) for Show/Read when you don't want to produce valid Haskell syntax? Or should I just abuse Show/Read?
bitonic 2017-02-08 02:36:55
merijn: pick one of the `Pretty` classes if they work for you
bitonic 2017-02-08 02:37:04
Personally I don't like to abuse `Show` that way
bitonic 2017-02-08 02:37:15
But I don't think there's anything standard
Tuplanolla 2017-02-08 02:37:57
There was a joke Lisp variant where you could only define procedures as the surrounding parentheses, lyxia.
merijn 2017-02-08 02:38:44
I guess I could use Iso from lens, but that means pulling in lens as dependency...
Tuplanolla 2017-02-08 02:38:50
There are lots of them starting at U+2700.
lyxia 2017-02-08 02:42:26
Tuplanolla: hahaha that's good.
merijn 2017-02-08 02:43:22
hmm, is there a nice way to create an iso from pairs of values? I don't wanna write out the conversion in both directions
Tuplanolla 2017-02-08 02:43:48
Can you leverage `Enum`, merijn?
merijn 2017-02-08 02:44:22
Tuplanolla: In what way?
phadej 2017-02-08 02:44:43
toEnum . fromEnum in both directions
phadej 2017-02-08 02:45:00
:t toEnum . fromEnum
lambdabot 2017-02-08 02:45:02
(Enum a, Enum c) => a -> c