dmwit 2017-02-08 07:45:15
You are wrong. You want to convert and error out, but you don't want to do it via IsString.
kadoban 2017-02-08 07:45:21
This sounds a lot like a job for a quasiquoter, and skip the IsString
dmwit 2017-02-08 07:46:08
Well. I mean, you can want whatever you want, of course. But if you continue to want that, you're going to be disappointed. So I recommend wanting something else. =)
reactormonk 2017-02-08 07:46:42
dmwit, I'm not set on my tools, just on the goal.
reactormonk 2017-02-08 07:46:52
So http://quasimal.com/posts/2012-05-25-quasitext-and-quasiquoting.html it is?
dmwit 2017-02-08 07:47:36
Yep, that looks like it could be a decent tutorial.
reactormonk 2017-02-08 07:47:57
Got another one at hand?
orion 2017-02-08 07:48:19
What is the most state-of-the-art production-ready command line parser available today?
dmwit 2017-02-08 07:48:19
The only time I messed with QQs I just read the docs.
dmwit 2017-02-08 07:48:38
So... no, I don't have a good resource to recommend. =P
dmwit 2017-02-08 07:50:22
orion: You ask an impossible question, I think: state-of-the-art is the newest and greatest stuff, whereas I think of production-ready as being hardened and battle-tested. Hard to do both at the same time. For production-ready, you can't get more stable and familiar to users than getopt. For state-of-the-art, I think I'd probably recommend optparse-applicative.
orion 2017-02-08 07:55:53
dmwit: I see the nature of the contradiction. Thank you.
maerwald 2017-02-08 07:56:23
I still parse manually often :P
maerwald 2017-02-08 07:56:48
it's so easy in haskell, why should I bother to learn the oddities of another library
dmwit 2017-02-08 07:58:31
maerwald: Because dealing with all of `-v 3`, `-v=3`, `-v3`, and `-vvv` manually is annoying.
hexagoxel 2017-02-08 07:58:36
i found optparse-applicative annoying and wrote me an optparse-evil-monadic.
maerwald 2017-02-08 07:58:43
dmwit: just don't give those options
reactormonk 2017-02-08 07:59:08
hexagoxel, unlawful monads?
maerwald 2017-02-08 08:00:00
dmwit: coming up with useless complexity often results in overcomplicated libraries ;)
maerwald 2017-02-08 08:00:22
same for config files
maerwald 2017-02-08 08:00:42
don't make them turing complete :P
hexagoxel 2017-02-08 08:00:56
reactormonk: probably more than unlawful, it will just error if you don't follow a certain pattern.
reactormonk 2017-02-08 08:01:09
hexagoxel, at least compiletime error?
hexagoxel 2017-02-08 08:01:17
still useful until ApplicativeDo works nicely :/
hexagoxel 2017-02-08 08:01:21
nope
reactormonk 2017-02-08 08:01:27
...
reactormonk 2017-02-08 08:01:32
hexagoxel, doesn't work nicely yet?
EvanR__ 2017-02-08 08:01:59
do monkeys fly out of your nose if you dont follow a certain pattern?
hexagoxel 2017-02-08 08:02:34
last i checked things like "return $ .." did not work with ApplicativeDo.
max3 2017-02-08 08:03:20
is it possible to get stack to tell you the list of packages already installed?
reactormonk 2017-02-08 08:03:34
Bug report out yet? :-P
hexagoxel 2017-02-08 08:03:35
and the errors that you get when you mess up at some point (when some part makes it monadic instead of applicative) are not very helpful.
reactormonk 2017-02-08 08:04:06
no app-do yet? ^^
hexagoxel 2017-02-08 08:04:10
these issues are well known.
hexagoxel 2017-02-08 08:04:35
yeah, i also recently wondered why there is not just a separate keyword.
reactormonk 2017-02-08 08:05:48
Possibly because it's really hard to introduce a keyword after the fact.
hexagoxel 2017-02-08 08:06:17
(and that my version has no compile-time check is not too bad in practice; it is possible to call a check that covers every possible path in the construct.)
hexagoxel 2017-02-08 08:06:51
so it is run-time only, but fail-fast.
hexagoxel 2017-02-08 08:07:53
yeah, keywords are always a problem. it is also the only thing that i dislike about the or-pattern proposal - '|' getting yet another meaning.
hexagoxel 2017-02-08 08:08:36
as if "foo | bar <- baz -> grml" was not confusing enough already :p
sm 2017-02-08 08:08:38
orion: that seems to be cmdargs or optparse-applicative. For a long time cmdargs was better documented, but o-a is the community favourite
EvanR__ 2017-02-08 08:13:09
If you want to see something which overloads '|' (a straight stroke shape) to all hell, look at Frege's Begriffsschrift
EvanR__ 2017-02-08 08:14:30
conclusion, syntax designed for humans (not compiler writers) is more than an assignment of meaning to each ascii character. We can only get anywhere with a complex combination of context... isnt everything (all syntax) some conglomeration of strokes
monochrom 2017-02-08 08:15:16
EvanR__: What does the letter "c" mean in "conclusion"?
monochrom 2017-02-08 08:15:46
Also...
monochrom 2017-02-08 08:15:51
@quote monochrom font
lambdabot 2017-02-08 08:15:51
monochrom says: great way to answer a semantics question by commenting on the font "what is the semantics of IO?" "the I may be narrower than O in some fonts, and same width
lambdabot 2017-02-08 08:15:51
in some other fonts" "on very old typewriters, it also denotes the number 10 (ten), for those of you looking for a denotation" XD
pikajude 2017-02-08 08:17:53
some real denotational sem-antics here in #haskell
tfc_ 2017-02-08 08:20:53
hey there. i am launching a process with let p = (shell "cmd ...") { std_in = CreatePipe, std_out = CreatePipe, std_err = Inherit }
tfc_ 2017-02-08 08:21:08
and then (Just hin, Just hout, _, ph) <- createProcess p
tfc_ 2017-02-08 08:21:33
what my process does, is listening on stdin. if it reads 0 from read(stdin,...) (EOF) it terminates.
eacameron 2017-02-08 08:21:42
Ug. Has anyone hit this before? I was using writeText to write to a file and ended up using "show" on the file name so it had double-quotes in it. Under normal usage writeFile would give me an exception. But in my app it was running in a async thread and it wouldn't throw, just hang.
tfc_ 2017-02-08 08:21:44
however my problem is that the app terminates immediately
tfc_ 2017-02-08 08:22:01
no chance to use my stdin pipe in order to write to it. can anyone tell me what i am doing wrong?
EvanR__ 2017-02-08 08:24:11
begriffsschrift notation: http://i.imgur.com/hpxYTgn.jpg
max3 2017-02-08 08:25:09
i don't understand why i'm getting this error: http://pastebin.com/gEJqWUy8
max3 2017-02-08 08:25:26
happy is installed on line 155 and yet on compilation it's not present
tsahyt 2017-02-08 08:26:14
@hoogle CFloat -> Float
lambdabot 2017-02-08 08:26:17
Foreign.C.Types CFloat :: Float -> CFloat
lambdabot 2017-02-08 08:26:17
Language.C.Syntax.Constants cFloat :: Float -> CFloat
lambdabot 2017-02-08 08:26:17
Language.C.Syntax.Constants CFloat :: String -> CFloat
tsahyt 2017-02-08 08:26:25
oh, it's just a wrapper then?
monochrom 2017-02-08 08:27:04
I don't think "just" does justice to it.
EvanR__ 2017-02-08 08:27:30
CFloat corresponds to C's float type
monochrom 2017-02-08 08:27:42
CFloat is guaranteed to be equivalent to C's float. Float is not. Be sure to use CFloat when doing FFI.
ph88 2017-02-08 08:27:43
what is called implode in php is called intercalate in haskell o_O
reactormonk 2017-02-08 08:28:04
I've also seen intersperse
ph88 2017-02-08 08:28:20
intercalate xs xss is equivalent to (concat (intersperse xs xss))
reactormonk 2017-02-08 08:28:44
right. hmm.
monochrom 2017-02-08 08:28:48
It is true that a particular compiler like GHC implements CFloat as a newtype over Float. But this is a compiler's own choice.
EvanR__ 2017-02-08 08:29:13
so implode doesnt correspond to either intersperse or intercalate
geekosaur 2017-02-08 08:29:17
ph88, actually it's weirder than that, php's implode is named after lisp's implode which is (*very* roughly) haskell's concat, but adds the ability to intersperse
reactormonk 2017-02-08 08:29:44
geekosaur, php is just wierd. Let's leave it at that.
geekosaur 2017-02-08 08:29:47
which is ... typical php, attach random functionality to random places
srhb 2017-02-08 08:29:55
Please, we need a php -> Haskell cheatsheet
geekosaur 2017-02-08 08:30:00
because it was convenient for someone at the time
ph88 2017-02-08 08:30:00
implode(', ', ["a", "b"]) == "a, b"
reactormonk 2017-02-08 08:30:13
srhb, sad => happy ?
srhb 2017-02-08 08:30:31
reactormonk: I just think it would be awesome fun. :-P
ph88 2017-02-08 08:30:44
never dived into lisp, choose haskell instead :P
monochrom 2017-02-08 08:30:53
Sometimes I wish programmers took a few linguistic classes. Because that's the only way they will understand that there is not going to be 1-1 correspondences between different languages evolving from different cultures.
reactormonk 2017-02-08 08:30:56
srhb, you could probably map about three php functions to one haskell each.
EvanR__ 2017-02-08 08:30:57
whats the haskell equivalent of a hierarchy of output buffer jugglers
ph88 2017-02-08 08:30:58
srhb, i already started :D
geekosaur 2017-02-08 08:31:04
max3, actually it's looking for the executable at that point and ... executable dependencies tend to be "fun". possibly you need to install happy as a separate step
geekosaur 2017-02-08 08:31:13
(using stack)
EvanR__ 2017-02-08 08:31:15
or the one where you auto export everything in an array into the local variables
srhb 2017-02-08 08:31:18
ph88: yay
max3 2017-02-08 08:31:23
geekosaur, i think it's this https://www.haskell.org/cabal/FAQ.html#runghc-setup-complains-of-missing-packages
EvanR__ 2017-02-08 08:31:35
or access a variable whose name is in a variable ($$)
srhb 2017-02-08 08:31:54
EvanR__: Time to get creative!
geekosaur 2017-02-08 08:31:57
max3, not if you're using stack it isn't
max3 2017-02-08 08:32:07
geekosaur, i am using stack
geekosaur 2017-02-08 08:32:15
yes, so that page is not related
max3 2017-02-08 08:33:24
geekosaur, i believe you can you explain a little more about what's happening?
max3 2017-02-08 08:33:26
*but can you
geekosaur 2017-02-08 08:33:51
probably not because I am not an expert on stack
max3 2017-02-08 08:34:18
geekosaur, how about what "executable dependency" means exactly
geekosaur 2017-02-08 08:34:29
it wants a program, not a library
EvanR__ 2017-02-08 08:34:33
theres a channel dedicated to stack
geekosaur 2017-02-08 08:34:39
it finds programs via $PATH, like any other program does
geekosaur 2017-02-08 08:34:44
(or %PATH% on Windows)
max3 2017-02-08 08:34:55
geekosaur, how can you tell it's looking for an executable dependency?
geekosaur 2017-02-08 08:35:16
but this means executable searches work differently from library searches, and you can get into trouble if it has to install the executable in the same run as it needs to use it
geekosaur 2017-02-08 08:35:44
max3, in this case it is because "happy" is a program that generates code for lexical analysis
max3 2017-02-08 08:36:13
geekosaur, is it not a library as well?
geekosaur 2017-02-08 08:36:26
it is, but it hasn't gotten that far yet
geekosaur 2017-02-08 08:36:55
(also it doesn't always need the library iirc)
geekosaur 2017-02-08 08:37:16
some configurations it can generate all the code itself, some it ends up generating references into the library
monochrom 2017-02-08 08:37:17
There was a post on haskell-cafe reporting that Network.Download works for 10 times and then fails afterwards. I almost wanted to reply "sounds like shareware". :)
marekw2143 2017-02-08 08:37:18
http://lpaste.net/352233 - could someone tell my why I get : maybeList.hs:9:9: parse error on input 'case' ?
EvanR__ 2017-02-08 08:37:53
need a crack for Network.Download
geekosaur 2017-02-08 08:38:02
marekw2143, indentation matters
monochrom 2017-02-08 08:38:11
Yeah, very misaligned
monochrom 2017-02-08 08:38:29
put "case" under "maybeValue"
geekosaur 2017-02-08 08:38:40
since you combined the `do` and the first line of the do block on the same line, the second line MUST start directly under the `maybeValue <-`
bwe 2017-02-08 08:39:01
Curiosity question: What's the state of concurrency/multi-core/parallelism with Haskell? Referring to http://homolog.us/blogs/blog/2012/09/26/bye-bye-python-enter-haskell/#isso-820 (I don't claim that this had ever to be true, but you get the point)
geekosaur 2017-02-08 08:39:09
you only get to change the indentation the way you did if you also did that with the `maybeValue <-`
marekw2143 2017-02-08 08:39:14
geekosaur, ok
marekw2143 2017-02-08 08:39:27
now I have other errors ;)
marekw2143 2017-02-08 08:39:34
but will try to fix them
marekw2143 2017-02-08 08:39:38
thanks
geekosaur 2017-02-08 08:39:41
@where concurrency
lambdabot 2017-02-08 08:39:41
I know nothing about concurrency.
geekosaur 2017-02-08 08:39:44
meh
geekosaur 2017-02-08 08:40:29
bwe, http://chimera.labs.oreilly.com/books/1230000000929
geekosaur 2017-02-08 08:40:44
(currently readable online for free)
monochrom 2017-02-08 08:41:13
@where is not a key-value store. It is a password-message store.
geekosaur 2017-02-08 08:42:09
the par/pseq/force thing is likely to be "but I can't randomly sprinkle nonsense and have it work" which is (a) a usere problem (b) a symptom of the fact that concurrency is hard no matter what language you use
bwe 2017-02-08 08:42:20
geekosaur: Thanks. However, may I admit, I was interested in your personal experience (if present) with concurrency (in relation to other [imperative] languages).
geekosaur 2017-02-08 08:42:44
but with just that comment it is hard to tell
geekosaur 2017-02-08 08:43:01
I don't do much concurrent programming in any language, tbh
geekosaur 2017-02-08 08:43:15
except on the level of processes (as opposed to threads)
geekosaur 2017-02-08 08:43:49
the async library does handle a bunch of common cases these days
EvanR 2017-02-08 08:44:01
bwe: concurrent programming in haskell is awesome
EvanR 2017-02-08 08:44:09
dunno about parallel programming
bwe 2017-02-08 08:44:33
geekosaur: Which I sincerely value and is completely okay anyways. Thanks for your honest statement (which is not natural in our times).
geekosaur 2017-02-08 08:44:46
(par and pseq are a very low level interface)
EvanR 2017-02-08 08:45:00
i havent gotten into a situation where i needed more performance and thought parallel had a chance of giving it to me
bwe 2017-02-08 08:45:04
EvanR: Is there any irony absent in your statement :) ?
EvanR 2017-02-08 08:45:21
theres a distinction to be made
EvanR 2017-02-08 08:45:36
it would be more useful for concurrent to not be synonymous with parallel
EvanR 2017-02-08 08:46:39
i found concurrency abstractions answer a lot of questions about how youre supposed to "do IO"
monochrom 2017-02-08 08:47:31
It is useful to have two words. I am not convinced that "concurrency" is a good word for one of the two. "At the same time" and "parallel" are almost synonyms.
monochrom 2017-02-08 08:48:21
Hoare's "communicating sequential processes" was a good word. But it's too long. But it gets across the real point --- communication.
monochrom 2017-02-08 08:49:50
When multi-threading is hard, it is hard because of communication (aka synchronization primitives). This is exactly what Haskellers mean when they say "when I say 'concurrency' I don't necessarily mean parallelism, what I mean is MVar and STM". See? Communication and/or synchonization.
sternmull 2017-02-08 08:50:31
what is a good project to see how modern real haskell applications are coded? It is easy to find the popular haskell packages, but i am a bit lost when searching for applications.
EvanR 2017-02-08 08:50:50
application as in desktop app?
EvanR 2017-02-08 08:50:57
command line program
EvanR 2017-02-08 08:51:04
server
sternmull 2017-02-08 08:51:22
not necessarily desktop apps, commandline/server stuff is fine
sternmull 2017-02-08 08:51:38
specifically i do not care about GUI stuff at the moment
EvanR 2017-02-08 08:51:49
well heres one https://github.com/joeyh/git-annex
ph88 2017-02-08 08:52:09
EvanR, aren't some things automatically parallel when concurrent ?
EvanR 2017-02-08 08:52:21
like what
ph88 2017-02-08 08:52:58
well doesn't ghc spawn some hw threads ?
sternmull 2017-02-08 08:53:05
thanks. I read about git-annex being made with haskell but totally for got about it...
EvanR 2017-02-08 08:53:36
ghc gives you "capabilities", only one capability can run on a cpu at a time, and only one thread can run on a capability at a time
ph88 2017-02-08 08:54:40
sounds good to mr
ph88 2017-02-08 08:54:42
me
sm 2017-02-08 08:54:52
sternmull: pandoc
EvanR 2017-02-08 08:54:59
in my mind concurrent processes cant tell if they are running in parallel or not, so it shouldnt factor into an analysis
geekosaur 2017-02-08 08:55:16
not sure any of those does anything with either parallelism or concurrency tbh
sternmull 2017-02-08 08:55:22
sm: Thanks.
ph88 2017-02-08 08:55:31
EvanR, what analysis ?
EvanR 2017-02-08 08:55:44
of how concurrent processes will behave
EvanR 2017-02-08 08:55:51
or might behave
mangobot 2017-02-08 08:56:15
hi everyone! i wwas wondering if someone could give me a tip on how to parse a string correctly. here's what i came up with so far: http://lpaste.net/352234 the idea is to parse a string like ",b,b,/bb,b,b/b,,wwb,b/,,/w,,bww,bw/,w,/w,w,w,w w c3-e5", where ,b,b,/bb,b,b/b,,wwb,b/,,/w,,bww,bw/,w,/w,w,w,w = gamestate, w is the next player and c3-e5 is last move
EvanR 2017-02-08 08:56:17
"it might as well be sequential"
ph88 2017-02-08 08:56:27
oh i was thinking more along the lines of them being independent of each other
monochrom 2017-02-08 08:56:30
Take it to the extreme. A program can't tell whether it's running or not. So?
EvanR 2017-02-08 08:56:40
are they independent?
mangobot 2017-02-08 08:56:47
how can i seperate this string into this 3 different types?
mangobot 2017-02-08 08:56:54
these*
ph88 2017-02-08 08:57:57
mangobot, is each character a command on it's own ?
monochrom 2017-02-08 08:58:12
I'm going to gripe on haskell-cafe. It's time someone raised an objection. (Yeah yeah, that ship has sailed etc, I know.)
ph88 2017-02-08 08:58:22
EvanR, i think some problems can be split up and be independent on many cores
EvanR 2017-02-08 08:58:41
thats more of a parallel programming strategy
ph88 2017-02-08 08:59:01
yeah
mangobot 2017-02-08 08:59:03
ph88 what do you mean by each character being a command on its own? each character in the string represent the currnt position of a player on the board. so the part until the first space before "w" is the board state and then w stands for the next player and c3-e5 is the last move
mangobot 2017-02-08 08:59:21
i need to parse the string in order to calculate next possible moves
ph88 2017-02-08 08:59:55
oh didn't even notice that space
EvanR 2017-02-08 08:59:56
if you think like that, you definitely need to know about cores and about simultaneity, to reason about performance, which is the entire point there, and so its a lower level thing
mangobot 2017-02-08 09:00:25
ph88 so "," stands for next square on the field "/" new line and w and b for white and black players
ph88 2017-02-08 09:00:44
mangobot, looks you were doing a good job with splitOn .. what tip do you need ?
EvanR 2017-02-08 09:00:51
if you think like javascript, which has all kinds of things happening asynchronously, you dont need to introduce the complexity of multiple cores and simultaneity
EvanR 2017-02-08 09:01:30
some people think they want to think about that in that situation, but they really dont
ph88 2017-02-08 09:01:45
i just think it's cool to utilize all cores :P
EvanR 2017-02-08 09:01:48
you dont need a core dedicated to waiting for http to come back
mangobot 2017-02-08 09:01:51
ph88 i dont quite get the way it would work if i use the splitOn and how to i assign the correct data types? if i want to seperate the string into 3 parts, first = gamestate, second = next player, third = last move
EvanR 2017-02-08 09:02:04
or waiting for mouse clicks
ph88 2017-02-08 09:02:21
mangobot, you can make a list of type [String] and the use the first item, second item and third item in that list
ph88 2017-02-08 09:02:51
mangobot, or you can make a dedicated type of 3 things like data MangoBotsType = DataConstructorForMangoBot String String String
EvanR 2017-02-08 09:03:04
ph88: its cool to get a complex async situation to actually work correctly
EvanR 2017-02-08 09:03:19
and possibly have an argument for how thats true
ph88 2017-02-08 09:03:43
EvanR, i'm not sure if i even did async programming :(
EvanR 2017-02-08 09:04:06
its all the rage
ph88 2017-02-08 09:04:19
yes i know because i read a lot about it
ph88 2017-02-08 09:04:33
especially interested in tokio even though i don't program rust .. but it looks cool
mangobot 2017-02-08 09:04:39
ph88 so the command parse s = parseInput (splitOn " " s) splits the string into 3 parts already? and then in the parseInput i need to assign those 3 parts?
mangobot 2017-02-08 09:05:07
ph88 that would be parseInput :: [String] -> [String] then and then in next line assign each part?
ph88 2017-02-08 09:06:05
mangobot, splitOn splits the parts in as many as is needed to find all the spaces .. so you can have less or more than 3
ph88 2017-02-08 09:07:24
mangobot, i'm not sure what you want to get out of parseInput .. but i doubt it's either String or [String] .. because likely you want more structured data and use types instead of lists
ph88 2017-02-08 09:09:19
mangobot, here is a small example how you can use guards to check if you have indeed 3 parts https://paste.fedoraproject.org/551255/58454114/
mangobot 2017-02-08 09:10:09
ph88 http://lpaste.net/352235 i receive a string of a form like ",b,b,/bb,b,b/b,,wwb,b/,,/w,,bww,bw/,w,/w,w,w,w w c3-e5" which i want to parse into 3 different data types, first is gamestate (still need to create the structure) , 2 would be the player and 3 is the move which i then want to parse into coordinates ont he field
mangobot 2017-02-08 09:10:21
ph88 ok thanks ill check it out now
ph88 2017-02-08 09:10:30
ok i'll look at your code, just a moment
mangobot 2017-02-08 09:13:56
ph88 thank you! thats really nice. just to make it clear, im working on this game, so there is an exmaple of the string of the starting state: http://pjb.com.au/laska/play_laska.html
mangobot 2017-02-08 09:14:26
ph88 although i also save the last move
ph88 2017-02-08 09:14:32
ok
reactormonk 2017-02-08 09:15:01
With quasiquotes, is there a way to project a data object from TH into a literal in the compiled haskell?
reactormonk 2017-02-08 09:16:42
I'm creating my URIRef data with QuasiQuotes, how do I project it back to runtime?
ph88 2017-02-08 09:17:58
mangobot, just filling in some gaps .. https://paste.fedoraproject.org/551257/48658506/
ph88 2017-02-08 09:18:15
mangobot, there wasn't a type for gamestate and such so i didn't know what to do
mangobot 2017-02-08 09:18:59
ph88 ah yeah i need to create it, didnt do it initially. ill check you code now, thanks a lot though! super helpful
ph88 2017-02-08 09:19:11
mangobot, you might want to consider a parsing library .. then you don't have to put Maybe's everywhere .. or let your code error on runtime when the string is not valid
ph88 2017-02-08 09:19:53
mangobot, line 7 in my code has an error this should be the data constructor PR
mangobot 2017-02-08 09:20:50
ph88 i see, thank you! i get it now. but what could go wrong exactly when parsing the string? like if a string has a different format and so on?
ph88 2017-02-08 09:20:59
mangobot, it's up to you to decide where you want to put Maybe's in your type .. does it have meaning to have a valid GameState but not a valid Player ?
ph88 2017-02-08 09:21:29
mangobot, if the string contains characters or missing characters which you don't expect
ph88 2017-02-08 09:21:51
mangobot, in case you are always sure it's correct then you can let your code crash on runtime .. but this is not nice of course ^^
ph88 2017-02-08 09:22:13
i mean it won't crash if the input is always valid .. but it's better to build your code in such a way that it handles exception situations too
mangobot 2017-02-08 09:23:15
ph88 hehe yeah it will always be correct, i did the main game interface in java and the haskell part is for a bot. its a server game so two real players can play against each other or one can play with bots which are being created in haskell :)) the strings will also be always valid as its all already checked in java
mangobot 2017-02-08 09:23:36
ph88 so the bot will always recieve valid strings
ph88 2017-02-08 09:24:43
ok
ph88 2017-02-08 09:25:05
mangobot, then leave out the Maybe's i guess ..
mangobot 2017-02-08 09:25:17
ph88 yeah i will. thanks for the example though, very helpful!
ph88 2017-02-08 09:25:25
mangobot, then you don't need the guard anymore as well since you know splitOn will always yield 3 parts
mangobot 2017-02-08 09:25:51
ph88 ok, yes, i thought to leave it out
ph88 2017-02-08 09:28:05
mangobot, not that it will be less lines of code .. but just to show what you can do https://paste.fedoraproject.org/551260/14865856/
ph88 2017-02-08 09:28:32
the first code is probably faster
JeKs 2017-02-08 09:29:03
hi guys :)
mangobot 2017-02-08 09:31:06
ph88 why is the first faster? so in the hoogle it says "Convert a letter to the corresponding lower-case letter, if any. Any other character is returned unchanged. " ie so it will parse the string and assignt w to white and b to black, but W and B will just be returned?
mangobot 2017-02-08 09:32:24
ph88 can i ask you something else, so in the line ParseResult (parseGameState parts !! 0) (parsePlayer parts !! 1) (parseMove parts !! 2) it assignes part 0 to the string in the function parseGameState, part 1 to the str in the function parseMove etc?
ph88 2017-02-08 09:33:10
mangobot, W and B will be converted to w and b and then both w and W will yield White
mangobot 2017-02-08 09:33:26
ph88 ah i see
tlahtoani 2017-02-08 09:33:29
I understand nothing about Haskell but it is great
ph88 2017-02-08 09:33:46
mangobot, and then your cpu needs to do some arithmetic on those characters where if you do literally W and w it's only a lookup .. but this is micro optimization so not important
ph88 2017-02-08 09:34:46
mangobot, yes that's right (about the line ParseResult ..)
ph88 2017-02-08 09:36:27
mangobot, i think in haskell terms you say "function parseMove is applied to the string (parts !! 2)" instead of "(parts !! 2) is assigned to parseMove" .. but whatever you know what it does anyway
JeKs 2017-02-08 09:36:31
Quick question. can anyone of you tell me what IDE/compiler is good for haskell and what book (or ofc preferred free online tutorials) i should follow to learn haskell?
ph88 2017-02-08 09:36:57
JeKs, take GHC as compiler
mangobot 2017-02-08 09:37:08
ph88 ah thanks :) i just started learning it today, so still quite unsure about the terms etc :)
ph88 2017-02-08 09:37:25
JeKs, for editor there are integrated environments with emacs and vim, but other editors also have plugins for haskell such as sublime text
travv0 2017-02-08 09:37:25
JeKs: I used Learn You a Haskell and liked it
ph88 2017-02-08 09:38:08
JeKs, the go-to tutorial is learnyouahaskell .. but i would only read little bits and browse around a bit because it may not match your preference. There is also real world haskell and other books some free and some paid
mangobot 2017-02-08 09:39:06
ph88 can i ask you one more question about the correct syntax in the lines 4-8 for the function without maybes https://paste.fedoraproject.org/551257/48658506/ so it would be sometihng like http://lpaste.net/352236 ?
ph88 2017-02-08 09:39:18
JeKs, http://www.cs.nott.ac.uk/~pszgmh/pih.html
mangobot 2017-02-08 09:39:35
ph88 () arond the splitOn
travv0 2017-02-08 09:39:39
ph88: If I've read lyah in its entirety, would it make sense to learn RWH or does it cover the same topics?
travv0 2017-02-08 09:39:51
I'm trying to figure out what the next logical step would be
Tuplanolla 2017-02-08 09:39:58
They're quite different, travv0.
travv0 2017-02-08 09:40:11
Thanks, I'll check it out then
ph88 2017-02-08 09:40:16
travv0, i suggest you look at the index at what it covers, but like Tuplanolla said i found them to be quite different indeed
reactormonk 2017-02-08 09:40:25
How do I throw an error, the non-capturing kind?
ph88 2017-02-08 09:40:35
reactormonk, error "blabla" i guess
reactormonk 2017-02-08 09:40:39
Thanks
Tuplanolla 2017-02-08 09:41:06
The PCPH book complements RWH nicely as well, travv0.
ph88 2017-02-08 09:41:07
mangobot, yes that looks good but replace the type ParseResult with the data constructor PR
mangobot 2017-02-08 09:41:26
ph88 ok thank youuu soo much!
ph88 2017-02-08 09:41:47
Tuplanolla, what's PCPH ?
Tuplanolla 2017-02-08 09:41:50
@google Parallel and Concurrent Programming in Haskell
lambdabot 2017-02-08 09:41:52
http://chimera.labs.oreilly.com/books/1230000000929
lambdabot 2017-02-08 09:41:52
Title: Parallel and Concurrent Programming in Haskell
ph88 2017-02-08 09:42:00
oh that one ^^
travv0 2017-02-08 09:42:06
Tuplanolla: thanks, I'll add that to the list as well
ph88 2017-02-08 09:42:08
i would take that as a more advanced course
mangobot 2017-02-08 09:42:47
ph88 is it bad to call it ParseResult = ParseResult GameState ... , instead of = PR Gamestate? in all of he example i saw today they would keep the same name of the data type, i didnt really looked into it yet so just copied the form
ertes 2017-02-08 09:42:54
PCPH… also called The Book
Tuplanolla 2017-02-08 09:43:40
I thought Homotopy Type Theory was The Book.
ph88 2017-02-08 09:43:43
travv0, one thing with learn you a haskell i found personally is that it doesn't explain why typeclasses are usefull (in my opinion at least). Also there is tons of stuff not explained .. there is also this blog 24 days of ghc extensions which is really really useful. Not that you have to remember all the stuff in there but it gives you a great overview of the extensions. You should program haskell with ghc extensions on
ertes 2017-02-08 09:44:02
Tuplanolla: well, every genre has a The Book =)
tlahtoani 2017-02-08 09:44:09
Why extensions on?
ph88 2017-02-08 09:44:35
mangobot, it's only as bad as you will get confused between Type Constructor and Data Constructor. You can prefix the data constructor with "Mk" possibly
mangobot 2017-02-08 09:44:51
ph88 ok i see, thanks
travv0 2017-02-08 09:44:55
ph88: all noted, thanks for the tips