Hello /r/haskell, over the summer I have decided to work on a text editor written in Haskell. I'd like to do something similar to what Lighttable has done, which is use the Web as a UI. However, I'm not sure which of the two options I should choose.
My other option is Threepenny, which basically serves as a small server that serves up HTML that can be written using Haskell functions. However, the project seems not to have as much community backing as Fay, and I'm worried that it may die.
So, do you have any experience with either of these two options? Which one do you think would be best?submitted by fuzzyslippers42
[link] [26 comments]
I have a MSI GS60 Ghost Pro 2QE I’m very proud of. It’s sexy and powerful. It comes with a fancy and configurable backlit keyboard.
There’s a tool called SteelSeries Engine for Windows we can use to change the colors of the keyboard. It supports several features:
- changing colors of three parts of the keyboard (left, middle and right) ;
- changing modes (normal, breathe, wave, demo, gaming).
Unfortunately, that software doesn’t work on Linux, even with wine. I tried hard to make it work and never actually found a way to run it. Then, I decided to look for alternatives and… found nothing working.
Yesterday, I tried a node.js-powered tool called msi-keyboard. And it worked. However, the interface and user interface was not my cup of tea. I decided to dig in in order to understand how it works, and I decided to write my own tool with a decent interface.HID access
The key idea is that such keyboards are just HID devices. As a Haskell programmer, I looked for something that would grant me access to such devices, but nothing was working. There’s a hidapi package, but it doesn’t work and has bugs.
I didn’t give up though. I wrote my own Haskell HID API binding, called hid. Several good things about it:
- it does work ;
- it’s simple ;
- I lately wrote a software using it.
Feel free to install and use it!msi-kb-backlit
Note: if you use Archlinux, you can directly download msi-kb-backlit through the AUR! Search for msi-kb-backlit with yaourt, or download the tarball.
The software has an embedded documentation to help you tweak with colors and modes. ;)
Feel free to use all those pieces of software. I made them with love for you all!
Enjoy your week end, and keep the vibe!
I want to start learning Haskell, though I will only use it for creating an external DSL. Therefore, I need a book that gives more importance to Haskell for developing a DSL or compiler. Please note that I have some basic knowledge in functional programming and F#. Though, I don't any know Haskell.submitted by HighCode
[link] [11 comments]
I have often need to group data by "keys" and and iterate on keys. I could probably use the basic groupBy function, but I often find easier to put the result in a Map. For this I use the small utility function (with the appropriate imports).groupBy :: Ord k => (v -> k) -> [v] -> Map k [v] groupBy key as = Map.fromListWith (++) as' where as' = map ((,) <$> key <*> (:)) as
Does this function exist already in a standard package or is it a clever way to do the same using existing function ? If not, I'm happy to contribute it to package but I'm not sure which one. Any suggestion ?submitted by maxigit
[link] [13 comments]
Are there similar initiatives in Haskell community based on some very promising browser / haskell projects (elm, purescript, fay etc)? Utilizing some powerful Meteor principles with Haskell strengths could provide for an excellent, modern, powerful solution for the web. Or am I missing something?
Thank you for your opinions and my apologies if this is offtopic or irrelevant as I'm new to the reddit haskell community.
EDIT: Thanks a lot for all responses, by using them as pointers and doing some more research, some strong FRP (nice and easy principles outlined by Keera studios here - and looks like Yampa is what most of game dev enthusiasts are using, which is heavy on the reactive model, but I digress...) framework is the way to go.
Some clarification on why I personally think it's needed: Haskell adoption is an issue as we all know and giving an easy but powerful framework that provides for writing beautiful and maintainable apps fast is the surest way to go, as has been proven time and time again.
"Workaround" solutions - such as using some js framework (or even Fay) on the client and Haskell http server - are pretty obvious, but we've been a heavy Meteor user in production for over 2 years and I have to tell you first hand: after using Meteor, using "classic" http requests, serving dynamic html, and even using ajax feels sooo 1995. Some of the things that are done very elegantly there and that could be reused and made part of a good and modern Haskell framework:
- Reactive: solve the MVP problem, have a much better GUI modularization, cleaner code etc. Ways to go - standard FRP Arrows, Yampa like approach etc. Haskell can shine because it's possible to abstract the GUI layer and use more or less the same approach when building browser based or native apps
- No html sent over the network and no http: Meteor uses Websockets heavily and sends only data with DDP protocol. No http cookies - auth is done via localStorage and also DDP. Basically, http is only used to send a prepackaged app down to the client, then it's all Websockets / DDP. Works fast, application feels modern and much more "native", plus all the architectural advantages. For Haskell, we'd need proper marshalling not just of Mongo collections but arbitrary Haskell types ideally (or a subset). Implementing some Graph approach instead of Mongo collections as a starting point might be a nice twist.
- Same code both on server and the client: because of this, you can write transparent code that has the same interface and in many cases even implementation both on the server and the client. Of course you need to worry about permissions etc on the server, but in general the feel when you are developing a multitenant web app just as if you are writing a local 1-user application is really warm and fuzzy. Haskell can further abstract it into running code on different nodes, containers, different clients etc - but that's going too far at this point.
Basically, these 3 points are key in my opinion. In Haskell, there's already an excellent web server(s), reasonable database / persistence support, excellent parallel processing abilities - so if you add the things above and multiply it by all the haskell data processing power and expressiveness, you get a real 21st century solution in app development. Is it time to get out of the niche? :)submitted by jhoxray
[link] [31 comments]
The question is in the title. I mean, when you write a cabal file how do you decide how to set the version boundary of the packages that you use.
Do you use use the latest even though your code probably works with olde version ?
Do you use the oldest as possible ?
Don't put any, and wait to have incompatibility problem to add them ?
etc ...submitted by maxigit
[link] [15 comments]
Do the arithmetic operations, (+), (-), etc. have to be lazy by default? What benefits do lazy implementations of Int/Integer/Float/Double/etc. arithmetic give us? The thunks (always?) take up more space than the evaluated value, so the space isn't a benefit. Is there a simple example where the lazy operations save time that is necessary for an efficient computation?
Will it ever change?submitted by sccrstud92
[link] [41 comments]