News aggregator

Why such a cool language doesn't use S-expression syntax?

Haskell on Reddit - Fri, 10/31/2014 - 10:38am

One of the nice things of S-expression syntax is its simplicity. Why isn't it popular with Haskellers?

submitted by dmz
[link] [14 comments]
Categories: Incoming News

Read And Return A Number

Haskell on Reddit - Fri, 10/31/2014 - 10:12am

Hello, i was wondering how I would go about asking the user to input a number and then returning that number to whatever called the function. I am having trouble finding anything similar to this problem online.

What I have so far -

getNumber :: IO(Int) getNumber = do putStr "Enter a number" xs <- getLine

Any help would be appreciated! Thank you.

submitted by con7con
[link] [11 comments]
Categories: Incoming News

I'd like to repeat u/Categoria's question from a few months back: How does everyone format their source code properly? This is usually the main weakness of any text editor with haskell.

Haskell on Reddit - Fri, 10/31/2014 - 7:40am

/u/cameleon's answer is helpful but I wonder if there isn't something more?

For example, wouldn't it be nice in Vim if I could just type:

data BlaBla = BlaBla { blipity :: Integer , blerg0 :: String , blerg1 :: String , blerg2 :: String , blerg3 :: String , blerg4 :: String , blerg5 :: String , blerg6 :: String }

And then hit gqa{ and have it turn into

data BlaBla = Blabla { blipity :: Integer , blerg0 :: String , blerg1 :: String , blerg2 :: String , blerg3 :: String , blerg4 :: String , blerg5 :: String , blerg6 :: String } submitted by rdfox
[link] [71 comments]
Categories: Incoming News

λ Tony's blog λ - Home - Fri, 10/31/2014 - 7:08am
Categories: Offsite Blogs

λ Tony's blog λ - Home - Fri, 10/31/2014 - 7:08am
Categories: Offsite Blogs

Wolfgang Jeltsch: Grapefruit updated

Planet Haskell - Fri, 10/31/2014 - 4:52am

Yesterday, I updated the Grapefruit FRP library once again, this time to make it compatible with GHC 7.8. The new version is To install or update, you can use the following commands:

cabal update cabal install grapefruit-ui-gtk grapefruit-examples

Many thanks to Samuel Gélineau for providing several patches. (By the way, Samuel maintains an interesting page that compares different FRP libraries, the FRP Zoo.)

Grapefruit 0.1 is actually a phase-out model, which I only update to work with newer GHC versions. However, I am working on a new Grapefruit. This will be based on my research about FRP semantics and will be quite different from the old one. I expect that the sound theoretical foundation will lead to a more powerful library with a more sensible interface. One particular new feature will be integration of side effects into FRP, in a purely functional style.

Tagged: FRP, Grapefruit, Haskell, Samuel Gélineau
Categories: Offsite Blogs

Yesod Web Framework: Slides on conduit and GHCJS

Planet Haskell - Thu, 10/30/2014 - 11:00pm

I'm currently sitting in a hotel room in Poznan, Poland, getting ready to attend the second day of PolyConf. In the past two days, I've already had quite some fun. Wednesday- thanks to Matthias Fischmann and Adam Drake- I spoke to the Berlin Haskell users group about conduit. I had no idea that there were this many Haskellers in Berlin, and it was awesome to meet all of you. Yesterday I spoke about Haskell on the client side at PolyConf, mostly talking about how awesome GHCJS is (after Luite indoctrinated me at ICFP).

For those interested, the slides are now available online at:

I've also learnt quite a number of cool client side tricks at PolyConf, hopefully we'll get to take advantage of some of them in Yesod in the near future :).

Categories: Offsite Blogs

エラー処理の抽象化 - Thu, 10/30/2014 - 10:34pm
Categories: Offsite Blogs

Question about dependent types in haskell

Haskell on Reddit - Thu, 10/30/2014 - 7:55pm

I was reading this question on SO about the meaning of being dependently typed and this part of the 2nd answer confused me:

By contrast, it's much trickier (i.e., impossible) to implement the function which makes n copies of a given x (which would be pure to vApply's <*>)

vReplicate :: x -> Vec n x

because it's vital to know how many copies to make at run-time. Enter singletons.

data Natty :: Nat -> * where Zy :: Natty Z Sy :: Natty n -> Natty (S n)

For any promotable type, we can build the singleton family, indexed over the promoted type, inhabited by run-time duplicates of its values. Natty n is the type of run-time copies of the type-level n :: Nat. We can now write

vReplicate :: Natty n -> x -> Vec n x vReplicate Zy x = VNil vReplicate (Sy n) x = VCons x (vReplicate n x)

Why is the type signature of vReplicate not Nat -> x -> Vec n x?

Is vReplicate impossible because we need the type of Vec to be indexed by a Nat, and when we can't know which Nat it will be until run time? So the type signature Nat -> x -> Vec n x does not make sense because we wan't the Nat to be in the type signature like (n :: Nat) -> x -> Vec n x (excuse the invalid syntax).

So then I guess the singleton gives us the ability to express n :: Nat in a type signature in haskell. data Natty :: Nat -> * means Natty is a function from a Nat to a Kind at the type level. So when Zy has type Natty Z, since Natty is a function from Nat to Kind, so Natty Z is a Kind, so we can put it in the type signature.

And finally just to clarify, when the poster is talking about "run-time number", he does not mean that it the numbers will be checked at run-time, he just means whatever number the function is called with at run-time?

I think I ended up answering most of my question but I'm gonna post this anyway because I'm not sure and I already typed it up.

submitted by 0Il0I0l0
[link] [3 comments]
Categories: Incoming News

Scrap your boilerplate - Thu, 10/30/2014 - 7:41pm
Categories: Offsite Blogs

Scrap your boilerplate - Thu, 10/30/2014 - 7:41pm
Categories: Offsite Blogs

Printing out a list without brackets

Haskell on Reddit - Thu, 10/30/2014 - 7:18pm

I created a new data type that takes in a parameter of a list so I can keep track of what is inside of it

Ex: data Info a = Info [a]

it is similar to a Set in a way, however for my purpose I am choosing not to import Data.Set

Now I want to display the contents from a however when I try to list them out, I want to not include the square brackets


x = Data [99, 21, 7, 1, 30]


[99, 21, 7, 1, 30]

I am looking for a way so it only prints

99, 21, 7, 1, 30

In a similar way, if it were strings, I would want

Data ["a,b,c,d"]

Edit: Data ["a", "b", "c", "d"]

"a", "b", "c", "d"

What is a way to include printing them off (using Show) so I don't include the square brackets?

submitted by seps427
[link] [11 comments]
Categories: Incoming News

Proposal: Add Alternative adapter to Data.Monoid

libraries list - Thu, 10/30/2014 - 5:46pm
I found myself needing this type in my current overhaul of Data.Foldable, but it seems to be generally useful: newtype Alt f a = Alt { getAlt :: f a } deriving (Eq,Ord,Show,Read,Typeable,Data,Generic,Num,Real, Floating, Fractional, RealFrac, RealFloat, Integral, Enum, Bounded,Ix,Functor,Foldable,Traversable,Applicative, Alternative,Monad,MonadPlus,MonadFix, IsString, IsList)
Categories: Offsite Discussion

XML schema bindings for haskell

Haskell on Reddit - Thu, 10/30/2014 - 4:34pm

I'm a newbie to haskell.

I'm working on a vocabulary mapping and translation system and I thought that it would make a good project for giving haskell a whirl.

Part of what I want to do is be able to specify vocabularies in detail in a readily machine-readable format. I could use RDF and an ontology but haskell seems a little light-on in the semantics department. So I thought that an XML document, backed by a schema that can be used to validate the document and generate language bindings in a variety of languages would work nicely. (It also gives me a chance to use XLST for documentation and such-like.)

Ultimately, I want to be able to define a fairly comprehensively specified and documented schema so that its a straight-forward task to use it with a new tool. Interoperability is god. I'm not really wedded to XSD; anything that provides a similar level of comprehensiveness and tool support is fine (DTDs are not, since I want any documentation and restrictions to be clearly visible). The source of the information is also fine; something that takes a haskell module and artfully placed comments and can generate a schema for other systems is also fine.

I've been looking through HXT, which seems to be the latest and greatest for this kind of thing. But I'm not seeing anything that matches theses requirements. Could somebody point me in a suitable direction?

submitted by orlock
[link] [8 comments]
Categories: Incoming News