News aggregator

weblog.raganwald.com

del.icio.us/haskell - Sat, 12/20/2014 - 2:37pm
Categories: Offsite Blogs

Thiago Negri: Personal website

Planet Haskell - Sat, 12/20/2014 - 2:23pm
I'm proud to announce that I've created my own personal website.

I've finally purchased a domain for myself and now I have a place to use as a showroom of my personal games, take a look (and download them): http://games.tnegri.com/

Also, my blog is now hosted at http://blog.tnegri.com/. Nice! Right?

My vacations are just starting out and I already have a new domain.
Also, bought a slackline starter kit (I will try it for the first time), a frisbee, a boomerang and a frescobol kit!

I'm so happy. :)

Happy holidays to everyone!
Categories: Offsite Blogs

Spelling corrector in Haskell

del.icio.us/haskell - Sat, 12/20/2014 - 1:44pm
Categories: Offsite Blogs

Gave my talk on an introduction functional programming with Haskell

Haskell on Reddit - Sat, 12/20/2014 - 1:10pm

I gave my talk and the turnout was a bit disappointing. Only 6 people showed up, but it was still a good experience overall and a great way to ease myself into giving these kinds of talks. Plus, I have learned that scheduling a programming talk at 4pm on the Friday before Thanksgiving break is a bad idea if you want people to show up!

Extra special thanks to /u/tactics and /u/5outh (whom I shamelessly stole some slides from. They were just too good!) for their suggestions of what to cover in the talk in my post asking for help.

I will be giving the talk again some time in the spring and used the feedback from the audience and the experience of talking to improve my slides a bit more, but I would love to hear what you guys think I should add, remove, clarify, or whatever. You can check it out here on my website.

It was definitely a great experience and I couldn't have done it without all of you guys!

submitted by samisafish69
[link] [5 comments]
Categories: Incoming News

24 Days of GHC Extensions

del.icio.us/haskell - Sat, 12/20/2014 - 1:10pm
Categories: Offsite Blogs

Use Stackage for docs

Haskell on Reddit - Sat, 12/20/2014 - 12:25pm
Categories: Incoming News

Newbie questions on Applicatives, Types and Typeclasses

Haskell on Reddit - Sat, 12/20/2014 - 11:36am

Hi /r/haskell,

I'd written this as a comment to a great post by /u/tailcalled but I think I was a bit late to the comments. I was wondering if anyone had any feedback on my understanding of the code and some of the questions generated in the process.

Let me see if I understand what I'm seeing.

You create Map data structures by calling the names and handles functions.

The data structures produced by calling names and handles are wrapped into a Table data type via the from function. Within the from function, a Table type is constructed using as a type parameter an anonymous function which itself takes a key argument and returns a lookup of that key within the map m.

The Table data type specification is written in 'record syntax', with a its two type variables (k and v used as parts of the definition of an anonymous function).

What I don't understand is how the Table type is being constructed with that anonymous function. (The fact that this could be done was new to me! Cool stuff). Is this function evaluated during construction, or is it lazy (e.g. will that anonymous function remain unexecuted until other code runs lookup?) Perhaps related, it looks like that anonymous function gets partially applied later on, and then composed into something else later.

The other part I don't understand is how join2 works, which is a good segue into the Applicative which I need to become more familiar with. Here is a shot at it:

The join2 function constrains the function parameter types (f a) on the typeclass Applicative. In its body, join2 uses the "," type constructor (function?)[1] to construct a Tuple, The "," seems to be using as its parameters the two f a parameters of join2 (I'm not certain). Now in this case the two parameters of "," are functions, as used in the example:

*Main> let table = join2 names' handles' *Main> :t table table :: Table Id ((FirstName, LastName), TwitterHandle)

which I would guess means that liftA2 together with "," could be described as doing the following "it applies[2] the two functions, and tuples up their results." And within names' and handles' themselves, we're seeing the promotion of names and handles from Maps to Tables. Hence the return type f (a, b), which (I am guessing) is coaxed into type Table (\k -> f k <*> x k) by the typeclass instance instance Applicative (Table k). I am not certain how the instance and its function definition (Table f <*> Table x = Table (\k -> f k <*> x k)) fit together with the liftA2[3].

The author states that the original purpose converting from Map to Table is to be able to use the Applicative, or more specifically, to have a working implementation of pure. I am not sure how pure fits in.

I recognize I am also showing that my understanding of typeclasses is probably also weak. I tend to think of typeclass instances as "make a given operation operate this way on this type, that that way on that type.

[1] *Main> :t (,) (,) :: a -> b -> (a, b)

[2] Perhaps it is not applying them but sort of freezing them in their state for use later, or taking the two chunks of computation (the two f a functions that are arguments) and bundling them together

[3] I recall seeing this sort of "logic in the type" in this example, hopefully it is roughly analogous:

you can retrieve an element at an 'index' in a sum type if you convert an Int into an Enum ('toEnum') and return the result in a function whose return type is the sum type. I hope this is roughly analogous to what I'm seeing with the `T

27 newtype ID = ID Int 28 deriving (Show, Num, Eq, Ord, Integral, Real, Enum) 29 30 data Person = John | Sarah | Susan 31 deriving (Show, Eq, Enum, Bounded) ... 47 personFromId :: ID -> Maybe Person 48 personFromId (ID i) | i <= 3 && i > 0 = Just (toEnum (i-1)) 49 | otherwise = Nothing

(source: https://github.com/mstksg/inCode/blob/master/code-samples/inside/maybe.hs)

submitted by nabokovian
[link] [3 comments]
Categories: Incoming News

Yesod Web Framework: Use Stackage for docs

Planet Haskell - Sat, 12/20/2014 - 8:30am

I'm writing this blog post to address a personal annoyance of mine as the maintainer of a large number of Haskell packages. Very often, I get bug reports about lack of documentation on Hackage. This has occurred for years. Most people who file these issues are not aware of the fact that lack of documentation error is more often than not a problem with Hackage. Some people are aware of this, and are asking me to start running a separate tool every time I upload a package to generate the documentation locally.

I have another annoyance with documentation on Hackage: I'm forced to write my package's description in a very strange Haddock-inside-cabal format in the cabal file itself. I need to write a description in any event in a README for users on Github, so this is purely wasted efforted.

To address both of these issues at the same time, I've started modifying the description field in my package's to give a link to their Stackage address. I'm doing this out of laziness on my part: I can now feel confident that documentation will be available at pages where people will be pointed to, I will hopefully get less needless issues opened about "Hackage documentation is broken," and I don't need to keep two meaningful descriptions of all of my packages written (one in the weird cabal/Haddock format, one in much nicer Markdown).

Others are clearly welcome to do this as well, but my main motivation here is explaining my reasoning for these changes, so I don't get a flood of new inquiries as to "why do you have such a strange description field in all your packages?" For those wishing to emulate this, follow these steps:

  1. Make sure your package has a good README or README.md file with a description.
  2. Include the README or README.md file in the extra-source-files field of your cabal file.
  3. Update your description field with text like: "Hackage documentation generation is not reliable. For up to date documentation, please see: http://www.stackage.org/package/*name*."

UPDATE See my next blog post for aftermath of this.

Categories: Offsite Blogs