[Haskell-cafe] Printing the empty list.

2011-06-30 Thread Joshua Ball
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

Re: [Haskell-cafe] Tying the recursive knot

2011-03-24 Thread Joshua Ball
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

[Haskell-cafe] Tying the recursive knot

2011-03-24 Thread Joshua Ball
{- - 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 {

[Haskell-cafe] Reference monad

2011-03-11 Thread Joshua Ball
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).

[Haskell-cafe] universal quantification is to type instantiations as existential quantification is to what

2010-08-12 Thread Joshua Ball
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

Re: [Haskell-cafe] *** JOB OFFER *** related to realtime 3D graphics, animation and reactive content

2008-02-15 Thread Joshua Ball
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

Re: [Haskell-cafe] Should "do 1" compile

2007-05-23 Thread Joshua Ball
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 = [

Re: [Haskell-cafe] a question concerning type constructors

2007-05-05 Thread Joshua Ball
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

[Haskell-cafe] Any Haskellers in Chicagoland?

2007-05-03 Thread Joshua Ball
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

Re: [Haskell-cafe] multi parameter type classes for NP problems

2006-12-20 Thread Joshua Ball
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

[Haskell-cafe] multi parameter type classes for NP problems

2006-12-20 Thread Joshua Ball
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