News aggregator

Simon Peyton Jones - YouTube

del.icio.us/haskell - Sun, 11/09/2014 - 6:06pm
Categories: Offsite Blogs

Church Numerals

del.icio.us/haskell - Sun, 11/09/2014 - 5:06pm
Categories: Offsite Blogs

Church Numerals

del.icio.us/haskell - Sun, 11/09/2014 - 5:06pm
Categories: Offsite Blogs

Search | Channel 9

del.icio.us/haskell - Sun, 11/09/2014 - 4:42pm
Categories: Offsite Blogs

Looking for papers/resources/keywords on JIT, supercompilation etc. and their applicability on GHC/Haskell

Haskell on Reddit - Sun, 11/09/2014 - 3:38pm

Hi all,

I'm wondering about possible compile-time and runtime optimization techniques that we can apply to Haskell/GHC. I knew JITs for a long time and recently learned about supercompilation in one of the posts in this subreddit. The paper in the link showed great results but those are not applied to GHC(I think a subset of Haskell is implemented from scratch for demonstration).

I was wondering (apart from requiring huge amounts of work) what are problems with applying those techniques to Haskell. I'm looking for papers about those techniques in Haskell context, and papers of similar techniques. Can anyone point me some papers/resources/keywords about those?

Thanks.

submitted by semanticistZombie
[link] [6 comments]
Categories: Incoming News

Preprints for POPL 2015

Haskell on Reddit - Sun, 11/09/2014 - 3:28pm
Categories: Incoming News

Has there ever been attempts at a functional OS including functional file system?

Haskell on Reddit - Sun, 11/09/2014 - 2:40pm

Instead of an OS where everything is deemed a noun (the file) even if a function or dynamic stream, perhaps go the other way where the standard atomic unit of reference is the function. Everything is a function, of course all functions can be the input of some other function.

Directories could be replaced with categories and data types removing the need for the kludged alias. File names need not be used, each file is given a UID or UUID name, the latter being perhaps a hash function, which would mean non destructive data editing. OS processes and src functions can also be named via a hash scheme, and thus referenced by hash in the actual source code (with local human readable aliases). Instead of foo() where foo can change, referencing some hash may be advantageous—any function can self regulate for consistency.

Just some naive thoughts.

submitted by lstwhl
[link] [29 comments]
Categories: Incoming News

IO and exceptions

haskell-cafe - Sun, 11/09/2014 - 2:08pm
Hi all, I'm having some trouble with IO functions and exceptions. When I call an IO function in Haskell, I feel very uncomfortable, because you never know what kind of exceptions your function may throw. There are a lot of cases where thrown exceptions are not specified in the documentation. What's worse, there are cases where it's impossible to catch thrown exceptions in a safe way. Example to not knowing what exceptions may be thrown: http://hackage.haskell.org/package/base-4.6.0.1/docs/Control-Concurrent-Chan.html `readChan` blocks the thread until it reads something. But what happens when channel is closed while one thread is blocked to read? It's not mentioned in the documentation and it's not specified in terms of types. (e.g. by using Either, Maybe or similar) Example to not being able to catch the exception: http://hackage.haskell.org/package/network-2.6.0.2/docs/Network-Socket.html `recvFrom` blocks the thread until it reads something. However, what happens if socket is closed while `recvFrom` i
Categories: Offsite Discussion

First morning with Haskell, a few early confusions

Haskell on Reddit - Sun, 11/09/2014 - 12:11pm

This morning I've finally had some time to start learning Haskell, and after only a few minutes, I've encountered a few aspects of the language that have left me baffled. FYI, I have a small amount of FP experience (light exposure to Clojure, but I make extensive use of procs/lambdas in Ruby and Python).

First, why can't we use prefix notation for built-in functions? If ++, !! and the like are functions, why is:

list1 ++ list2

valid syntax while

++ list1 list2

is not?

Why is it that prepending an item to a list with the cons operator is fast, but appending requires traversal of the entire list? As a corollary, why isn't there an equivalent to:

"THIS IS A LIS":'T'

I understand that this isn't valid because the first argument to the cons function is an element, and the second is a list. I'm just curious as to why there is no built-in append function.

Why does list comparison return a scalar instead of a list? But more importantly, why on Earth does this expression evaluate to True?

[3,4,2] > [3,4]

Supposedly, list comparison operates in lexicographical order. 3 > 3 is clearly false, as is 4 > 4. The only thing left is to compare element 3 of the first list to...what?

[3,4] !! 2

isn't a valid expression, so

( [3,4,2] !! 2 ) > ( [3,4] !! 2 )

shouldn't evaluate to True, unless I'm missing something here.

Are there logical explanations for these behaviors?

submitted by jakeytrojan
[link] [13 comments]
Categories: Incoming News

Extensionality principles for kinds?

haskell-cafe - Sun, 11/09/2014 - 2:26am
Haskellers, I've waded into some pretty deep waters, but I'm hoping there's a GHC type system wizard in here who can help me. The following code fragment is extracted from something I've been working on involving some pretty fancy type-level programming. I'm using GHC 7.8.3. I've run into a problem where the typechecker refuses to believe that two types are equal; it seems to lack the necessary extensionality principles for lifted data kinds. Basically (see below for definitions) I get into a contex where I know that (TwiceLeft a ~ TwiceLeft b) and (TwiceRight a ~ TwiceRight b), but the typechecker will not believe that (a ~ b). Are there any tricks I can employ to make this code typecheck (using only safe operations)? Bonus if it doesn't add any runtime cost. Thanks, Rob Dockins ====== code follows ====== {-# LANGUAGE DataKinds #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeFamilies #-} import Data.Type.Equality
Categories: Offsite Discussion

Coercible Instances

Haskell on Reddit - Sat, 11/08/2014 - 11:54pm

Consider this:

data D1 a = MkD1 a type family TF a :: * data D2 a = MkD2 (TF a)

Then GHC deduces this (I think), because type roles:

instance (Coercible a b) => Coercible (D1 a) (D1 b) instance Coercible (D2 a) (D2 a)

But what I really want is this:

instance (Coercible (TF a) (TF b)) => Coercible (D2 a) (D2 b)

This would be sound, would it not?

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

Discussion: fold the Alts

libraries list - Sat, 11/08/2014 - 9:06pm
We've had First and Last in Data.Monoid for some time, and we now have Alt as well. Unfortunately, we don't have nice convenient functions for using them, the way we have sum and product to use Sum and Product. So we're stuck with funny-looking constructions like listToMaybe . mapMaybe f for lists, and nothing good for other containers. My thought (the names firstAlt and lastAlt would absolutely have to be changed to accommodate non-catch Alternatives, but I'm not inspired at present): firstAlt, lastAlt :: (Foldable f, Alternative m) => (a -> m b) -> f a -> m b firstAlt f = getAlt #. foldMap (Alt #. f) lastAlt f = getAlt #. getDual #. foldMap (Dual #. Alt #. f) where (#.) :: Coercible b c => (b -> c) -> (a -> b) -> (a -> c) f #. g = coerce g This specializes to Maybe very nicely: firstMaybe :: Foldable f => (a -> Maybe b) -> f a -> Maybe b firstMaybe = firstAlt lastMaybe :: Foldable f => (a -> Maybe b) -> f a -> Maybe b lastMaybe = lastAlt _______________________________________________ Libraries mai
Categories: Offsite Discussion

Produce infinite list with a string

Haskell on Reddit - Sat, 11/08/2014 - 8:22pm

So I have to create an infinite list of list of "subsets" from a small string input

for example, I have allSets str = ....

str being "ab"

So the result would be

[[""], ["a", "b"], ["aa", "ab", "ba", "bb"], ["aaa", "aab", "aba", "abb", "baa", "bab", "bba", "bbb"], ["aaaa", .....]]

I had an idea of using something similar to nats where we create an infinite list, but I couldn't quite think of a way

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

[ANN] Haskell FFI Tutorial

haskell-cafe - Sat, 11/08/2014 - 5:54pm
Hi Everyone, I've recently started working on Haskell FFI Tutorial [1]. The repository already  contains code that explains how to:   * (expressively) represent C `struct` in Haskell code   * call C code from Haskell   * call Haskell code from C   * operate on nested `struct`s    * operate on `struct` arrays   * decode `unions`    * read and write C fixed-length strings and Pointer-type Strings   * how to import functions from, for example, stdlib I'm still working on more story-like writeups, but the first one (about how to call Haskell  from C) is already available [2]. If you have any feedback / comments / questions, know how to improve it or  would like to see more things covered, just ping me.  Thanks [1] https://github.com/ifesdjeen/haskell-ffi-tutorial [2] https://github.com/ifesdjeen/haskell-ffi-tutorial#calling-haskell-from-c --  Alex https://twitter.com/ifesdjeen http://clojurewerkz.org/_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >h
Categories: Offsite Discussion

`cabal repl` problems

haskell-cafe - Sat, 11/08/2014 - 5:39pm
Hi all, I have a Cabal project that has library, executable and several test parts. I'd like to be able to load one of the test parts into GHCi using `cabal repl`. However, I'm having some problems: (To be more specific, I have these parts in my Cabal file: - library - executable myapp - test-suite test - test-suite doctests) - `cabal repl test` tries to load test suite into GHCi but it doesn't ask me which test suite I want to load. For example, in my Cabal file I have `test-suite test` and `test-suite doctests`. `cabal test doctests` runs only doctests but I can't use similar command for repl, like `cabal repl doctests`. - `cabal repl test` tries to load the library, but using wrong set of dependencies. It uses `build-depends` field of `test-suite test` but it loads `library` sources. Note that `hs-source-dirs` field of `test-suite test` and `library` are different, and I have my library in `test-suite test` as a dependency. So the problem is that it tries to load `library` part using the source, inste
Categories: Offsite Discussion

GHC Weekly News - 2014/11/07

Haskell on Reddit - Sat, 11/08/2014 - 3:15pm
Categories: Incoming News