babysteps in using Persistent to interact with PostgreSQL as I mentioned I want to try some real-life Haskell and of course this means using some kind of database. I looked around a bit and found the really great Persistent package from Micheal Snoyman. Not only is this wonderfuly documented – no you get an yesod integration and a online-book(chapter) explaining it for free – thank you Micheal! This post will only detail the setup and installation I had to do on top of my PostgresSQL installation and it’s more or less my notes I wrote along the way (I hope you enjoy this experiment). So here we go – with opened SublimeText and console we start… made a directory and initialized a git repository in it git initcopied my generic haskell .gitignore into itinitialized cabal cabal init setting up the basic names and stuffadded persistent, persistent-sqlite and persistent-postgresql as dependenciesshamelessly copied the code from here into main.hs: Ok – comment out the postgres part for now – the code does not need it. a cabal run yields
Haskell: The Confusing Parts If you’re used to the C family of languages, or the closely related family of “scripting languages,” Haskell’s syntax (mainly) is a bit baffling at first. For some people, it can even seem like it’s sneaking out from under you every time you think you understand it. This is sort of a FAQ for people who are new to Haskell, or scared away by its syntax. Use this as a cheat sheet, not a textbook. Misc. Stuff You Should Know Already Quick review, because if you’ve heard of Haskell, you should also have heard of most of this. foo :: Bar baz -> Bar quux is a type signature for the function foo, where Bar baz is the type of argument it takes, and Bar quux is the type of the return value. There’s no null and no void. Haskell’s syntax is indirectly based on ML, so if you stop reading here and go learn OCaml instead, some of this information will still be kinda useful. Type Names and Constructors The “has type” (::) operator can appear as an expression in parentheses, or a separate declaration.
A Gentle Introduction to Haskell, Version 98 This is the master HTML version of the Gentle Introduction To Haskell, version 98. Revised June, 2000 by Reuben Thomas. You may download the following: Brief Table of Contents. All code in this tutorial, with additional commentary, is found in the code directory packaged with this tutorial. We suggest that you inspect, run, and modify this code as you read the tutorial. Premission is granted to correct, improve, or enhance this document. Copyright (C) 1999 Paul Hudak, John Peterson and Joseph Fasel Play framework - Home Chumby 8 Verbindet sich z.B. über einen WLAN Router mit dem Internet.Es gibt mehr als 1500 Apps in 30 Kategorien - alle kostenlos.Alles in Einem: Internet-Social-Media-MP3-Player-Gamer-Radio-Wecker.Verfügt über ein großes, hochauflösendes 8" Touchscreen Display.Richte einen Chumby Account ein, lade Deine Lieblings-Apps herunter und bleibe so über alles, was Dich interessiert, auf dem Laufenden, z.B. Facebook, Youtube, Nachrichten, Sport, Wettervorhersagen, Ebay und viel mehr. Der Chumby 8 ist das Nachfolgemodell des Chumby One und ebenso wie dieser ist auch Chumby 8 ein enorm vielseitiges Gerät der Unterhaltungselektronik. Was macht man mit Chumby und wo gehört er hin? Neben Dein Bett: Schlafe zur Musik Deines Lieblings-Internet-Radiosenders ein, werde durch einen Zen Gong geweckt oder z.B. durch den neuesten Podcast. Das Tolle an Chumby ist, dass Du das Internet völlig ohne Computer nutzen kannst, denn seine Funktionsweise ist ähnlich wie bei einem Smartphone oder Tablet PC. Technische Details
Pointfree Pointfree Style It is very common for functional programmers to write functions as a composition of other functions, never mentioning the actual arguments they will be applied to. For example, compare: with: These functions perform the same operation, however, the former is more compact, and is considered cleaner. This style is particularly useful when deriving efficient programs by calculation and, in general, constitutes good discipline. It is a common experience when rewriting expressions in pointfree style to derive more compact, clearer versions of the code -- explicit points often obscure the underlying algorithm. Point-free map fusion: foldr f e . map g == foldr (f . g) e versus pointful map fusion: foldr f e . map g == foldr f' e where f' a b = f (g a) b Some more examples: -- point-wise, and point-free member mem, mem' :: Eq a => a -> [a] -> Bool mem x lst = any (== x) lst mem' = any . (==) 1 But pointfree has more points! 2 Background 3 Tool support A transcript: 4 Combinator discoveries
Haskell Haskell is a functional programming language. If you are a seasoned programmer, consult the overview to see what makes Haskell unique and different from other languages. Haskell is distinct in a few ways: Haskell is pure. Haskell is enjoyable to use because dealing with pure functions makes code much easier to reason about, and the advanced type system helps catch silly and profound mistakes. Our aim in this book is to introduce you to the Haskell programming language — from the very basics to advanced features — and to computer programming in general. Overview The book is divided into a Beginner's Track, an Advanced Track, and a section called Haskell in Practice which covers more day-to-day issues and uses mostly items from the Beginner's Track. Search You may search the book here: Beginner's Track Our aim in this track is to introduce you to Haskell basics and some commonly used libraries. Advanced Track Haskell in Practice Appendices About the book
Learn Haskell Fast and Hard I really believe all developers should learn Haskell. I don’t think everyone needs to be super Haskell ninjas, but they should at least discover what Haskell has to offer. Learning Haskell opens your mind. Mainstream languages share the same foundations: variablesloopspointersdata structures, objects and classes (for most) Haskell is very different. But learning Haskell can be hard. This article will certainly be hard to follow. The conventional method to learning Haskell is to read two books. In contrast, this article is a very brief and dense overview of all major aspects of Haskell. The article contains five parts: Introduction: a short example to show Haskell can be friendly.Basic Haskell: Haskell syntax, and some essential notions.Hard Difficulty Part: Functional style; a progressive example, from imperative to functional styleTypes; types and a standard binary tree exampleInfinite Structure; manipulate an infinite binary tree! 01_basic/10_Introduction/00_hello_world.lhs Introduction ou