c_wraith 2017-02-09 15:45:29
skeuomorf: it's unconventional, but it has a nice internal consistency. The one warning I'd give is that monads aren't important. No matter what you read that says otherwise, they just aren't. Don't waste time trying to "learn monads"
c_wraith 2017-02-09 15:47:01
skeuomorf: if you want a very get-your-hands-dirty intro, maybe https://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours ?
kgadek 2017-02-09 15:48:30
agreed on not learning monads. Actually, I'd go further and ban everyone new to Haskell from reading any monad tutorial until they wrote at least few programs
kgadek 2017-02-09 15:49:27
and insist on saying "action" instead of "monad"
skeuomorf 2017-02-09 15:49:31
c_wraith: ah, that looks interesting, I think I looked at it before and ignored cause I was disappointed in the fact that it used a parsing library
c_wraith 2017-02-09 15:49:50
skeuomorf: eh. parsing libraries are something haskell makes really good.
skeuomorf 2017-02-09 15:50:00
c_wraith: but I will probably give it a go now again, thanks!
c_wraith 2017-02-09 15:50:13
skeuomorf: it's kind of like using boost::spirit, but without being such an abuse of the host language.
skeuomorf 2017-02-09 15:50:42
ah, monads, I don't understand what's the big deal, I am fairly comfortable with math and I've played around with category theory before and I don't find these concepts that complex
c_wraith 2017-02-09 15:51:04
skeuomorf: that's because they're not complex. :)
c_wraith 2017-02-09 15:51:16
skeuomorf: they're just an abstraction most programming languages can't express.
skeuomorf 2017-02-09 15:51:23
haven't looked into what haskell does yet but I think that you folks use these concepts (monad, monoid, functor) as a way to define a common interface for common behavior?
c_wraith 2017-02-09 15:51:47
people think "I don't recognize this" is the same as "this is hard and unlearnable" and choke on their own fear. I did it!
skeuomorf 2017-02-09 15:52:29
aha
c_wraith 2017-02-09 15:52:34
I eventually stopped trying to learn what they were, and just learned the language. Worked much better. :)
skeuomorf 2017-02-09 15:52:41
hah
skeuomorf 2017-02-09 15:54:07
is there a decent library to mess around with automata in Haskell?
c_wraith 2017-02-09 15:54:17
what kind of automata are you looking for?
skeuomorf 2017-02-09 15:54:18
to clarify, NFAs, DFAs not cellular automata
c_wraith 2017-02-09 15:55:26
Hmm. I don't actually know of anything offhand, but some of the more advanced regex libraries (the ones that aren't character-based) must have those.
skeuomorf 2017-02-09 15:55:47
aha
skeuomorf 2017-02-09 15:56:00
I meant something like https://github.com/ztellman/automat
qmm 2017-02-09 15:56:52
tibbe: updated the comment
c_wraith 2017-02-09 15:56:54
Ok, I was thinking of the right thing.
qmm 2017-02-09 15:57:11
tibbe: oh sorry, i was scrolled up and thought you were online
qmm 2017-02-09 15:57:27
i was able to figure out how to parse with casavva
qmm 2017-02-09 15:57:36
i am so noobish
c_wraith 2017-02-09 15:57:53
skeuomorf: looks like there are a few options on hackage. https://hackage.haskell.org/package/hDFA has some tools for generating dot graphs and minimizing DFAs
qmm 2017-02-09 15:59:45
now i have a list of urls and a vector of bytestrings, and for each url i want to drop the first item in the vector and cons/prepend the url
qmm 2017-02-09 15:59:55
in an imperative language i woudl use two for loops
c_wraith 2017-02-09 16:01:55
skeuomorf: looks like https://www.cs.kent.ac.uk/people/staff/sjt/craft2e/regExp.pdf is a solid resource if you want to play with implementations as well as the automata themselves
EvanR 2017-02-09 16:02:20
qmm: if you write the imperative algorithm into an lpaste, im sure someone can help you translate it into haskell
EvanR 2017-02-09 16:02:28
i just dont really understand what youre trying to do from that description
skeuomorf 2017-02-09 16:02:39
c_wraith: Very cool, will check those out after I am done writing a scheme
skeuomorf 2017-02-09 16:02:46
c_wraith: Thanks! :)
monochrom 2017-02-09 16:05:25
skeuomorf: The Gentle Introduction is more terse than RWH.
monochrom 2017-02-09 16:06:09
But my http://www.vex.net/~trebla/haskell/IO.xhtml is better for IO.
monochrom 2017-02-09 16:06:20
(and I/O)
skeuomorf 2017-02-09 16:08:44
monochrom: nice
skeuomorf 2017-02-09 16:10:25
Is there something like https://www.conj.io for Haskell?
monochrom 2017-02-09 16:11:32
I think no.
skeuomorf 2017-02-09 16:12:07
hmm
roboguy` 2017-02-09 16:12:20
skeuomorf: that looks like something a bit different, but there is https://www.haskell.org/hoogle/
bitemyapp 2017-02-09 16:12:23
be the conj.io you want to see in the world
roboguy` 2017-02-09 16:12:57
That looks like it's describing the language itself though
Koterpillar 2017-02-09 16:14:30
http://haskell.io/ is squatted
skeuomorf 2017-02-09 16:14:48
roboguy`: Hoogle looks good enough for me
skeuomorf 2017-02-09 16:15:16
I like being able to glance all the stuff in conj.io but eh
roboguy` 2017-02-09 16:15:25
skeuomorf: there's also Hayoo which uses a different algorithm (so it can sometimes find things Hoogle can't): http://hayoo.fh-wedel.de/
skeuomorf 2017-02-09 16:15:50
roboguy`: good to know
dhalgren 2017-02-09 16:19:07
hi! so any examples on hackage or whatever of pipelines of calculations done elegantly? I've been writing a quick&dirty script calculating various contract bridge related things; probabilities of hands, fits, deals, biasing by certain ways of counting points etc. Doing it in ghci mostly like long compositions of maps, folds, filters etc. Fun and effective, but the shape of this code imho starts to get
dhalgren 2017-02-09 16:19:13
opaque rather quickly, esp if I need multiple results from a stage and so start tupling things up etc.
HaskellLord69 2017-02-09 16:19:49
monochrom: ty for the slight "nudge". I figured it out.
dhalgren 2017-02-09 16:24:09
eg something like this: shapescount count = map (\x->((head (fst x), (fromIntegral.length) (fst x) / count, listAvg (snd x)))).map (\x-> (map (fst) x, map snd x).reverse.myGroup.mySort.map (sort.shape &&& hcp)
Koterpillar 2017-02-09 16:24:33
dhalgren: add more types?
Koterpillar 2017-02-09 16:25:21
dhalgren: by the way, you can do: map (\(x1, x2) -> ((head x1, (fromIntegral . length) x1 / count ...
dhalgren 2017-02-09 16:26:48
hah, yeah, didn't notice it this time
roboguy` 2017-02-09 16:27:02
also
roboguy` 2017-02-09 16:27:05
:t unzip
dhalgren 2017-02-09 16:27:06
so you mean, like data decl for various intermediate shapes?
lambdabot 2017-02-09 16:27:07
[(a, b)] -> ([a], [b])
roboguy` 2017-02-09 16:27:41
^ that is (\x -> map fst x, map snd x)
Koterpillar 2017-02-09 16:28:36
dhalgren: and give names to these intermediate functions too
Koterpillar 2017-02-09 16:28:55
dhalgren: what _is_ an x there? It's a pair of something, but of what?
Koterpillar 2017-02-09 16:29:29
dhalgren: then if you're always using mySort on them, define an instance of Ord instead
qmm 2017-02-09 16:31:22
i want the equivalent of this in haskell without the crashing :) https://paste.pound-python.org/show/OhdCM4AmuTnML3xSVruP/
Koterpillar 2017-02-09 16:32:43
qmm: zip
qmm 2017-02-09 16:32:57
Koterpillar: ah!
qmm 2017-02-09 16:33:10
Koterpillar: i can't believe that didn't come to mind
Koterpillar 2017-02-09 16:33:12
> zip ["example", "reddit", "nothing"] ["foo", "bar", "baz"]
lambdabot 2017-02-09 16:33:15
[("example","foo"),("reddit","bar"),("nothing","baz")]
qmm 2017-02-09 16:33:16
yep yep
qmm 2017-02-09 16:33:45
> zip ["example", "reddit", "nothing"] ["foo", "bar", "baz", "qux"]
lambdabot 2017-02-09 16:33:47
[("example","foo"),("reddit","bar"),("nothing","baz")]
dhalgren 2017-02-09 16:34:35
Koterpillar: its just that these are all so ephemeral; just there for a couple of calc steps for that particular function. step 1, its a sorted hand shape and point count of a particular hand, next sorted by hand shape, then grouped, now I have something like lists of lists of pairs of a list of int and an int or something like that - and I clearly should be naming something like that..
qmm 2017-02-09 16:34:51
zipping a [String] and a Vector ByteString should be fun
Koterpillar 2017-02-09 16:35:02
dhalgren: put them into a module
Koterpillar 2017-02-09 16:36:16
dhalgren: and give them generic types. E.g. does that function need to know that the list if of hands, or maybe it can operate on any lists?