GHCi seems to be clever about some things:
If I try to print the empty list in ghci, I encounter no problems:
Prelude> []
[]
Prelude> show []
"[]"
Prelude> print []
[]
Even though the type of the list is clearly unknown, it must be
picking SOME type. (why does it print [] instead of "")?
If I w
t; . Ref . Key $ "ones")]
main = print $ take 10 $ (force example ! Key "ones")
On Thu, Mar 24, 2011 at 12:35 PM, Joshua Ball wrote:
> {-
> - Hi all,
> -
> - I'm having trouble tying the recursive knot in one of my programs.
> -
> - Suppose I have the
{-
- Hi all,
-
- I'm having trouble tying the recursive knot in one of my programs.
-
- Suppose I have the following data structures and functions:
-}
module Recursion where
import Control.Monad.Fix
import Data.Map ((!))
import qualified Data.Map as M
import Debug.Trace
newtype Key = Key {
Hi,
Suppose I want the following functions:
newRef :: a -> RefMonad (Ref a)
readRef :: Ref a -> RefMonad a
writeRef :: Ref a -> a -> RefMonad ()
for some appropriate data Ref = ...
Obviously these functions are already satisfied by IORefs and STM.
But if I wanted to implement my own (for fun).
Hi,
If I have a universally quantified type
mapInt :: forall a. (Int -> a) -> [Int] -> [a]
I can instantiate that function over a type and get a beta-reduced
version of the type
mapInt [String] :: (Int -> String) -> [Int] -> [String]
(I'm borrowing syntax from Pierce here since I don't think H
How unfortunate that I didn't see your announcement before, as I have
just accepted a job with another company.
However, I have added your company to the Haskell in Industry page on
the Haskell wiki.
http://haskell.org/haskellwiki/Haskell_in_industry
Please add a paragraph describing your compan
While we're on the topic of coupling/cohesion of types and syntactic
sugar (and because sometimes problems are made easier by generalizing
them), I have a question.
What is the rationale for disallowing the following code?
main = print "Type 'True' on three lines or I will quit." >> foo
foo = [
I'm not sure what you want to accomplish, but if you like type
hackery, this might be helpful:
http://okmij.org/ftp/Haskell/types.html#polyvar-fn
On 5/5/07, Eric <[EMAIL PROTECTED]> wrote:
Hi all,
In Haskell, is it possible to declare a type constructor with a variable
number of type variables
I'd love to post an ANN: Chicago Haskell user group, but i want to
make sure there's more than one of me.
-johnnn
I live in the Northwest Suburbs of Chicago (specifically Wheaton), and
I would LOVE to join a Chicago Haskell user group.
___
Haskel
That works. Thanks. I didn't realize you could put types in the
expression itself.
On 12/20/06, Greg Buchholz <[EMAIL PROTECTED]> wrote:
Joshua Ball wrote:
> Here is how I am trying to solve the problem, using multi-parameter
> type classes.
>
> class NPProblem inst ce
Hi all,
For my own study, I've been playing around with various NP complete
problems. Previuosly I was doing so in Java, but because I want to
learn Haskell, I'm trying to port the algorithms. In Java, I had an
abstract class called AbstractNPProblem which looked like this:
public abstract class
11 matches
Mail list logo