# News aggregator

### My First Bigger Project: a Realtime 60fps 800 Body Sim using Repa & GPipe.

### Methods for inventing algorithms?

recently I had to define a function roughly as follows:

magic g f 0 = f [] magic g f n = g (\x -> magic g (f . (x:)) (n-1))and the way I found this definition was very .. ad hoc? I knew that I wanted something roughly that worked like so:

magic' 0 = F [] magic' 1 = G (\x -> F [x]) magic' 2 = G (\y -> G (\x -> F [y,x])) etcbut it took some fiddling to find the above definition, including a variant with a list accumulator

what I'm wondering is if anyone knows of a tutorial or book on a more rational design process that isn't quite so hodge podge?

submitted by psygnisfive[link] [15 comments]

### Breaking Through the Normalization Barrier: A Self-Interpreter for F-omega

Breaking Through the Normalization Barrier: A Self-Interpreter for F-omega, by Matt Brown and Jens Palsberg:

According to conventional wisdom, a self-interpreter for a strongly normalizing λ-calculus is impossible. We call this the normalization barrier. The normalization barrier stems from a theorem in computability theory that says that a total universal function for the total computable functions is impossible. In this paper we break through the normalization barrier and define a self-interpreter for System Fω, a strongly normalizing λ-calculus. After a careful analysis of the classical theorem, we show that static type checking in Fω can exclude the proof’s diagonalization gadget, leaving open the possibility for a self-interpreter. Along with the self-interpreter, we program four other operations in Fω, including a continuation-passing style transformation. Our operations rely on a new approach to program representation that may be useful in theorem provers and compilers.

I haven't gone through the whole paper, but their claims are compelling. They have created self-interpreters in System F, System Fω and System Fω+, which are all strongly normalizing typed languages. Previously, the only instance of this for a typed language was Girard's System U, which is not storngly normalizing. The key lynchpin appears in this paragraph on page 2:

Our result breaks through the normalization barrier. The conventional wisdom underlying the normalization barrier makes an implicit assumption that all representations will behave like their counterpart in the computability theorem, and therefore the theorem must apply to them as well. This assumption excludes other notions of representation, about which the theorem says nothing. Thus, our result does not contradict the theorem, but shows that the theorem is less far-reaching than previously thought.

Pretty cool if this isn't too complicated in any given language. Could let one move some previously non-typesafe runtime features, into type safe libraries.

### [ANN] SBV 5.4 is out

### The Theory of patches-vector

### What is the unifying principle of Haskell?

I'm coming from an OO background and trying to learn Haskell not only for its own sake but to better understand the functional paradigm. I learned Smalltalk because it is the purest OO language there is, and so by learning it, you learn OO. Being functionally pure, I expect the same to be true of Haskell.

So my question is: what is the unifying principle of Haskell?

The unifying principle of Smalltalk is object-orientation. Everything is an object, these objects have state, and they are nouns, not verbs.

What would be the equivalent for Haskell? The abstraction which, upon understanding, one has the fundamental building block for designing software with that language.

The closest answer I've found is referential transparency, but it just doesn't seem as powerful an abstraction as the object model. That being said, I just started learning Haskell a few days ago, and have only gone through your basic FP learning exercises, so maybe the enlightenment will come when I start building complex systems with it. That being said, I'd rather be enlightened sooner than later. :)

submitted by dream-spark[link] [80 comments]

### big number, Haskell

It gave me errors.

200 [ 4,5,800] true 200 [4,5,8] falsehow can i got this result

submitted by Germany22221[link] [10 comments]

### Reader a-ha moment

For a while, I was a little bit confused about the reader(T) monad. Why bother with the reader monad if the functions you are going to invoke (e.g. from within your do block) don't get access to the reader?

data ConfigFile = ConfigFile { screenWidth :: Int, farewellText :: [String] } main = runReaderT farewell $ ConfigFile 100 ["Goodbye", "human"] farewell = do maxLineLength <- asks screenWidth message <- asks farewellText let formatted = formatMessage message maxLineLength liftIO $ forM_ formatted putStrLn formatMessage message width = filter ((< width) . length) messageThe reader is supposed to *clean up* my argument-passing, but I still have to shovel a bunch of garbage down into the function call. :-(

What to do?

Make it more monadic!

data ConfigFile = ConfigFile { screenWidth :: Int, farewellText :: [String] } main = runReaderT farewell $ ConfigFile 100 ["Goodbye", "human"] farewell = do formatted <- formatMessage liftIO $ forM_ formatted putStrLn formatMessage = do maxLineLength <- asks screenWidth message <- asks farewellText return $ filter ((< maxLineLength) . length) messageThis is a pretty basic observation, but it never really was obvious to me. You can arbitrarily nest these monadic invocations, so that the reader-stuff can work its way down into the leaves of your porgram. Hope this helps someone in the future.

submitted by skatenerd[link] [18 comments]

### darcs 2.10.2 release

### Beginner: Art in Haskell

I was wondering if anyone had any links or advice when it came to doing art in Haskell.

I'm quite new to Haskell but wanted to try out some graphics stuff (fractals, etc).

Where would be a good place to start? :)

submitted by Catamorpheus[link] [12 comments]

### minElem function int -> intger -> double

Hi, if i have a function that searches the minimum element in the list with Int, how can i use it with Intger and double?

thx 4 help

submitted by mohawke781[link] [8 comments]

### Leuven Haskell User Group: Season 2

### Permutation differnce

Hi guys, can you help me finding the differnce between

import Data.List permHH [] = [[]] permHH [a] = [[a]] permHH as = [x:xs | x <- nub as, xs <- permHH (delete x as)]

and

permLL [] = [[]] permLL as = [as!!(i-1):xs | i <- [1..length as], xs <- permLL (take (i-1) as ++ drop i as)]

i get the same results for both functions, but there has to be a difference.

thx for helping

submitted by mohawke781[link] [comment]

### Does this happen to anyone else: I mention Haskell to somebody I meet, and they hear Pascal.

So instead of revealing something somewhat novel and interesting, I reveal boring and antiquated until I can correct them.

submitted by zzing[link] [146 comments]