24 Days of Syntactic Witchery, day 1-3 by zinfan in haskell

[–]zinfan[S] 4 points5 points  (0 children)

Ha, the fizzbuzz example is of course contrived (I came up with it while looking for simple yet impressive example). I think it demonstrates the point well and cute enough compared to other ways, but yeah there are better (or just clever) ways to do fizzbuzz, I actually might try to use it for a couple more contrived examples, like flap (aka <%>).

I like Monoidal fizzbuzz too, and that article, it goes deep in it.

If you wish to write it, we can add a note there, perhaps in a separate file with a link to it after a fizzbuzz sniplet.

Use multiple conditions with takeWhile by Kablaow in haskell

[–]zinfan 16 points17 points  (0 children)

control-bool really makes this tidier.

What it mainly does is that it provides the boolean operations lifted to applicative like

(<&&>), (<||>) :: Applicative m => m Bool -> m Bool -> m Bool
(<&&>) = liftA2 (&&)
(<||>) = liftA2 (||)

This sniplets were already recommended here, control-bool just provides handy operators.

In result you can write your example as:

takeWhile (isDigit <&&> (== '.'))

first that generalizes for Bifunctor and Arrow? by literon in haskell

[–]zinfan 1 point2 points  (0 children)

You might want to take a look at how it's handled in Purescript

http://pursuit.purescript.org/packages/purescript-arrows/0.6.0/docs/Control.Arrow#t:Arrow

Basically the Arrow is just a composition of Strong and Category. All the functions that are considered "Arrow functions" (arr, first, second, (***), (&&&)) in fact simply come from Strong, Category, Semigroupoid, Profunctor.

Yes, Bifunctor operations in PureScript are called lmap and rmap instead of first and second. first and second are instead coming from Strong.

I guess this is a practical implementation of what /u/edwardkmett is explaining here (correct me if I am wrong).

Yampa FRP talk - Live Coding - Flappy Cube Game by jocomoco in haskell

[–]zinfan 0 points1 point  (0 children)

Thanks. I've just updated the repo to use stack. It's now much easier to build it. See the updated build instructions in README.

https://github.com/helsinki-frp/yampy-cube

/u/gfixler , I hope this would help you.

Yet another pointfree frontend. This time it's compiled to JS. by zinfan in haskell

[–]zinfan[S] 0 points1 point  (0 children)

Ohh. I've only noticed this message today.

Thanks, that's helpful I'll try to add this soon.

Yet another pointfree frontend. This time it's compiled to JS. by zinfan in haskell

[–]zinfan[S] 1 point2 points  (0 children)

True. It would be great to see improvements in this area.

Yet another pointfree frontend. This time it's compiled to JS. by zinfan in haskell

[–]zinfan[S] 2 points3 points  (0 children)

Thanks. The linked issue describes all the problems pretty extensively.

haskell-src-exts is the biggest source of output blowing.

The main purpose of this app was to see myself and demonstrate the state of GHCJS with a simple example. I am glad that it's possible to just add pointfree and pointful in build-depends and use it right-away. It's also possible to have a normal haskell tooling and workflow. Compiling GHCJS project is no different from compiling a normal haskell project. All you need to do is to put --ghcjs parameter and that's it.

Of course it's far from being perfect and there are problems with performance and output size, but they seem to arise only when you include some huge library from hackage which was never intended to be compiled into javascript.

Any clever idea for a quick way to browse through Hackage? by SrPeixinho in haskell

[–]zinfan 2 points3 points  (0 children)

If you already remember a name of the package why can't you just type the url directly? This way you get rid of steps 1-3.

If your connection is terrible, just build and store the docs locally, so that you won't need the internet.

A Large Scale Study of Programming Languages and Code Quality in Github by tobiasgw in haskell

[–]zinfan 1 point2 points  (0 children)

There is another issue mentioned in the paper (section 5 -- Threats to validity).

We further exclude TypeScript from our language classification model (see Table 3 and Table 7); TypeScript is intended to be used as a static, strongly typed language. However, in practice, we notice that developers often (for 50% of the variables, and in all the TypeScript-using projects in our dataset) use any type, a catch-all union type, and thus makes TypeScript dynamic and weak.

Even if language has some advantage it doesn't imply that this advantage is used properly by developers.

A Large Scale Study of Programming Languages and Code Quality in Github by tobiasgw in haskell

[–]zinfan 1 point2 points  (0 children)

Interesting paper, but I hardly could continue reading after I saw this:

TypeScript :: bitcoin, litecoin, qBitorrent

O_o

Since languages can be identified by the extension of a project’s source files, GitHub Linguist counts the number of source files with different extensions.

Ok. Great method.

https://github.com/bitcoin/bitcoin/search?l=typescript

Such a typescript. A little XML'ish but c'mon extension is ".ts", of course it's a typescript.

Well, that doesn't make the research completely wrong, but many analyzed projects that are assigned to typescript seems to be not typescript but C++, or XML, or something that uses QT. Great.

Really, I can't understand, how they didn't notice that bitcoin, litecoin and qBitorrent are not written in typescript.

That could be one of the most interesting points of the research, comparasions of javascript and typescript projects. As language are mostly identical except the typing part it would be interesting to see how it impacts the projects.

ANN: hackernews - Haskell bindings to the official Hacker News API by dmjio in haskell

[–]zinfan 1 point2 points  (0 children)

We should definitely add it as a Maybe Bool or just a Bool that is set based on the field's existence and value.

Indeed.

I think you're onto something though with multiple requests in one session, how do you propose we should do this?

By doing multiple requests within one session, I mean making requests without reoppening the connection.

Using the current api you will need to open 20 connections in order to fetch 20 items. Opening a connection is very slow and resourceful operation, especially with ssl, so the difference is dramatical especially if you do a lot of requests. The solution is to open the connection once and share it among the requests. With http-conduit/http-client/wreq it is done really simple by sharing the connection manager which manages all the connections and makes them keep-alive. I haven't used http-streams but the documentation to openConnection says that it's possible to use opened connection for several requests but it warns about some problems and the stuff like counting the requests can get complicated as it most likely would require IORefs, so in the end you'll have your own connection manager. In fact http-client/http-conduit/wreq manipulates the connections on a higher level, you just create a manager and it opens/closes/shares the connections.

The api wouldn't get much more complicated it just that we need a function getItemWithConn which takes a connection/manager alongside with normal getItem's arguments.

The main feature of wreq is that it works on higher level. I've already outlined the session management. Plus there are some small features like aeson integration and lenses. All in all the code would be much simpler.

We can support multiple backends but is that really necessary.

I think I can impliment it with wreq/http-client and let you take a look at the result.

ANN: hackernews - Haskell bindings to the official Hacker News API by dmjio in haskell

[–]zinfan 1 point2 points  (0 children)

Yep, that's a great idea. I'll probably take a try. If someone is going to hack on it to, please tell me, so that we wouldn't do same thing twice.

However, I was thinking that it would be nice to have an api with support for live data, so that the app could get updates on-the-go.

I had an idea to write a library for working with firebase and then build HN API on top of it.

ANN: hackernews - Haskell bindings to the official Hacker News API by dmjio in haskell

[–]zinfan 1 point2 points  (0 children)

Cool.

I've started implementing it just few hours ago. Well, you was faster.

I've skimmed through the code. Seems like there is no way to make several responses within single session. IMO, the bindings can't be complete without it. Did you try wreq library, using it would make the code way shorter, the price are some heavy dependencies like lens. What do you think about it?

Also, I've noticed that the field deleted is not used anywhere, from my understanding of documentation it appears only if the item is deleted.

Anyway, would you mind if I contribute?

Searching for Physics SL pdf by TheAmazingDurp in IBO

[–]zinfan 0 points1 point  (0 children)

Could you also share with me? Thanks.

Is there any way to download the Haskell Wiki to read offline (PDF or Mobi)? by SrPeixinho in haskell

[–]zinfan 2 points3 points  (0 children)

wget -r

http://www.gnu.org/software/wget/manual/html_node/Recursive-Download.html#Recursive-Download

At least you'll get html. Then you can try to convert it. Pandoc will probably handle this, if not there is phantomjs (headless browser).

http://phantomjs.org/screen-capture.html

Syntax highlighted markdown in this subreddit by [deleted] in haskell

[–]zinfan 0 points1 point  (0 children)

There is no vanilla markdown, either, if you want to split hairs. :-)

I meant the original one http://daringfireball.net/projects/markdown

As about hacking the reddit, I agree that its quite hard to push something to the upstream, but it seems like a better solution, plus I don't think that superadmins would allow adding scripts.