## Stream

Join this community to post or comment

### dolph das

GHC  -

Ghc structure introduction﻿
15
9

### Christopher King

Discussion  -

There's a little known library called Numeric.Natural. It represents arbitrary Natural Numbers efficiently (it is basically Integer without negatives.) It makes it impossible to have negative numbers. For example, if you did:

fib 0 = 0
fib 1 = 1
fib n = fib (n-1) + fib (n-2)

Normally you would have to check if n is negative at run time, but by restricting the type to fib :: Natural -> Natural, you don't have to worry about it. It is also compatible with most code due to polymorphism (although for lists you will need the generic functions.)﻿
Type representing arbitrary-precision non-negative integers. Operations whose result would be negative throw ( Underflow :: ArithException ) . Since: 4.8.0.0. Instances. Enum Natural Source · Eq Natural Source · Integral Natural Source · Data Natural Source · Num Natural Source ...
8
1

Word has a maximum number it can not go past, so it is like Int. Natural does not have a maximum or upper bound, and so is like Integer.﻿

### Johan Tibellmoderator

Announcement  -

Students, we need more infrastructure proposals for this year's haskell.org Google Summer of Code. I'd like to see more projects for e.g. improving some aspect of Cabal or Hackage. Apply at: https://www.google-melange.com/gsoc/org2/google/gsoc2015/haskell﻿
5
2

### Paul S

Hi Haskellers, newbie here.  I'm trying to install the Haste compiler, and I  am getting an error when I run haste-boot:

Details here:   http://lpaste.net/128202

Would really appreciate any pointers please.

Thanks,

Paul﻿
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17, Installed latest Haskell Platform (haskell-platform-2014.2.0.0-unknown-linux-x86_64.tar.gz ) cabal update Compile and install zlib-1.2.8 cabal install cabal-install sudo apt-get install bzip2 libbz2-dev cabal install haste-compiler haste-boot .
1
Paul S

I installed the packaged GHC on Linux Mint 13 and everything worked!  Thanks for the tip!﻿

### dolph das

Announcement  -

19
5

You should put link to the first slide. Or makes us confused a little.
http://yogsototh.github.io/Category-Theory-Presentation/﻿

### Johan Tibellmoderator

Discussion  -

I've put together a list of Google Summer of Code 2015 project ideas: http://blog.johantibell.com/2015/03/google-summer-of-code-2015-project-ideas.html﻿
9

### Christopher King

Discussion  -

Why not instead of making 0 special, use Maybe Integer?﻿
2

Over even just use Maybe PostId where you need it.﻿

### Nakazo Moto

Discussion  -

Best explanation of the IO monad I have see so far﻿
IO. CIS 194 Week 8 11 March 2013. Suggested reading: LYAH Chapter 9: Input and Output · RWH Chapter 7: I/O. The problem with purity. Remember that Haskell is lazy and therefore pure. This means two primary things: Functions may not have any external effects. For example, a function may not print ...
26
8

### dolph das

Discussion  -
9

what don't you understand? the more the details you add the more easy will be for other to help. ﻿

### Eduardo Costa

GHC  -

I am teaching functional programming, and would like to use Haskell for Internet applications on a CGI gate.  I am not able to compile programs on the server. Using Clean or Racket, it is easy to compile  programs in my Linux machine and use scp to send thom to the server.  However Haskell simply does not work when I install the compiled programs in the server machine.  I compile the Haskell program thus:

ghc --make -static -optc-static -optl-static roda.hs -optl-pthread -o xroda.k

The program is very simple:

import System.IO

main = do
putStrLn "Content-type text/html"
putStrLn ""
putStrLn "<html><body><h1>Hello</h1></body></html>"
hFlush stdout

The compiled program does not print anything, but freezes the machine for a long time, until I get an out of memory message. By the way, the Clean program that works flawlessly is compiled by the following command line:

bin/clm -nt -nr internet -o internet.k﻿
2
1

Hi, Jiang.
The problem is that I failed to build GHC anywhere. I was able to install binaries in machine where binaries are available, and that is all. When I try to install any thing from source or update from sources, I get messages like that:

zlib-0.5.4.2 failed during the building phase. The exception was:
>> ExitFailure 1

together with the suggestion:

(dist/package.conf.inplace) use 'ghc-pkg init' to create the database with
>> the correct format.

Of course, the suggestion does not work either. What amazes me is that Clean is practically dead (people do not improve the compiler since 2011), but it works flawlessly, without bugs, and it is very easy to build from sources. I don't like uniqueness types, but I am afraid that I will be forced into Clean.﻿

### Ranjit Jhala

Discussion  -

Programming with Refinement Types, an intro to SMT and LiquidHaskell with exercises.
Programming with Refinement Types. An Introduction to LiquidHaskell. Ranjit Jhala, Eric Seidel, Niki Vazou. 1.Introduction · 1.1. Well-Typed Programs Do Go Wrong · 1.2. Refinement Types · 1.3. Audience · 1.4. Getting Started · 1.5. Sample Code · 2.Logic & SMT · 2.1. Syntax · 2.2.
11
7

### Sean Leather

GHC  -

Lots of juicy tidbits here.﻿
GHC has implemented "The Applicative Monad Proposal", meaning the Applicative typeclass is now a superclass of Monad . This is a breaking change and your programs will need to be updated. Please see the GHC 7.10 Migration Guide on the GHC wiki. GHC has implemented the "Burning Bridges Proposal", ...
5

### Paul S

How do I resolve this error message?

It is a member of the hidden package ‘monads-tf-0.1.0.2’.

Im running haste compiler on hplayground:

paul@mint64~/hplayground/src \$ hastec Main.hs --output-html

Haste/HPlay/View.hs:72:1:
It is a member of the hidden package ‘monads-tf-0.1.0.2’.﻿
1

You can try to add "monads-tf" to the list of dependencies in your .cabal-file, and then run "cabal configure"﻿

### dolph das

How to make Haskell code run on android with jhc and ndk? For examples, I just want to write a function of type string->string, which should be trivial, but can not figure out how to set up jhc after reading its manual﻿
1

I have seen running examples with ghc, but it seems rather complex to make ghc a cross compiler.but with jhc, u can simply target it to c,then use ndk﻿

### Ivan Miljenovic

Discussion  -

So, just by starting to write tests I found a long-standing bug in fgl: for the two defined Graph instances, the nodeRange of an empty graph is the same as for a graph with only a single node with an ID of 0.

The way I see it, there are four possible options:

1) Make this dodgy behaviour "official" (in that the default method definition also does this)

2) nodeRange empty throws an error (this is what the default definition does, albeit because minimum [] fails)

3) Turn this into a Maybe, thus breaking the API

4) nodeRange empty returns (maxBound, minBound) (or some other nonsensical range)

I'm currently leaning towards the fourth option (if it wasn't that I want to keep the current API as stable as possible I would go towards the third one).﻿
(c) 1999 - 2002 by Martin Erwig [see file COPYRIGHT] -- | Tree-based implementation of 'Graph' and 'DynGraph' module Data.Graph.Inductive.Tree (Gr,UGr) where import Data.List (foldl') import Data.Graph.Inductive.Graph import Data.Graph.Inductive.Internal.FiniteMap import Data.
7

Looks like I might need to do a major version bump any way: the definition of equal` doesn't work with multiple edges; fixing it requires changing an Eq constraint to Ord (or else just deprecating, but PVP says that should count as removal). :s﻿

Hello fellow Haskellers, I was trying to do some practice on writing functional data types (using the data keyword to create types) and I found when I try to find the type of an enumerator of colours it says Not in scope: data constructor ‘Colour’ . Can anybody help me out ?

code : http://pastebin.com/RD4FJ1sV﻿
2

You can't say ":t Colour" because Colour isn't an expression; it's a type.

You could write ":k Colour" but that just says "*" because Colour has no type parameters.
You can also say ":i Colour" and get some information about the type.
And you can say ":browse" to get a list of defined things.﻿

### dolph das

Announcement  -

Purescript, maybe the best solution to js problem,compiled is runtime is about 35kb﻿
2
1

### dolph das

Discussion  -

I've reading the "The Typeclassopedia" by Brent Yorgey in Monad.Reader#13 ,and found that "the Functor hierachy" is interdependent of "the Category hierachy" as the Figure.1 shown. And according ...
9
1

Should have said AMP (applicative-monad-proposal). It will be part of GHC 7.10 and make Applicative a superclass of Monad. Looking at the picture again, I see it is already anticipated. I should be more careful with my comments :-(﻿

### Ivan Miljenovic

Since I've suddenly started clean-up work on fgl, I thought I'd actually go ahead and finally start writing a test-suite.  Thing is, what's the best way of dealing with Arbitrary instances QuickCheck?

I can of course just define it within the testing module(s), but I want to be able to access these instances from other packages (and thus remove the Arbitrary instance I have within graphviz).

Should I make fgl depend upon QuickCheck (they're both HP packages, so it's not as bad as it could be)?  Or just resign myself to copy-pasta?

(I think the real solution is to be able to have multiple libraries definable within the one Cabal package with separate dependencies; so that way you can depend upon fgl-quickcheck to get the instances but if you don't depend on that library then you don't have a dependency upon QuickCheck.  I realise that this isn't feasible any time soon due to the large amount of work required though.)﻿
2
2

Incidentally I've just used fgl - thanks for maintaining it!﻿

### Levent Erkok

Announcement  -

A new release of SBV is out: