News aggregator

Threepenny or Fay + HTML for a GUI in Haskell

Haskell on Reddit - Sun, 06/21/2015 - 8:02pm

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.

Looking at Fay, it seems like it's basically Haskell that compiles to Javascript, but essentially needs to be mapped to the useful Javascript functions by hand. It also seems that some of the standard Haskell functions aren't fully implemented yet, and I'd like to be able to keep everything in idiomatic Haskell.

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]
Categories: Incoming News

A look back at Bayhac 2015

Haskell on Reddit - Sun, 06/21/2015 - 5:45pm
Categories: Incoming News

SPLASH 2015 - 2nd Combined Call for Contributions

General haskell list - Sun, 06/21/2015 - 5:05pm
/************************************************************************************/ ACM Conference on Systems, Programming, Languages, and Applications: Software for Humanity (SPLASH'15) Pittsburgh, Pennsylvania, USA 25th-30th October, 2015 http://www.splashcon.org<http://www.splashcon.org/> Sponsored by ACM SIGPLAN /************************************************************************************/ COMBINED CALL FOR CONTRIBUTIONS Demos Doctoral Symposium Dynamic Languages Symposium (DLS) OOPSLA Artifacts Posters SPLASH-E Student Research Competition Student Volunteers Tutorials Wavefront Workshops Co-Located Conferences: SLE, GPCE, DBPL, PLoP /************************************************************************************/ The ACM SIGPLAN conference on Systems, Programming, Languages and Applications: Software for Humanity (SPLASH) embraces all aspects of software construction and delivery to make it the premier conference at the intersec
Categories: Incoming News

Dimitri Sabadie: HID and MSI keyboards

Planet Haskell - Sun, 06/21/2015 - 4:48pm
MSI keyboards

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

Then, I wrote another Haskell package, msi-kb-backlit. It might require super user rights to work. If you’re not a Haskeller, you can find installation details here.

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!

Categories: Offsite Blogs

What are some good Haskell books?

Haskell on Reddit - Sun, 06/21/2015 - 4:29pm

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]
Categories: Incoming News

groupBy data to a Map

Haskell on Reddit - Sun, 06/21/2015 - 3:31pm

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]
Categories: Incoming News

Elm / Purescript etc frontend + Haskell backend (Yesod or just Warp etc) -- Meteor like framework?

Haskell on Reddit - Sun, 06/21/2015 - 12:38pm

Have been researching web development approaches in Haskell for some internal data analysis / process automation needs. Full Yesod seems to be the most advanced, but too comprehensive / complex. At the same time, there's Meteor.js, which is an excellent framework for node.js / js allowing very rapid development with modern techniques - reactive programming, document driven backend, one code on the server and the client etc. The obvious problem with it is - it's javascript.

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]
Categories: Incoming News

Troubles with HStringTemplate (compilation/runtimeerrors)

haskell-cafe - Sun, 06/21/2015 - 12:34pm
Hello Haskellers, I hope I chose proper mailing list, if not I apologize. And thanks for reading this! I run into a problem with HStringTemplate ( http://hackage.haskell.org/package/HStringTemplate) that I have never seen before. Code, similar to {-# LANGUAGE OverloadedStrings, DeriveDataTypeable, NoImplicitPrelude #-} module Main where import Data.Data import qualified Data.Text as T import qualified Text.StringTemplate as Template renderTextTemplate :: (Template.ToSElem a) => T.Text -> a -> IO T.Text renderTextTemplate name input = do templatesGroup <- Template.directoryGroup "templates" case Template.getStringTemplate (T.unpack name) templatesGroup of Nothing -> return $ "Internal Error: template '" `mappend` name `mappend` "' can not be rendered" Just template -> return $ Template.render (Template.setAttribute "it" input (template:: Template.StringTemplate T.Text)) data Foo = Foo {value:: T.Text} deriving (Data, Typeable) main :: IO () main = do content <- renderTextTemplate "test" $
Categories: Offsite Discussion

How to restrict package version in cabal file

Haskell on Reddit - Sun, 06/21/2015 - 8:22am

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]
Categories: Incoming News

Proposal to generalize the type of List's deleteBy function

libraries list - Sun, 06/21/2015 - 7:32am
Right now the type of deleteBy is: (a -> a -> Bool) -> a -> [a] -> [a] That is, it takes an equality predicate, a value, and a list, and deletes the first element in the list such that the equality predicate returns true for the given value and the element. This can be generalized to: (a -> b -> Bool) -> a -> [b] -> [b] Example use case: keyValues :: [(a, b)] key :: a deleteBy (\x (y, _) -> x == y) key keyValues Thanks Grant Slatton _______________________________________________ Libraries mailing list Libraries< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
Categories: Offsite Discussion

"Universal" constraints?

haskell-cafe - Sun, 06/21/2015 - 6:55am
Hi all, I was wondering about constraints in class declarations. Suppose we have something like this: class Monad m => Store m where type Var m :: * -> * new :: a -> m (Var m a) read :: Var m a -> m a write :: Var m a -> a -> m () Then some reasonable implementations would be IO and ST, using IORefs and STRefs, instance Store IO where type Var IO = IORef new = newIORef read = readIORef write = writeIORef instance Store (ST s) where type Var (ST s) = STRef s new = newSTRef read = readSTRef write = writeSTRef Now, both IORefs and STRefs have equality, which doesn't require equality of the contained type, instance Eq (IORef a) where ... instance Eq (STRef s a) where ... This corresponds to pointer equality and, because reading the values is a monadic action, is as good an Eq instance as we can get. Given this, it would be nice to be able to specify that all instances of our Store class
Categories: Offsite Discussion

How much of the hatred for laziness-by-default comes from lazy-by-default arithmetic?

Haskell on Reddit - Sun, 06/21/2015 - 2:25am

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]
Categories: Incoming News

Symmetric Difference for Data.Set and Data.IntSet?

haskell-cafe - Sun, 06/21/2015 - 1:49am
Could this be implemented as a primitive? I know it can be made from union and difference, or doing toList on both of them, taking the symmetric difference, and using fromDistinctAscList on the result, but it'd probably be much faster if it could be done natively, like can be done with Data.Map.mergeWithKey. Alternatively, could we get a merge interface for Set and IntSet roughly matching Map and IntMap? _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion