[Haskell-cafe] Text.Regex Segfault

2010-10-16 Thread Duane Johnson
I bumped into a segmentation fault in the regex library today and thought
I'd warn others in case similar behavior is observed:

Prelude :m Text.Regex
 Prelude Text.Regex map read (splitRegex (mkRegex \\|) 0|1|2|4) ::
 [Int]
 Loading package syb ... linking ... done.
 Loading package array-0.2.0.0 ... linking ... done.
 Loading package bytestring-0.9.1.4 ... linking ... done.
 Loading package regex-base-0.72.0.2 ... linking ... done.
 Loading package regex-posix-0.72.0.3 ... linking ... done.
 Loading package regex-compat-0.71.0.1 ... linking ... done.
 [0,1,2,4]
 Prelude Text.Regex Segmentation fault


Regards,
Duane
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] FRP for game programming / artifical life simulation

2010-04-22 Thread Duane Johnson
This is really good stuff, Luke.  I am interested in learning more,  
especially in seeing examples or actual game code that implement the  
more common parts of a game.  I build a game (silkworm) in Haskell  
that was one of my first Haskell programs.  The code was not pretty,  
and I always felt there was a better way.  It seems you are on to a  
better way.


When you're ready, I'll be watching for the announcement ;)

Regards,
Duane Johnson

On Apr 21, 2010, at 6:39 PM, Luke Palmer wrote:

On Wed, Apr 21, 2010 at 4:47 PM, Ben Christy ben.chri...@gmail.com  
wrote:
I have an interest in both game programming and artificial life. I  
have
recently stumbled on Haskell and would like to take a stab at  
programming a
simple game using FRP such as YAMPA or Reactive but I am stuck. I  
am not
certain which one I should choose. It seems that Reactive is more  
active but
is it suitable for game programming. Also has anyone attempted to  
implement
neural networks using FRP if so again which of these two approaches  
to FRP

would you suggest?


I am in the process of writing a game using FRP.  I haven't followed
reactive in a while, but last I checked it had some rather annoying
issues, such as joinE (monad join on events) not working and an open
space leak.  So we are using a Yampa-like approach, but not
specifically Yampa.  However most of the game logic is *not* in AFRP
(arrowized FRP) style, it is just there to give a nice foundation
and top level game loop, playing much the same role as IO does in many
Haskell programs (but it is implemented purely!).

The workhorse of our game has so far been generalized differentials.
While not entirely rigorous, they have provided a very nice framework
in which to express our thoughts and designs, and are very good at
highly dynamic situations which appear in games.  For example, with
arrows it is painful to maintain a list of moving actors such that can
be added and removed.  With differentials this is quite natural.

I haven't published the differential library yet, I am waiting until
we have used them enough to discover essential techniques and find a
nice bases for primitives.  But I will give a sketch here.  Let the
types be your guide, as I am implementing from memory without a
compiler :-P


import qualified Data.Accessor.Basic as Acc
import Data.VectorSpace
import Control.Comonad


A differential is implemented as a function that takes a timestep and
returns an update function.  Don't expose the D constructor; step is
okay to expose, it's kind of a generalized linear approximation.


newtype D a = D { step :: Double - a - a }



instance Monoid (D a) where
   mempty = D (const id)
   mappend da db = D (\dt - step da dt . step db dt)


Given a differential for a component of a value, we can construct a
differential for that value.


accessor :: Acc.T s a - D a - D s
accessor acc da = D (Acc.modify acc . step da)


Given a differential for each component of a tuple, we can find the
differential for the tuple.


product :: D a - D b - D (a, b)
product da db = D (\dt (x,y) - (step da dt x, step db dt y))


A differential can depend on the current value.


dependent :: (a - D a) - D a
dependent f = D (\dt x - step (f x) dt x)


Vectors can be treated directly as differentials over themselves.


vector :: (VectorSpace v, Scalar v ~ Double) = v - D v
vector v = D (\dt x - x ^+^ dt *^ v)


Impulses allow non-continuous burst changes, such as adding/removing
an element from a list of actors. This is the only function that bugs
me.  Incorrectly using it you can determine the framerate, which is
supposed be hidden.  But if used correctly; i.e. only trigger them on
passing conditions, they can be quite handy.  But my eyes and ears are
open for alternatives.


impulse :: (a - a) - D a
impulse f = D (const f)


If we can can find the differential for an element of some comonad
given its context, we can find the differential for the whole
structure.  (Our game world is a comonad, that's why this is in
here)


comonad :: (Comonad w) = (w a - D a) - D (w a)
comonad f = D (\dt - let h w = step (f w) dt (extract w) in extend  
h)


I add new primitives at the drop of a hat. I would like to find a nice
combinator basis, but as yet, one hasn't jumped out at me. It might
require some tweaking of the concept.

The arrow we are using is implemented in terms of differentials:


data Continuous a b = forall s. Continuous s (s - a - (b, D s))



instance Category Continuous where
   id = Continuous () (\() x - (x, mempty))
   Continuous sg0 g . Continuous sf0 f = MkC (sg0,sf0) $ \(sg,sf) x  
-

   let !(y, df) = f sf x -- mind the strict patterns
   !(z, dg) = g sg y in
   (z, product dg df)


Exercise: implement the Arrow and ArrowLoop instances.

And here is where it comes together.  Integration over generalized
differentials is a continuous arrow:


integral :: Continuous (D a) a
integral a0 = Continuous a0 (,)


So our game loop looks something like

Re: [Haskell-cafe] ANNOUNCE: Agata-0.2.0

2010-04-17 Thread Duane Johnson
Wow, very cool!  This is so helpful I'm surprised it isn't part of  
QuickCheck.  Why isn't it?


Regards,
Duane Johnson

On Apr 17, 2010, at 6:43 PM, Jonas Almström Duregård wrote:


{-#LANGUAGE TemplateHaskell #-}
import Test.QuickCheck
import Test.AgataTH

data X a b = X [Either a b] deriving Show
data Y = Y deriving Show
data Z = Z deriving Show

$(agatath $ deriveall [''X,''Y,''Z])

main = sample (arbitrary :: Gen (X Y Z))


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] How can I parameterize the Candidate?

2010-03-28 Thread Duane Johnson

Hello,

How can I parameterize the type of the following data class so that  
any type can be a Candidate?

  type Candidate = String
  data Poll = Poll [Candidate] [Ballot]

My initial thought was to simply put a type variable in place of  
Candidate, but that clearly won't work:


  data Poll = Poll [a] [Ballot]
  Not in scope: type variable `a'
For context: I am building a voting library that addresses the issue  
of polarized American politics by implementing the Virtual Round Robin  
electoral method with a Maximum Majority Voting algorithm for breaking  
cycles.  The beginnings of the library are available at http://github.com/canadaduane/votelib/blob/master/vote.hs

What is a good approach to the parameterized type issue?  Thank you,
Duane Johnson


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] How can I parameterize the Candidate?

2010-03-28 Thread Duane Johnson

Ah, just a character away.  Thank you.

Duane

On Mar 28, 2010, at 9:21 PM, Ivan Miljenovic wrote:


On 29 March 2010 13:13, Duane Johnson duane.john...@gmail.com wrote:
How can I parameterize the type of the following data class so that  
any type

can be a Candidate?

  data Poll = Poll [Candidate] [Ballot]


data Poll a = Poll [a] [Ballot]


  data Poll = Poll [a] [Ballot]


So close...

--
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Is anyone reading Pattern Calculus by Barry Jay?

2009-12-07 Thread Duane Johnson
Thanks Bernie, I've applied for membership in the forum.  I'm grateful  
that technology can connect me with so distant but interesting a group!


Duane


On Dec 7, 2009, at 12:41 AM, Bernie Pope florbit...@gmail.com wrote:


2009/12/7 Duane Johnson duane.john...@gmail.com:
I just bought a copy of Pattern Calculus [1] by Barry Jay and I  
would like
to discuss the lambda- and pattern-calculus with anyone who is  
interested.
 Is there anyone else here who is reading the book and would like  
to discuss
here (if it is appropriate) or take the discussion elsewhere?  My  
knowledge
of types has come primarily through reading this Haskell Cafe list,  
so I am

by no means an expert.  Just a tinkerer :)
Regards,
Duane Johnson

[1] http://lambda-the-ultimate.org/node/3695


Hi Duane,

The Melbourne FPU (functional programming union) is interested in
topics like this, and some of us have a copy, or are about to get a
copy of the book.

  http://groups.google.com.au/group/fpunion

There's already a short thread on the topic - please feel free to sign
up to the group.

We welcome stimulating discussion.

Cheers,
Bernie.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Is anyone reading Pattern Calculus by Barry Jay?

2009-12-06 Thread Duane Johnson
I just bought a copy of Pattern Calculus [1] by Barry Jay and I would  
like to discuss the lambda- and pattern-calculus with anyone who is  
interested.  Is there anyone else here who is reading the book and  
would like to discuss here (if it is appropriate) or take the  
discussion elsewhere?  My knowledge of types has come primarily  
through reading this Haskell Cafe list, so I am by no means an  
expert.  Just a tinkerer :)


Regards,
Duane Johnson

[1] http://lambda-the-ultimate.org/node/3695___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GLFW - Mac OS X

2009-05-07 Thread Duane Johnson
Yes, it seemed to work fine for me (this was about 2 months ago,  
however).  I'm running Leopard (10.5.6).


-- Duane

On May 7, 2009, at 1:12 PM, GüŸnther Schmidt wrote:


Hi,

has anybody recently install the GLFW package on Mac OS X?

It won't install on my machine.

Günther

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Visualizing Typed Functions

2009-05-07 Thread Duane Johnson
No, this is a first-time draft that I made by hand using Inkscape.  If  
we get to a point where a consistent set of visualizations makes  
sense, it would be rewarding to turn into code though.


-- Duane

On May 7, 2009, at 3:06 PM, John Van Enk wrote:

Do you have code to generate these images from type signatures? If  
so I'd *love* to see it.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Visualizing Typed Functions

2009-05-07 Thread Duane Johnson
Thank you, that was very instructive!  Tangible Values look very  
interesting.


-- Duane

On May 7, 2009, at 3:11 PM, Ahn, Ki Yung wrote:


Duane Johnson wrote:
With these functions visualized, one could make a kind of drag and  
drop interface for Haskell programming, although that isn't really  
my intention.  I admit this is a little convoluted even for the  
purpose of visualization, but at least it's a starting place.  Does  
anyone know of another system or better representation?


You must to take a look at this:

Tangible Functional Programming
http://www.youtube.com/watch?v=faJ8N0giqzw

And, a little bit off topic but cool stuff:

Vacuum: visualize Haskell data structures live
http://www.youtube.com/watch?v=X4-212uMgy8


@ It seems that we are getting pretty close to the point that  
youtube is getting to be a better reference than a paper, at least  
for practitioners. A lot of talks are on youtube :)


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Silkworm game

2009-05-03 Thread Duane Johnson
So here's the thing to get it to run on Mac OS X, I have to build  
a SilkwormGame.app directory, with a Resources directory inside,  
along with a lot of other rubbish, just so that GLFW can create a Mac  
OS window that accepts mouse and keyboard input.  This is the purpose  
of the Makefile--it uses a script borrowed from wxWindows to assemble  
all the parts.


Obviously, this rigamarole is not necessary in Unix.  But am I correct  
in assuming that there is no facility in Cabal that prepares a Mac OS  
app in this way?  Any suggestions so that a cabal install will work  
for both Unix and Mac users?


Here is what I get (using Don's Silkworm.cabal):

~/Documents/Duane/BYU Semesters/2009-Winter/Graphics/ 
Silkworm(master) $ cabal install

Resolving dependencies...
Configuring Silkworm-0.2...
Preprocessing executables for Silkworm-0.2...
Building Silkworm-0.2...
[ 1 of 16] Compiling Silkworm.Action  ( Silkworm/Action.hs, dist/ 
build/SilkwormGame/SilkwormGame-tmp/Silkworm/Action.o )

... snip...
[16 of 16] Compiling Main ( main.hs, dist/build/ 
SilkwormGame/SilkwormGame-tmp/Main.o )

Linking dist/build/SilkwormGame/SilkwormGame ...
Installing executable(s) in /Users/duane/.cabal/bin

~/Silkworm(master) $ SilkwormGame
Working in unbundled mode.  You should build a .app wrapper for your  
Mac OS X applications.
SilkwormGame: ~/Silkworm/background.png: openBinaryFile: does not  
exist (No such file or directory)


Putting the binary files in the place it expects produces the same  
working in unbundled mode along with a window that will not capture  
ANY input from the mouse or keyboard.  In fact, it won't even rise to  
the top of the window stack--it remains behind the terminal window.


Thanks for you help,
-- Duane

On May 2, 2009, at 6:07 PM, Don Stewart wrote:


Yes, it is quite fun.

I think it should be using cabal's datadir from Paths_silkworm.hs to
install (and find) the resources.

Yell if you can't figure out how to do that. (xmonad has an example)

-- Don


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Silkworm game

2009-05-03 Thread Duane Johnson
I'm not too much of an expert in Haskell, but I did notice that  
building the game required keeping track of a lot of state  
information, which was not very intuitive in Haskell (although the  
OpenGL state info is rather intuitive).  If I were to do it in Haskell  
again, I would try to learn more about FRP (Functional Reactive  
Programming) and see if that improves things in terms of state.


Ruby is my favorite imperative language, so I would certainly  
recommend it for game development.  It would likely be much easier in  
Ruby, but perhaps a little slower.  My experience with Ruby on Rails  
has been that it is always a little slower than I wish it were :)


-- Duane

On May 3, 2009, at 4:48 PM, Daryoush Mehrtash wrote:

I noticed that Chipmunk also has a Ruby interface.  Do you have any  
pro/con of implementing the game in Ruby vs Haskell?


Thanks,

Daryoush

On Sat, May 2, 2009 at 12:00 PM, Duane Johnson duane.john...@gmail.com 
 wrote:

Reprinted from my blog post [1]:

===

The semester is over, my final project was a success (at least in  
that I passed the class) and it’s time now to release the game I  
made for Graphics 455: Silkworm!


This is my first full application in Haskell.  The process has been  
an enlarging experience–I’ve come to really enjoy the mental work  
that goes into thinking about a program in a functional way.  I  
highly recommend the challenge to other software engineers.


Silkworm combines the Hipmunk binding to Chipmunk 2D Game Dynamics  
with OpenGL, and GLFW (an alternative to GLUT).


It’s built to work on Mac OS X, but it uses cross-platform libraries  
so it should be fairly easy to port to other platforms.  The source  
code is here [2] and below are some screenshots [1]


-- Duane Johnson
(canadaduane)

===

[1] http://blog.inquirylabs.com/2009/05/02/silkworm-game-written-in-haskell/
[2] 
http://inquirylabs.com/downloads/Silkworm.tgz___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

/


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: Silkworm game

2009-05-02 Thread Duane Johnson

Reprinted from my blog post [1]:

===

The semester is over, my final project was a success (at least in that  
I passed the class) and it’s time now to release the game I made for  
Graphics 455: Silkworm!


This is my first full application in Haskell.  The process has been an  
enlarging experience–I’ve come to really enjoy the mental work that  
goes into thinking about a program in a functional way.  I highly  
recommend the challenge to other software engineers.


Silkworm combines the Hipmunk binding to Chipmunk 2D Game Dynamics  
with OpenGL, and GLFW (an alternative to GLUT).


It’s built to work on Mac OS X, but it uses cross-platform libraries  
so it should be fairly easy to port to other platforms.  The source  
code is here [2] and below are some screenshots [1]


-- Duane Johnson
(canadaduane)

===

[1] http://blog.inquirylabs.com/2009/05/02/silkworm-game-written-in-haskell/
[2] 
http://inquirylabs.com/downloads/Silkworm.tgz___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Silkworm game

2009-05-02 Thread Duane Johnson
Thanks, Felipe!  Indeed, it was a wonderful surprise to see a 2D  
physics engine binding for Haskell.  It made it possible for me to  
choose Haskell as my implementation language.  I'm very grateful for  
that.  I wish you luck (and time!) in implementing your ideas :)


Regards,
Duane

On May 2, 2009, at 2:44 PM, Felipe Lessa wrote:


Hi!

On Sat, May 02, 2009 at 01:00:23PM -0600, Duane Johnson wrote:

Silkworm combines the Hipmunk binding to Chipmunk 2D Game
Dynamics with OpenGL, and GLFW (an alternative to GLUT).


It's great to see Hipmunk being useful to someone :).  I've
written the binding to turn some of my ideas into code but I've
never finished any of them.

--
Felipe.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] threadDelay granularity

2009-04-07 Thread Duane Johnson
The Hipmunk 2D physics engine comes with a playground app which  
includes the following function:



-- | Advances the time.
advanceTime :: IORef State - Double - KeyButtonState - IO Double
advanceTime stateVar oldTime slowKey = do
  newTime - get time

  -- Advance simulation
  let slower = if slowKey == Press then slowdown else 1
  mult   = frameSteps / (framePeriod * slower)
  framesPassed   = truncate $ mult * (newTime - oldTime)
  simulNewTime   = oldTime + toEnum framesPassed / mult
  advanceSimulTime stateVar $ min maxSteps framesPassed

  -- Correlate with reality
  newTime' - get time
  let diff = newTime' - simulNewTime
  sleepTime = ((framePeriod * slower) - diff) / slower
  when (sleepTime  0) $ sleep sleepTime
  return simulNewTime



I think the get time is provided by GLFW.

-- Duane Johnson


On Apr 7, 2009, at 9:25 AM, Ulrik Rasmussen wrote:


On Tue, Apr 07, 2009 at 04:34:22PM +0200, Peter Verswyvelen wrote:

Do you want to cap the rendering framerate at 60FPS or the animation
framerate?
Because when you use OpenGL and GLFW, you can just

GLFW.swapInterval $= 1

to cap the rendering framerate at the refresh rate of your monitor  
or LCD

screen (usually 60Hz)


I just want to cap the rendering framerate. The game logic is  
running in

other threads, and sends rendering information via a Chan to the
renderer.

I'm using GLUT, and have never heard of GLFW. However, that seems to  
be

a better tool to get the job done. I'll check it out, thanks :).

/Ulrik




On Tue, Apr 7, 2009 at 1:41 PM, Ulrik Rasmussen hask...@utr.dk  
wrote:



Hello.

I am writing a simple game in Haskell as an exercise, and in the
rendering loop I want to cap the framerate to 60fps. I had planned  
to do

this with GHC.Conc.threadDelay, but looking at it's documentation, I
discovered that it can only delay the thread in time spans that are
multiples of 20ms:


http://www.haskell.org/ghc/docs/6.4/html/libraries/base/Control.Concurrent.html

I need a much finer granularity than that, so I wondered if it is
possible to either get a higher resolution for threadDelay, or if  
there

is an alternative to threadDelay?

I noticed that the SDL library includes the function delay, which
indeed works with a resolution down to one millisecond. However,  
since

I'm using HOpenGL and GLUT, I think it would be a little overkill to
depend on SDL just for this :).


Thanks,

Ulrik Rasmussen
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Linking hmatrix without LAPACK

2009-04-06 Thread Duane Johnson

Hi Alberto!

Thanks for your informative reply.  I looked in to the versions of  
liblapack on my system... it turns out there is indeed a  
liblapack.dylib that (apparently) comes with Mac OS X.  How to tell  
ghc to link to that instead is still in question.


I can run simple matrix operations in ghci as you suggest (in fact,  
runTests 20 succeeds wonderfully); however, I created the following  
simple module (test.hs) and it fails:



module Main where
  import Numeric.LinearAlgebra.Tests

  main = do
runTests 20


I tried plain --make, as well as the -dynamic flag, and then I  
tried the -L shell argument to point to the /usr/lib dir where the  
liblapack.dylib library is located:




$ ghc --make test.hs -o test
[1 of 1] Compiling Main ( test.hs, test.o )
Linking test ...
ld: in /opt/local/lib/liblapack.a(
), not a valid archive member
collect2: ld returned 1 exit status

$ ghc --make -dynamic test.hs -o test
Linking test ...
ld: library not found for -lHShmatrix-0.5.0.1-ghc6.10.1
collect2: ld returned 1 exit status

$ ghc --make -L/usr/lib test.hs -o test
Linking test ...
Undefined symbols:
  _zgemm_, referenced from:
  _multiplyC in libHShmatrix-0.5.0.1.a(lapack-aux.o)
  _zgesv_, referenced from:
  _linearSolveC_l in libHShmatrix-0.5.0.1.a(lapack-aux.o)
  _zpotrf_, referenced from:
  _chol_l_H in libHShmatrix-0.5.0.1.a(lapack-aux.o)
  _dpotrf_, referenced from:
  _chol_l_S in libHShmatrix-0.5.0.1.a(lapack-aux.o)
  _dgemm_, referenced from:
  _multiplyR in libHShmatrix-0.5.0.1.a(lapack-aux.o)
  _dgesv_, referenced from:
  _linearSolveR_l in libHShmatrix-0.5.0.1.a(lapack-aux.o)
  _zgetrf_, referenced from:
  _lu_l_C in libHShmatrix-0.5.0.1.a(lapack-aux.o)
  _zgetrs_, referenced from:
  _luS_l_C in libHShmatrix-0.5.0.1.a(lapack-aux.o)
  _dgetrf_, referenced from:
  _lu_l_R in libHShmatrix-0.5.0.1.a(lapack-aux.o)
  _dgetrs_, referenced from:
  _luS_l_R in libHShmatrix-0.5.0.1.a(lapack-aux.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status



I attempted to install hmatrix with the -faccelerate option, but  
when using ghc --make for the above test code, I received the same  
error messages noted previously.  Is there a way to tell if the - 
faccelerate was acknowledged and that the alternate library was used?


One more clue: I took a look at the directions found on the page at  
mit.edu/harold... it turns out I had installed atlas/lapack  
unnecessarily.  That explains the mysterious not a valid archive  
member message.  Nevertheless, I am still befuddled by the Undefined  
symbols above.  ghc --make is still unable to figure out where the  
liblapack.dylib file is in spite of ghci's success.


Any suggestions from here?

Regards,
Duane Johnson

P.S. I'm CC'ing the Haskell Cafe so that our journey so far can be  
archived.




On Apr 6, 2009, at 12:22 PM, Alberto Ruiz wrote:


Hi Duane,

I have seen your messages to Haskell Cafe but I am still thinking  
about the problem... :)


Can you run simple matrix operations in ghci?

$ ghci
Prelude import Numeric.LinearAlgebra
Prelude Numeric.LinearAlgebra let m = (22) [1..4 :: Double]

(...Loading packages...)

Prelude Numeric.LinearAlgebra m  m
(22)
[  7.0, 10.0
, 15.0, 22.0 ]

If so, some version of blas/lapack can be found in your system, it  
is strange that ghc --make doesn't find them.


Perhaps the problem is that dynamic libraries like liblapack.so are  
required instead of static ones like liblapack.a. (In ubuntu they  
are in the devel packages for blas/lapack.)


I am not familiar with Mac OS, but if you can use the accelerate  
framework in your system you may try the -faccelerate configuration  
option for hmatrix:


cabal install hmatrix -faccelerate

See also the following page (steps 3-8). It explains how to install  
hmatrix on Mac OS (required for other project).


http://mit.edu/harold/Public/easyVisionNotes.html

Please let me know if any of these methods works for you.

Thanks for your message,

Alberto



Duane Johnson wrote:

Hi Alberto,
I've been very happy with hmatrix as I've used it in ghci, and I  
should first thank you for making such an excellent package.  I've  
had trouble when linking it using ghc --make on Mac OS  
(Leopard).  Below are two messages I sent to the Haskell Cafe  
mailing list.  Do you have any insight into either question:

1. How to link without atlas/lapack
2. What the not a valid archive member message means?
Thank you!
Duane Johnson
Brigham Young University
Provo, UT
Begin forwarded message:

From: Don Stewart d...@galois.com
Date: April 5, 2009 11:48:38 PM MDT
To: Duane Johnson duane.john...@gmail.com
Subject: Re: [Haskell-cafe] Re: Linking hmatrix without LAPACK

It would be best to contact the author of hmatrix directly.


duane.johnson:
On a related note, I've installed Atlas, and I get the following  
error

when linking:


Linking SilkwormGame ...
ld: in /opt/local/lib/liblapack.a(), not a valid archive member
collect2: ld

[Haskell-cafe] ghc --make unable to find dynamic library, but ghci can

2009-04-06 Thread Duane Johnson

Hi Haskellers,

This is related to my previous message, Linking hmatrix without  
LAPACK.  Apparently, ghc --make is not finding the lapack.dylib  
library where ghci is (dylib is Mac OS X specific) .  For example, the  
following test module does NOT work when compiled with ghc --make:




module Main where
 import Numeric.LinearAlgebra.Tests

 main = do
   runTests 20



But the following runs fine in ghci:



$ ghci
GHCi, version 6.10.1: http://www.haskell.org/ghc/  :? for help
[...loading packages...]
Prelude :m Numeric.LinearAlgebra.Tests
Prelude Numeric.LinearAlgebra.Tests runTests 20
[...loading packages...]
-- mult
OK, passed 100 tests.
OK, passed 100 tests.
[...more tests pass...]



Can anyone point me in the right direction?

Thank you,
Duane Johnson
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Linking hmatrix without LAPACK

2009-04-06 Thread Duane Johnson

FYI, the following solution worked on Mac OS X (Leopard):


ghc -o SilkwormGame --make -framework Accelerate Main.hs


The key addition is -framework Accelerate.  Thus, on Mac OS X, it is  
only necessary to install the gls library via macports.  Atlas/ 
LAPACK/BLAS etc. come with the operating system framework above.


Also, I had to replace a DYLD_LIBRARY_PATH assignment in my .profile  
with DYLD_FALLBACK_LIBRARY_PATH:



export DYLD_LIBRARY_PATH=/opt/local/lib:/usr/local/cuda/lib



becomes:


export DYLD_FALLBACK_LIBRARY_PATH=/opt/local/lib:/usr/local/cuda/lib


The above change permitted me to use Apple's libraries by default, and  
my macports libraries as fallbacks.  In particular, when I installed  
the atlas package via macports, it seems to have updated a key  
libjpeg.dylib file, thus causing other headaches.  Using the  
fallback method above, the problems went away.


Regards,
Duane Johnson

On Apr 6, 2009, at 1:51 PM, Duane Johnson wrote:


Hi Alberto!

Thanks for your informative reply.  I looked in to the versions of  
liblapack on my system... it turns out there is indeed a  
liblapack.dylib that (apparently) comes with Mac OS X.  How to tell  
ghc to link to that instead is still in question.


I can run simple matrix operations in ghci as you suggest (in fact,  
runTests 20 succeeds wonderfully); however, I created the  
following simple module (test.hs) and it fails:



module Main where
 import Numeric.LinearAlgebra.Tests

 main = do
   runTests 20


I tried plain --make, as well as the -dynamic flag, and then I  
tried the -L shell argument to point to the /usr/lib dir where the  
liblapack.dylib library is located:




$ ghc --make test.hs -o test
[1 of 1] Compiling Main ( test.hs, test.o )
Linking test ...
ld: in /opt/local/lib/liblapack.a(
), not a valid archive member
collect2: ld returned 1 exit status

$ ghc --make -dynamic test.hs -o test
Linking test ...
ld: library not found for -lHShmatrix-0.5.0.1-ghc6.10.1
collect2: ld returned 1 exit status

$ ghc --make -L/usr/lib test.hs -o test
Linking test ...
Undefined symbols:
 _zgemm_, referenced from:
 _multiplyC in libHShmatrix-0.5.0.1.a(lapack-aux.o)
 _zgesv_, referenced from:
 _linearSolveC_l in libHShmatrix-0.5.0.1.a(lapack-aux.o)
 _zpotrf_, referenced from:
 _chol_l_H in libHShmatrix-0.5.0.1.a(lapack-aux.o)
 _dpotrf_, referenced from:
 _chol_l_S in libHShmatrix-0.5.0.1.a(lapack-aux.o)
 _dgemm_, referenced from:
 _multiplyR in libHShmatrix-0.5.0.1.a(lapack-aux.o)
 _dgesv_, referenced from:
 _linearSolveR_l in libHShmatrix-0.5.0.1.a(lapack-aux.o)
 _zgetrf_, referenced from:
 _lu_l_C in libHShmatrix-0.5.0.1.a(lapack-aux.o)
 _zgetrs_, referenced from:
 _luS_l_C in libHShmatrix-0.5.0.1.a(lapack-aux.o)
 _dgetrf_, referenced from:
 _lu_l_R in libHShmatrix-0.5.0.1.a(lapack-aux.o)
 _dgetrs_, referenced from:
 _luS_l_R in libHShmatrix-0.5.0.1.a(lapack-aux.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status



I attempted to install hmatrix with the -faccelerate option, but  
when using ghc --make for the above test code, I received the same  
error messages noted previously.  Is there a way to tell if the - 
faccelerate was acknowledged and that the alternate library was used?


One more clue: I took a look at the directions found on the page at  
mit.edu/harold... it turns out I had installed atlas/lapack  
unnecessarily.  That explains the mysterious not a valid archive  
member message.  Nevertheless, I am still befuddled by the  
Undefined symbols above.  ghc --make is still unable to figure out  
where the liblapack.dylib file is in spite of ghci's success.


Any suggestions from here?

Regards,
Duane Johnson

P.S. I'm CC'ing the Haskell Cafe so that our journey so far can be  
archived.




On Apr 6, 2009, at 12:22 PM, Alberto Ruiz wrote:


Hi Duane,

I have seen your messages to Haskell Cafe but I am still thinking  
about the problem... :)


Can you run simple matrix operations in ghci?

$ ghci
Prelude import Numeric.LinearAlgebra
Prelude Numeric.LinearAlgebra let m = (22) [1..4 :: Double]

(...Loading packages...)

Prelude Numeric.LinearAlgebra m  m
(22)
[  7.0, 10.0
, 15.0, 22.0 ]

If so, some version of blas/lapack can be found in your system, it  
is strange that ghc --make doesn't find them.


Perhaps the problem is that dynamic libraries like liblapack.so are  
required instead of static ones like liblapack.a. (In ubuntu they  
are in the devel packages for blas/lapack.)


I am not familiar with Mac OS, but if you can use the accelerate  
framework in your system you may try the -faccelerate  
configuration option for hmatrix:


cabal install hmatrix -faccelerate

See also the following page (steps 3-8). It explains how to install  
hmatrix on Mac OS (required for other project).


http://mit.edu/harold/Public/easyVisionNotes.html

Please let me know if any of these methods works for you.

Thanks for your message,

Alberto



Duane Johnson wrote:

Hi Alberto

[Haskell-cafe] Linking hmatrix without LAPACK

2009-04-05 Thread Duane Johnson
I'm curious if there is a quick fix to this.  I installed GLS and  
hmatrix, and it runs wonderfully together in ghci.  When I run ghc -- 
make, however, I run into the following link dependency:


Linking SilkwormGame ...
Undefined symbols:
  _dgemm_, referenced from:
  _multiplyR in libHShmatrix-0.5.0.1.a(lapack-aux.o)
  _dgesv_, referenced from:
  _linearSolveR_l in libHShmatrix-0.5.0.1.a(lapack-aux.o)
... etc

Is there a way to tell ghc to not link these?  Or am I making a poor  
assumption that if my code runs in ghci, it does not need LAPACK?


Thanks,
Duane Johnson
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Linking hmatrix without LAPACK

2009-04-05 Thread Duane Johnson
On a related note, I've installed Atlas, and I get the following error  
when linking:



Linking SilkwormGame ...
ld: in /opt/local/lib/liblapack.a(), not a valid archive member
collect2: ld returned 1 exit status


How would I go about diagnosing this?  I've never seen an ld error  
like that.


Thanks again!
Duane Johnson


On Apr 5, 2009, at 11:02 PM, Duane Johnson wrote:

I'm curious if there is a quick fix to this.  I installed GLS and  
hmatrix, and it runs wonderfully together in ghci.  When I run ghc -- 
make, however, I run into the following link dependency:


Linking SilkwormGame ...
Undefined symbols:
 _dgemm_, referenced from:
 _multiplyR in libHShmatrix-0.5.0.1.a(lapack-aux.o)
 _dgesv_, referenced from:
 _linearSolveR_l in libHShmatrix-0.5.0.1.a(lapack-aux.o)
... etc

Is there a way to tell ghc to not link these?  Or am I making a poor  
assumption that if my code runs in ghci, it does not need LAPACK?


Thanks,
Duane Johnson


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Wishful thinking: a text editor that expands function applications into function definitions

2009-04-02 Thread Duane Johnson
So I was thinking about a killer feature for a text editor.   
Wouldn't it be neat if you could expand function calls into their  
definitions, in-place?


For example, suppose we have minus defined like so, somewhere in  
another file:



minus (a, b, c) (x, y, z) = (a - x, b - y, c - z)


Later, we make use of the function in our current context:


let p1 = (1, 2, 3)
 p2 = (4, 5, 6)
in p1 `minus` p2


By telling the editor to expand the minus, we get a temporary  
replacing of the above with:



(1 - 4, 2 - 5, 3 - 6)


Another example:


  parse s = map readLine ls


And supposing that readLine is defined somewhere else, moving the  
cursor to readLine in the line above and expanding becomes:



  parse s = map (\line - words $ dropWhile (== ' ') line)


This is all pretty standard for the kinds of things we do in Haskell  
to work it out by hand, but is there any reason the parser couldn't do  
this?  I think it would be even harder to do automatically in any  
other language.  Maybe it's already been attempted or done?


Curious,

Duane Johnson

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wishful thinking: a text editor that expands function applications into function definitions

2009-04-02 Thread Duane Johnson
Perhaps it wouldn't be as all-wonderful as I think, but as a new  
Haskell user, I am constantly switching back and forth between various  
definitions of things trying to compare documentation and files...


The purpose of expansion as I was explaining it is not to  
*permanently replace* what is in the text, but rather to *temporarily  
replace* it.  I imagine it kind of like a zoom in for code.  You  
could zoom in on one function, and seeing a new function that you  
don't recognize, zoom in again, and so on.  Once done, you would hit  
ESC to make it all return as it was.


BTW, I do like your suggestion of tooltip types.  That would be very  
handy!


Duane Johnson

On Apr 2, 2009, at 6:24 PM, Zachary Turner wrote:

It seems like a neat feature, and it could just be my inexperience  
with Haskell but it doesn't seem killer.  For example, why would  
you want to expand readLine like that if you already have it  
defined?  It seems to defeat much of the benefit of functional  
languages in the first place, which is that it's so easy to reuse  
code by composing functions into new functions.  I can see the case  
where you're passing all constants to a function, because then  
supposedly inlining it might be more efficient, but I would think  
the compiler would optimize most of the cases for you anyway.


One feature that I -do- think would be killer though, is the ability  
for the editor to do a mouse-over tooltip of a) function  
definitions, and b) arbitrary expressions.  So like in your example  
above, hovering the mouse over `minus` in the expression p1 `minus`  
p2 would pop up a two line tooltip that looked like this


minus :: (Num a, Num b, Num c) = (a,b,c) - (a,b,c) - (a,b,c)
minus :: first - second - (a,b,c)

Something along those lines.  It's nice to be able to see names of  
function arguments without having to navigate away from the line  
you're editing.  This isn't the killer yet though since it's  
actually pretty standard for most sufficiently advanced programming  
language IDEs.  The killer is that the mouse-over event would also  
look one line above the function definition for a comment.  It would  
then scan backward until it finds no more comments.  It would then  
display that text above the function definition.  It's great having  
a type signature, but comments would just be icing on the cake.


For arbitrary expressions, suppose you had the following function:

replaceItem :: [a] - (a - Bool) - a - [a]
let replaceItem xs pred = (: filter (not.pred) xs)

You then highlight the text filter (not.pred) and hover over the  
highlighted text.  The mouse then pops up a tooltip that says [a] - 
 [a].  That would be killer IMO




On Thu, Apr 2, 2009 at 7:01 PM, Duane Johnson  
duane.john...@gmail.com wrote:
So I was thinking about a killer feature for a text editor.   
Wouldn't it be neat if you could expand function calls into their  
definitions, in-place?


For example, suppose we have minus defined like so, somewhere in  
another file:


minus (a, b, c) (x, y, z) = (a - x, b - y, c - z)

Later, we make use of the function in our current context:

let p1 = (1, 2, 3)
p2 = (4, 5, 6)
in p1 `minus` p2

By telling the editor to expand the minus, we get a temporary  
replacing of the above with:


(1 - 4, 2 - 5, 3 - 6)

Another example:

 parse s = map readLine ls

And supposing that readLine is defined somewhere else, moving the  
cursor to readLine in the line above and expanding becomes:


 parse s = map (\line - words $ dropWhile (== ' ') line)

This is all pretty standard for the kinds of things we do in Haskell  
to work it out by hand, but is there any reason the parser couldn't  
do this?  I think it would be even harder to do automatically in any  
other language.  Maybe it's already been attempted or done?


Curious,

Duane Johnson

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Wishful thinking: a text editor that expands function applications into function definitions

2009-04-02 Thread Duane Johnson
I hadn't seen that feature in Excel before.  When I press F9 it seems  
to evaluate the expression, which isn't quite what I had in mind (Mac  
OS).  Is that the same as what you get?


Duane

On Apr 2, 2009, at 8:33 PM, Michael Snoyman wrote:




2009/4/3 Duane Johnson duane.john...@gmail.com
Perhaps it wouldn't be as all-wonderful as I think, but as a new  
Haskell user, I am constantly switching back and forth between  
various definitions of things trying to compare documentation and  
files...


The purpose of expansion as I was explaining it is not to  
*permanently replace* what is in the text, but rather to  
*temporarily replace* it.  I imagine it kind of like a zoom in for  
code.  You could zoom in on one function, and seeing a new  
function that you don't recognize, zoom in again, and so on.  Once  
done, you would hit ESC to make it all return as it was.


Sounds exactly like the F9 feature in Excel (that's where you got  
the idea, right?). I can personally attest that it can be an  
incredibly useful feature.


Michael



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: vacuum: extract graph representations of ghc heap values.

2009-04-01 Thread Duane Johnson

Hi Matt,

That looks pretty neat.  Can you explain a little more about what I'm  
seeing in these visualizations, and where this kind of visualization  
would be most useful? (Debugging, algorithm tuning, etc.)?


Take care,
Duane Johnson
http://blog.inquirylabs.com/

On Mar 30, 2009, at 10:54 PM, Matt Morrow wrote:

I am pleased to announce the release of vacuum, a Haskell library  
for extracting graph
representations of values from the GHC heap, which may then be  
further processed and/or

translated to Graphviz dot format to be visualized.

The package website is at http://moonpatio.com/vacuum/, which  
contains a gallery section

(which i intend to add to over time).

The most recent version is 0.0.6, which is available on Hackage:
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/vacuum/.

Feedback, comments, and/or gallery submissions will be gratefully  
received via this email
address (contrary to the email address currently on the vacuum  
Hackage page (i fail at

setting up email :)).

Matt

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: vacuum: extract graph representations of ghc heap values.

2009-04-01 Thread Duane Johnson
Ah, I hadn't read Don's thread before posting my previous comment.   
That cleared things up for me :)


Thanks!
Duane Johnson

On Mar 30, 2009, at 10:54 PM, Matt Morrow wrote:

I am pleased to announce the release of vacuum, a Haskell library  
for extracting graph
representations of values from the GHC heap, which may then be  
further processed and/or

translated to Graphviz dot format to be visualized.

The package website is at http://moonpatio.com/vacuum/, which  
contains a gallery section

(which i intend to add to over time).

The most recent version is 0.0.6, which is available on Hackage:
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/vacuum/.

Feedback, comments, and/or gallery submissions will be gratefully  
received via this email
address (contrary to the email address currently on the vacuum  
Hackage page (i fail at

setting up email :)).

Matt

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] type Rational and the % operator

2009-03-28 Thread Duane Johnson

I believe it's


import Data.Ratio


I found it on hayoo... http://holumbus.fh-wedel.de/hayoo/hayoo.html?query=%25#0 
:%25


-- Duane Johnson

On Mar 28, 2009, at 7:39 PM, michael rice wrote:


Hi,
I've been away from Haskell Land for a while, but I think the  
function cf below, given a list of Ints should calculate a  
continuous fraction. I'm using Hugs 98 and get errors when loading  
and also when trying to use the % operator at the command prompt  
(see below). What must I do to get this to work?


Michael

===

cf :: [Int] - Rational
cf [] = 0
cf (x:[]) = 1 % x
cf (x:xs) = x + (1 % cf xs)

Hugs :load cf.hs
ERROR cf.hs:2 - Undefined variable %
Hugs

Hugs 1 % 5
ERROR - Undefined variable %
Hugs




___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Making videos of your project

2009-03-25 Thread Duane Johnson

Cool!  Thanks, Don.  I enjoyed the show :)

Duane Johnson

On Mar 24, 2009, at 2:20 AM, Don Stewart wrote:


Hey guys,

I've been making quick youtube videos of projects to convey what they
do. Here, for example, using Tim Docker's Charts library in ghci:

   http://www.youtube.com/watch?v=2Lqzygxvus0

(Click on the HD button for higher res).

Or one of Neil Brown's SG OpenGL graphics library,

   http://www.youtube.com/watch?v=tJ6AtfcorkY

You can create your own really simply:

   1. install 'recordmydesktop'
   I use: recordmydesktop --no-sound --v_bitrate 200
   2. type 'recordmydesktop'
   3. do something with haskell
   4. hit control-C
   5. upload out.ogv to youtube

If you're a library author of one of the 2 or 3D packages, please
consider video along with other why I want to use this material.

-- Don
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ghci + hopengl

2009-03-25 Thread Duane Johnson
Neat, thanks for that tip Peter.  It looks like mkbundl does  
everything I do manually, and more.  But just for the record, in case  
anyone (Scott?) wants to do it the hard way... :)


1. Download the macosx-app shell script from wxhaskell.  Make it  
executable (i.e. chmod a+x macosx-app)

2. Run macosx-app [executable-filename], e.g. macosx-app Playground
3. Run open [generated app directory], e.g. open Playground.app

I also blogged about it here.

Duane Johnson
http://blog.inquirylabs.com/

On Mar 24, 2009, at 4:48 PM, Peter Verswyvelen wrote:




On Tue, Mar 24, 2009 at 11:35 PM, Scott A. Waterman tswater...@gmail.com 
 wrote:

Duane -

yes, please.  I've been wondering how to compile to a Mac .app  
structure.


http://hackage.haskell.org/cgi-bin/hackage-scripts/package/mkbndl

Also, anyone have any hints about distributing Haskell apps for mac,  
when you know the target will certianly *not* have a GHC environment  
on it?


GHC statically links everything, so you don't need the GHC  
environment to run the app.



Thanks
--ts


On Mar 21, 2009, at 2:18 PM, Duane Johnson wrote:

I've had issues with ghci and opengl... I usually have to compile my  
programs before they will run.  I'm not sure why that's the case,  
but I too get strange window behavior (sometimes it freezes, other  
times it doesn't even show up).


If you're on a Mac and would like help compiling to a .app folder,  
let me know and I can post how I did that.


Regards,
Duane Johnson
http://blog.inquirylabs.com/


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Learning Haskell

2009-03-23 Thread Duane Johnson
I second that!  Haskell is a very fun and engaging language (with its  
accompanying corpus of theorems, and its great community)...


My timing is a little bit longer than Rick's... I've been eyeing  
Haskell for about 8 months, reading books, poking around etc.  I've  
started to feel comfortable enough in the last month to begin a  
serious(ish) project.  For my debut, I'm trying to build a game with  
HOpenGL.  I wouldn't take my 8-month timeline as much of a benchmark,  
however, since I have not been very deeply involved in studying the  
language (I have no projects that require day-to-day coding in Haskell).


Duane Johnson
http://blog.inquirylabs.com/

On Mar 23, 2009, at 9:13 PM, Rick R wrote:

I've been messing with Haskell since the Middle of January on  
evenings and weekends. Just now I'm getting to the point where I can  
construct nontrivial programs with little help from #haskell.


 It is by no means my most proficient language, I've been coding C++  
and other languages for over 10 years. It is by far my favorite,  
however, and if I could do it full time I would.


On Mon, Mar 23, 2009 at 11:08 PM, Tom.Amundsen  
tomamund...@gmail.com wrote:


How long did it take you to become proficient in Haskell? By that, I  
mean -
how long until you were just as comfortable with Haskell as you were  
with

your strongest language at that time?
--
View this message in context: 
http://www.nabble.com/Learning-Haskell-tp22673552p22673552.html
Sent from the Haskell - Haskell-Cafe mailing list archive at  
Nabble.com.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe



--
We can't solve problems by using the same kind of thinking we used  
when we created them.

   - A. Einstein
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ghci + hopengl

2009-03-21 Thread Duane Johnson
I've had issues with ghci and opengl... I usually have to compile my  
programs before they will run.  I'm not sure why that's the case, but  
I too get strange window behavior (sometimes it freezes, other times  
it doesn't even show up).


If you're on a Mac and would like help compiling to a .app folder, let  
me know and I can post how I did that.


Regards,
Duane Johnson
http://blog.inquirylabs.com/

On Mar 21, 2009, at 1:27 PM, Rafael Cunha de Almeida wrote:


Hello,

I'm writing a program for plotting vectorial functions and maybe
something else in the future. My goal is to be able to have the
following usage:

Prelude :l Galo.hs
Prelude Galo show3Dvec (\t - (t, t, 0)) [0.0,0.01 .. 1.0]
* shows graph *
Prelude Galo show3Dvec (\t - (t, t**2, 0)) [0.0,0.01 .. 1.0]
* shows new graph *

I already done something, the main module can be found here:


http://github.com/aflag/galo/blob/0a54a53db0f66384cfc0775f12582931d0fb4205/Galo.hs

The whole project is found here:

http://github.com/aflag/galo/tree/master

I think mainLoop is somehow responsible to exit the whole thing. I
tried to even call that function through forkIO. But didn't work quite
well: my terminal started behaving really weird after I closed the
window.

Could you explain me what is going on and what should I look into for
understanding how to solve the issue?

[]'s
Rafael
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] New Cabal FAQ

2009-03-21 Thread Duane Johnson
As a new Haskell user, I have to heartily agree about the sign-posts.   
Cabal is a superb, easy-to-use command-line tool for Haskell package  
management, but browsing various getting started with Haskell pages  
didn't lead me to clear instructions that cabal exists and that it is  
really important to install.


In addition, may I suggest that the very first thing under Quick Links  
at http://haskell.org/cabal/ should be the following:


Get Cabal

Currently, the first link is How to install a Cabal package which  
was quite confusing for me as a new user, since I knew I wanted the  
cabal command on my system and that getting it is a prerequisite to  
installing cabal packages.


Next, in a round-about manner, the link sends the user to http://haskell.org/haskellwiki/Cabal/How_to_install_a_Cabal_package 
 which is fairly dense reading considering that the user is just  
trying to get cabal.  At the bottom of the third paragraph of that  
page, it links to http://haskell.org/haskellwiki/Cabal-Install.  The  
Cabal-Install page itself provides an introduction paragraph stating  
that there exists a caball-install package which sounds enticing--- 
but wait, is it a package?  Doesn't that mean I need cabal to install  
cabal-install?  What's going on here


Strangely, the Usage section is listed before the Installation  
section which further confounded me until I read everything carefully.


So in retrospect, I would have very much appreciated something like  
this (my blog entry to future Haskellers).  Perhaps we could create  
the Get Cabal page and split it down the middle, one side for  
Windows and one side for Mac OS X / Linux / Unix.  It should be very  
minimal and have all of the necessary steps first with commentary  
later in case things go wrong or the visitor decides to return for  
details.


It also might be a good idea to use the cabal-specific pages on the  
wiki to redirect the user to the official cabal page where the  
official instructions reside since they show up in Google searches


Duane Johnson
http://blog.inquirylabs.com/

On Mar 21, 2009, at 3:44 PM, Duncan Coutts wrote:


Hi all,

I should have done this ages ago but there's now a Cabal FAQ on the
Cabal website:

http://haskell.org/cabal/FAQ.html

It's not linked in yet, I'm looking for feedback and patches. The  
Cabal

website is now maintained in darcs so it's easy to send in
contributions:

darcs get http://haskell.org/cabal/

For new pages like the FAQ I've been using markdown via pandoc. If
appropriate we can migrate old pages to use that too.

The main Cabal home page needs some love. We should have the
cabal-install download directly on the front page. We should have  
quick

intro tutorials for using the cabal command line program to install
packages. There's lots of good material in the user guide but it is  
not

well sign-posted.

Duncan

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: A guess on stack-overflows - thunksbuild-upand tail recursion

2009-03-20 Thread Duane Johnson
I just found out about GHood through this thread, and since it  
impressed me very much to see something so cool, I feel bad making  
this comment... but I am always disturbed by the flickering effect  
produced by java applets in my browser (FF 3.0) while scrolling.  From  
an implementation standpoint this is obviously a nitpick, but from a  
designer standpoint it nearly single-handedly kills any prospect of my  
putting it up on a page.


With that said, I think the canvas+js idea is a wonderful alternative  
to proprietary Flash.


Regards,
Duane Johnson

On Mar 20, 2009, at 5:36 PM, Claus Reinke wrote:


It would be great to have a video of this in action up on youtube.
You can simply 'recordmydesktop' on linux (and likely elsewhere),  
then

upload the result.


I'm curious: how would a non-interactive animation running in Flash
in a browser be better than an interactive animation running in Java
in a browser?-) When I wrote GHood (many years ago), I explicitly
looked into the applet option, in the hope that people would use it
to document and discuss observation logs of their favourite Haskell
strictness issues, with animations available on their web pages, right
next to the discussions.
That hasn't happened yet (the only users I was aware of were the
DrHylo/Pointless Haskell project), but I just checked, the old .jar  
file,
the source of which hasn't been perused for a long time, still  
worked in applet mode (in Opera, a browser I didn't know about in  
2001,

using a Java Runtime several versions removed from that time - try
that in Haskell.. ;-), straight from that old project page (which  
also explains how to set such things up), so anyone could add  
animations of their favourite examples on their web-pages. But don't  
let that keep you or anyone else from addressing the youtube  
audience (one could add audio explanations, I guess).


Claus

PS. Perhaps these days, someone should rewrite the log viewer
  in Canvas+JavaScript as a more lightweight and modern platform.


It also helps the general adoption cause, having Haskell more visible
and accessible.
claus.reinke:
The problem occurs when the result value is needed and thus  
the   thunks need to be reduced, starting with the outermost,  
which can't   be reduced without reducing the next one  etc  
and it's these   reduction steps that are pushed on the stack  
until its size cause a   stack-overflow.


Yes, that's exactly right, and something that's not often pointed  
out.


Btw, this is kind of relative strictness (when is one part of my  
program

needed to answer demands on another part) is the kind of example
for which old GHood can be helpful (once you get used to the  
display).


If you have Java on your machines, try installing GHood [1] (on  
hackage thanks to Hugo Pacheco), then things like


ghc -e ':m +Debug.Observe' -e 'printO $ observe foldr foldr (+)  
0 [1..4] '
ghc -e ':m +Debug.Observe' -e printO $ observe \foldl'\  
foldl' (+) 0 [1..4] 
ghc -e ':m +Debug.Observe' -e 'printO $ observe foldl foldl (+)  
0 [1..4] '


This was also among the examples on the GHood home page [2], so  
you could try the applet version instead, and in section 4.2 of  
the paper [3] (as a well known strictness problem;-). Page and  
paper

mention a few other similar examples and discuss some differences
between static (which parts are needed at all) and dynamic  
strictness

(which parts are needed when, relative to other demands).

Claus

[1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/GHood
[2] http://www.cs.kent.ac.uk/~cr3/toolbox/haskell/GHood
[3] http://www.cs.kent.ac.uk/~cr3/publications/GHood.html

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Why do functions not inherit class when renamed?

2009-03-19 Thread Duane Johnson
I'm not sure I understand what is going on here, but it seems to me  
that the following assignment of mult = (*) causes mult to lose  
out on some of the polymorphic behavior of (*).  Is that right?  If  
so, why?




Prelude Data.Function Data.List Data.Char let sizeMult = (*) `on`  
length

Prelude Data.Function Data.List Data.Char sizeMult Duane Johnson
35
Prelude Data.Function Data.List Data.Char let mult = (*)
Prelude Data.Function Data.List Data.Char let sizeMult2 = mult `on`  
length


interactive:1:26:
Couldn't match expected type `Integer' against inferred type `Int'
In the second argument of `on', namely `length'
In the expression: mult `on` length
In the definition of `sizeMult2': sizeMult2 = mult `on` length
Prelude Data.Function Data.List Data.Char




Thanks,
Duane Johnson
http://blog.inquirylabs.com/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Who generates Haskell code and uses type information at runtime? (fwd)

2009-03-18 Thread Duane Johnson
Out of curiosity, do you know if HaRe works for 6.10?  The page only  
mentions GHC 6.6 and 6.8.


Duane Johnson
http://blog.inquirylabs.com/


On Mar 18, 2009, at 6:14 AM, Chris Brown wrote:

I'm not sure if you got my previous message, as I was having some  
problems posting to the list...



Putting in a nutshell, I generalize an extensional defined function
definition into a recursive one. This is done in a number of steps by
modifying expressions and exploiting type information of
sub-expressions. For example:
rev [] = []
rev [a] = [a]
rev [a,b] = [b,a]
rev [a,b,c] = [c,b,a]
~~
rev x = y
~~
rev [] = []
rev (x:xs) = (y:ys)
~~
rev [] = []
rev (x:xs) = (last (x:xs)) : (reverse (x:xs))
The initial set of rules is given by the user (in a file, via  
IO, ...).
The problem later is to infer the type of an intermediate variable,  
e.g.

'y'.


I'm still not entirely sure what you want to do here. But it sounds  
like HaRe could already do most of this for you via a sequence of  
folds, unfolds, introduce pattern matching and generative folding.  
HaRe already has built-in support for some symbolic evaluation,  
which is already used in the generative

fold refactoring, and has type checking support too.

http://www.cs.kent.ac.uk/projects/refactor-fp/hare.html

If it doesn't do exactly what you want out of the tin, it does have  
a large API for designing transformations over Haskell code.


http://www.cs.kent.ac.uk/projects/refactor-fp/hare/haddock/RefacUtils.html



Chris.





Thanks,
Martin
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe



--
Chris Brown

Visualization Software Engineer, Peiriannydd Meddalwedd Delweddu.

Cast Ltd., Technium CAST,
Ffordd Penlan, Parc Menai,
Bangor, Gwynedd UK. LL57 4HJ.

Tel: +44 (0)1248 675038
Fax: +44 (0)1248 675012
Mobile: +44 (0)7917 763712


--
Centre for Advanced Software Technology Limited is a limited company  
registered in England and Wales.
Registered Number: 04473521, Registered Office: Finance Office,  
Bangor University, College Road, Bangor, Gwynedd. LL57 2DG.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] darcs fundraising drive - THANK-YOU!

2009-03-16 Thread Duane Johnson
I'm just getting to know this community, and I have to say, I am very  
impressed by this.  Congrats to everyone for making the world a better  
place :)


-- Duane Johnson

On Mar 16, 2009, at 6:09 AM, Eric Kow wrote:


Dear darcs users and Haskellers,

I wanted to thank you all for your contributions to our first darcs
fundraising drive.  We've done it!  We managed to raise $1000, over  
two

weeks with contributions from 22 donors.  This means that we will able
to help our programmers travel to the darcs hacking sprint.

This fundraising drive is over, but donations will still be gratefully
accepted.  In the long term, we hope to raise another $5000 to pay  
for a
summer project ($4000) and also to pay for travel (another $1000) to  
the

third hacking sprint this October or November.

Again, thank-you!

--
Eric Kow http://www.nltg.brighton.ac.uk/home/Eric.Kow
PGP Key ID: 08AC04F9
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Loading 3D points normals into OpenGL?

2009-03-11 Thread Duane Johnson

Hi,

I am considering writing a VRML (.wrl) parser so that I can load  
points and normals for a game I'm making in Haskell.  Is there  
something around that will already do the trick?  Or perhaps another  
format is preferred and already supported?


Thanks,
Duane Johnson
(canadaduane)
http://blog.inquirylabs.com/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Loading 3D points normals into OpenGL?

2009-03-11 Thread Duane Johnson
The MTL portion of that library depends on an external DevIL  
library ... is there a way to specify just the Obj portion which has  
no such dependency?


Thanks,
Duane

On Mar 11, 2009, at 5:28 PM, Luke Palmer wrote:


You might be interested in the obj library: 
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/obj

Luke

On Wed, Mar 11, 2009 at 5:23 PM, Duane Johnson duane.john...@gmail.com 
 wrote:

Hi,

I am considering writing a VRML (.wrl) parser so that I can load  
points and normals for a game I'm making in Haskell.  Is there  
something around that will already do the trick?  Or perhaps another  
format is preferred and already supported?


Thanks,
Duane Johnson
(canadaduane)
http://blog.inquirylabs.com/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe