Re: [Haskell-cafe] Open CV or alternate image processing library for Haskell on windows?

2011-05-17 Thread Ville Tirronen
Hi,

I have little knowledge about windows in general, but CV package requires
that you install
the opencv c-libraries. You will find them at
http://opencv.willowgarage.com/. Including
a windows distribution.

However, CV package has not been tried on windows, so there might or might
not
be trouble that way. If you run into that said trouble, write a ticket at
https://github.com/aleator/CV/issues and I can try to take a look

Kind regards,
 Ville


On 17 May 2011 07:34, Antoine Latter aslat...@gmail.com wrote:

 On Mon, May 16, 2011 at 10:47 PM, Gregory Guthrie guth...@mum.edu wrote:
  Below is the install result. It does claim that You must install OpenCV
 (development packages) prior to installing this package.
  I don't' see any Haskell /cabal opencv package, so am not sure what this
 means one has to do.

 The error isn't referring to a Haskell package - it is saying that it
 cannot find the libraries installed on your computer.

 Note the line Missing C libraries: cv, highgui, cv, highgui. These
 are not referring to Haskell packages - they are referring to libcv
 and libhighgui, whatever those are.

 What sort of computer are you using?

 Antoine

 
  I am not familiar enough with the Haskell install and make environment to
 go hacking into it, I was hoping for a simple cabal install!
 
  Thanks for the note and pointers. I am a bit surprised at the lack of
 graphics and Image processing libraries. I found several for Unix/Linux
 only, and their installs on Windows fail.
 
  I also love Linux, but windows is the 93% market share, and our student
 labs are all windows. I am trying to advocate using FP in more of our
 undergraduate level courses, and thought this might be a good area; perhaps
 not.
 
  Are the two packages for Hopencv the two on the hackage page? It looked
 to me like only one was claimed to be current and mostly complete.
  ---
 
  C:\Users\guthriecabal install hopencv
  Resolving dependencies...
  Configuring HOpenCV-0.1.2.2...
  Warning: 'include-dirs: /usr/include/opencv' directory does not exist.
  Warning: 'include-dirs: /usr/include/opencv' directory does not exist.
  cabal: Missing dependencies on foreign libraries:
  * Missing C libraries: cv, highgui, cv, highgui
  This problem can usually be solved by installing the system packages that
  provide these libraries (you may need the -dev versions). If the
 libraries
  are already installed but in a non-standard location then you can use the
  flags --extra-include-dirs= and --extra-lib-dirs= to specify where they
 are.
  cabal: Error: some packages failed to install:
  HOpenCV-0.1.2.2 failed during the configure step. The exception was:
  ExitFailure 1
 
  C:\Users\guthriecabal install cv
  Resolving dependencies...
  Configuring unix-2.4.2.0...
  cabal: The package has a './configure' script. This requires a Unix
  compatibility toolchain such as MinGW+MSYS or Cygwin.
  cabal: Error: some packages failed to install:
  CV-0.3.0.1 depends on unix-2.4.2.0 which failed to install.
  JYU-Utils-0.1.1.1 depends on unix-2.4.2.0 which failed to install.
  unix-2.4.2.0 failed during the configure step. The exception was:
  ExitFailure 1
 
  C:\Users\guthriecabal install highgui
  cabal: There is no package named 'highgui'.
  You may need to run 'cabal update' to get the latest list of available
  packages.
 
  ---
  -Original Message-
  From: Casey McCann [mailto:syntaxgli...@gmail.com]
  Sent: Monday, May 16, 2011 1:18 PM
  To: Gregory Guthrie
  Cc: haskell-cafe@haskell.org
  Subject: Re: [Haskell-cafe] Open CV or alternate image processing
 library for Haskell on
  windows?
 
  On Mon, May 16, 2011 at 8:37 AM, Gregory Guthrie guth...@mum.edu
 wrote:
   I wanted to look into using Haskell for an introductory Image
 Processing class, but the main
  package used for such things (OpenCV) does not appear to be available
 for windows systems.
  
   Is there some other good option for image processing in Haskell, or
 has anyone ported
  openCV to a windows Leksah environment?
 
  Which package are you having difficulty with? OpenCV is a library
 written in C/C++ and
  appears to work on Windows, and there looks to be two different packages
 on Hackage
  providing bindings to it, neither of which seems to have any issues with
 Windows. One does
  rely on the unix package, but my understanding is that Cygwin is
 sufficient for that--not
  certain about the details, though. I haven't used any of these packages
 or OpenCV itself
  personally, so there may be further issues I'm not seeing, but I would
 guess that any
  difficulty you've encountered was a matter of build tools and system
 configuration, not the
  libraries themselves.
 
  I have found it necessary on multiple occasions to do manual tweaks and
 jury-rigging when
  installing FFI bindings from Hackage on Windows, as opposed to the
 typically seamless
  process of installing an external 

Re: [Haskell-cafe] ErrorT vs Either

2011-05-17 Thread Daniel Fischer
On Tuesday 17 May 2011 01:40:41, Gracjan Polak wrote:
 Daniel Fischer daniel.is.fischer at googlemail.com writes:
  On Monday 16 May 2011 23:41:44, Gracjan Polak wrote:
   Thanks Daniel, Yves and Edward for explanation. Two things come to
   my mind now.
   
   1. It should be unified.
  
  The (Either e) Monad instance was recently changed after people have
  long complained that there shouldn't be an (Error e) constraint.
  It's unlikely that that will be reverted soon.
 
 I did not request a revert, I asked about consistent behavior.
 

Not directly, but for

ghci fail msg :: Either String Int

and

ghci runIdentity  (runErrorT (fail msg)) :: Either String Int

to have the same behaviour, there are three possibilities

a) change ErrorT's behaviour, so that the latter matches the former.
b) change (Either e)'s Monad instance so that the former matches the 
latter.
c) change both.

b) is the most reasonable, IMO, and that's reverting the change of the 
Monad instance of (Either e).

  It's the (Error e) Monad which adds the structure [nowadays, Error e =
  ErrorT e Identity].

Misremembered, there never was a newtype doing for ErrorT what State does 
[did] for StateT etc.

 
 I do not understand this part. Can you elaborate?
 

You wrote:
... Should be the same as Identity monad should not add structure.

Now, the Identity Monad doesn't add the structure that makes the former 
result in (Left msg),

Prelude Control.Monad.Identity runIdentity (fail msg) :: Either String 
Int
*** Exception: msg

The Monad instance that makes fail not be error is

instance (Monad m, Error e) = Monad (ErrorT e m) where ...



   2. I need a Failure monad that works well with pattern match
   failures
   
   (that call fail). I'd like to use it like this:
   runErrorT $ do
   
Active - getStatus-- ensure proper status
Just elm - lookup stuff there -- lookup element
when (condition) $ fail wrong!   -- check condition
return 1234-- return useful value
   
   sort of...
  
  That does work, doesn't it?
 
 Indeed this does work, but it is fragile wrt refactorings.
 
 Suppose we have the code:
 
   result - runErrorT $ do
  lift $ print was here
  fail msg
 
   (result = Left msg)
 
 after a while the print statement may be removed:
 
   result - runErrorT $ do
  fail msg
 
   (result = Left msg)
 
 and then somebody will see that inner 'do' does not depend on outer
 monad

But the transformation

result - runWhatEver stuff

to

let result = stuff

generally doesn't typecheck, so it can't be generally correct, hence if it 
typechecks, one has to examine each case to decide where it's valid and 
where not. One big point of ErrorT is the working around the inner Monad's 
fail, so it should be a big warning sign if a `fail' appears.

 so next refactoring will be:
 
   let result = do
  fail msg
 
   (result = error msg)
 
 And here code breaks...
 
  Roll your own,
 
 That is a good idea. I looked also at Attempt.
 
 Thanks for responses.

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


Re: [Haskell-cafe] generic putback

2011-05-17 Thread Sergey Mironov
Thanks for your answers! I looked further and found that 'Oleg alredy
did it'. Really, looks like iteratees will suit my needs :) I'm sorry
for bothering.

Sergey

2011/5/15 Daniel Gorín dgo...@dc.uba.ar:
 I think you need to change the type of putback slightly:

 import Data.IORef

 putback :: a - IO a - IO (IO a)
 putback a action =
   do next - newIORef a
      return (do r - readIORef next; writeIORef next = action; return r)

 main =
   do getChar' - putback 'a' getChar
      str - sequence $ take 10 $ repeat getChar'
      putStrLn str

 Thanks,
 Daniel

 On May 15, 2011, at 4:33 PM, Sergey Mironov wrote:

 Hi Cafe. I wonder if it is possible to write a IO putback function
 with following interface

 putback :: a - IO a - IO a
 putback x io = ???


 where io is some action like reading from file or socket.
 I want putback to build new action which will return x on first call,
 and continue executing io after that.

 Thanks in advance!
 Sergey.

 ___
 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] Using cmake with haskell

2011-05-17 Thread Maciej Marcin Piechotka
On Sat, 2011-05-14 at 17:32 -0700, Gregory Crosswhite wrote:
 On 5/14/11 1:25 PM, Maciej Marcin Piechotka wrote:
  (to mention
  one which is often neglected - parallel build).
 
 While I do appreciate you stepping in to defend autotools (if for no 
 other reason then because someone has to so that the discussion is 
 balanced :-) ), I think that you are wrong to say that autotools is 
 unusual in getting the idea of parallel builds right, since in my 
 experience the opposite is the case:  most systems support parallel 
 builds --- such as SCons, CMake, I think waf, etc. --- with Cabal being 
 an outlier here.
 
 Cheers,
 Greg

Hmm. I could bet I have read it somewhere but I cannot find it right
now. Assume I haven't said it.

Regards


signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Inconsistent window updates with SDL library

2011-05-17 Thread Neil Brown

On 17/05/11 01:42, Michael Serra wrote:

eventLoop w cs = do
  drawCells w cs
  e - waitEventBlocking
  checkEvent e
where
  checkEvent (KeyUp (Keysym SDLK_ESCAPE _ _)) = return ()
  checkEvent (KeyUp (Keysym SDLK_n _ _))  = eventLoop w $ 
nextgen cs

  checkEvent _= eventLoop w cs

Your code is a bit strange.  It redraws the window every time there is a 
window event (whether its an unrelated key-down or a relevant event).  
So whenever there's some window events, your window rapidly redraws (and 
in a different set of random colours).  I'm not sure this is the 
intended behaviour?  I didn't find any point at which the program didn't 
advance and redraw when I released 'n' -- but I'm not sure if that was 
exactly the problem you're having.  Can you clarify exactly what the 
problem is?  Is that you're not seeing the keypresses being processed, 
or is it that you expect more redrawing than there is, etc?


Thanks,

Neil.

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


Re: [Haskell-cafe] Accelerate package (CUDA). How to actually create an array?

2011-05-17 Thread briand
On Mon, 16 May 2011 20:33:12 +0400
Grigory Sarnitskiy sargrig...@ya.ru wrote:

 Hello!
 
 I'm probing CUDA with Haskell, accelerate package to be exact. Sound stupid, 
 but I couldn't find how to actually construct an array, for example Vector 
 Float.
 
 There is quite a number of examples provided with the package, but they seem 
 not simple enough for me just to start.
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

Have a fish :-)


import Data.Array.Repa as A
import Data.Array.Repa.Index
import Data.Array.Repa.Shape as AS

newArray :: Int - Array DIM2 Double
newArray n = 
--A.fromList ((AS.shapeOfList [n, n])::(DIM2)) ((Prelude.map fromIntegral 
[1..n*n])::[Double])
A.fromList (AS.shapeOfList [n, n]) (Prelude.map fromIntegral [1..n*n])

main = do
  let x = newArray 5
  let y = newArray 5
  let z = A.zipWith(+) x y
  putStrLn $ show x
  putStrLn $ show y
  putStrLn $ show z

*Main main
[1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,25.0]
[1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,25.0]
[2.0,4.0,6.0,8.0,10.0,12.0,14.0,16.0,18.0,20.0,22.0,24.0,26.0,28.0,30.0,32.0,34.0,36.0,38.0,40.0,42.0,44.0,46.0,48.0,50.0]
*Main 

I can't remember what Prelude.map collided with.

Brian


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


[Haskell-cafe] Options to reduce memory use (Shootout Benchmark)

2011-05-17 Thread Thorsten Hater

Hello,

over the weekend I played a little with the fasta benchmark at the 
shootout site.
I tried to understand the current submission and decided to build my own 
version.
Astonishingly, after some tuning its quite fast (1sec on my machine, 
when the current

entry use ~11sec) but uses quite some memory (~11MB).
Basically you have to use a custom pseudo random number generator to build
strings of randomized DNA by choosing from a given probability distribution.
Is there some way to reduce memory consumption? 11MB seems quite a lot.

Thorsten


{-# LANGUAGE BangPatterns #-}
module Main where

import System.Environment

import qualified Data.ByteString.Lazy as L
import qualified Data.ByteString.Lazy.Char8 as C (pack, take)
import qualified Data.ByteString as S

data P = P !Char !Float
type LUT = [P]

alu =  C.pack GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG\
  \GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA\
  \CCAGCCTGGCCAACATGGTGAAAGTCTCTACTAT\
  \ACATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA\
  \GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG\
  \AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC\
  \AGCCTGGGCGACAGAGCGAGACTCCGTCTCA

iubs, homs :: LUT
iubs = cdf [('a',0.27),('c',0.12),('g',0.12),('t',0.27),('B',0.02)
   ,('D',0.02),('H',0.02),('K',0.02),('M',0.02),('N',0.02)
   ,('R',0.02),('S',0.02),('V',0.02),('W',0.02),('Y',0.02)]

homs = cdf [('a',0.3029549426680),('c',0.1979883004921)
   ,('g',0.1975473066391),('t',0.3015094502008)]

-- compile LUT from assoc list
cdf :: [(Char,Float)] - LUT
cdf ls = reverse $! cdf' [] 0 ls
where cdf' acc _ [] = acc
  cdf' acc c ((v,k):ls) = cdf' ((P v c'):acc) c' ls
  where !c'  = k + c

-- extract Char from List by Key
choose :: LUT - Float - Char
choose lut !f = choose' lut
where choose' ((P v k):ls)| f = k = v
  | otherwise = choose' ls

-- PRNG
im, ia, ic :: Int
im  = 139968
ia  = 3877
ic  = 29573

data R = R !Float !Int

imd :: Float
imd = fromIntegral im

rand :: Int - R
rand seed = R newran newseed
where
newseed = (seed * ia + ic) `rem` im
newran  = (fromIntegral newseed) / imd
-- /PRNG

-- Cache all possible results
cache :: LUT - L.ByteString
cache ls = C.pack $! reverse $! go [v] s
where (R !f !s) = rand 42  -- if we arrive at Seed 42, 
we completed one cycle, STOP

  !v = choose ls f
  go :: String - Int - String
  go acc 42 = acc
  go acc !q  = go (v':acc) s'
  where (R !f' !s') = rand q
!v' = choose ls f'

-- FASTA writer from current entry
fasta n s = do
let (t:ts) = L.toChunks s
go ts t n
  where
 go ss s n
| n == 0 = return ()
| l60  n60 = S.putStrLn l  go ssr (n-60)
|n60 = S.putStr s  S.putStrLn a  go (tail ss) b (n-60)
| n = ln= S.putStrLn (S.take n s)
| otherwise  = S.putStr s  S.putStrLn (S.take (n-ln) (head ss))
where
ln   = S.length s
l60  = ln = 60
n60  = n = 60
(l,r) = S.splitAt 60 s
(a,b) = S.splitAt (60-ln) (head ss)

main = do n - getArgs = readIO . head
  putStrLn  ONE Homo sapiens alu
  fasta (n*2) $! L.cycle alu
  putStrLn TWO IUB ambiguity codes
  fasta (n*3)  (L.cycle $! cache $! iubs)
  putStrLn THREE Homo sapiens frequency
  fasta (n*5) (L.drop  (fromIntegral (n*3) `mod` 139968) $! 
L.cycle $! cache homs)



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


[Haskell-cafe] ANNOUNCE: preview release of diagrams EDSL for declarative drawing

2011-05-17 Thread Brent Yorgey
I am extremely pleased to announce a developer preview release of the
diagrams framework [1] for declarative drawing. This is a
well-thought-out, well-documented, working release with all core
functionality in place, but with many planned features still missing
(for example, support for rendering text and higher-level tools for
constructing curves). If you are interested in

-   trying out a new way of producing vector graphics,

-   providing feedback to help drive ongoing development, or

-   getting involved and contributing some code yourself,

please give it a try! On the other hand, if you are looking for a
complete, full-featured package that will let you jump right into
producing the graphics you need, you may want to wait for the 1.0
release.

If you are familiar with the diagrams package [2] already on Hackage,
this is a complete rewrite which has been in the works for over a year
and a half.

What is it?
---

Diagrams is an embedded domain-specific library (EDSL) for creating
diagrams, illustrations, and other sorts of vector graphics. The overall
vision is for diagrams to become a viable alternative to systems like
MetaPost, Asymptote, and PGF/TikZ.

Diagrams is:

-   Declarative: you specify what a diagram is, not how to draw it.

-   Compositional: diagrams can be combined in many ways to produce more
complex diagrams. Diagrams are scale- and translation-invariant, so
you never have to worry about a global coordinate system, only
local ones.

-   Embedded: the full power of Haskell, including every library on
Hackage, is available to help construct and manipulate diagrams.

-   Extensible: extending diagrams with additional or higher-level
functionality is as simple as writing a Haskell module.

-   Flexible: diagrams is designed from the ground up to be as generic
and flexible as possible. Features include:

-   Pluggable rendering backends -- creating a new rendering backend
is as simple as writing a type class instance.

-   Arbitrary vector spaces -- the core diagrams library data types
and primitives work for any vector space, so given a suitable
rendering backend you can produce diagrams of any dimension, or
even more exotic things...

Cool, how can I try it out?
---

Start by reading the quick tutorial [3], which has detailed information
about how to install the necessary packages and will introduce you to
the fundamentals of the framework.

Or, for the truly impatient:

cabal install diagrams-core diagrams-lib diagrams-cairo

How can I contribute?
-

There are lots of ways you can contribute! First, you may want to
subscribe to the project mailing list [4], and/or come hang out in the
#diagrams IRC channel on freenode.org.

-   Cairo is the only well-supported backend at the moment, but you
might create another backend or contribute to an existing project
[5].

-   The standard library is in need of additional features. Visit the
Google Code site [6] for a list of open tickets.

-   Create a higher-level module built on top of the diagrams framework
(e.g. tree or graph layout, generating Turing machine configuration
diagrams, Penrose tilings ... your imagination is the only limit!)
and submit it for inclusion in a special diagrams-contrib package
which will be created for such higher-level user-contributed
modules.

-   Use diagrams to create some cool graphics and submit them for
inclusion in a gallery of examples (to be created soon).

-   Start your own project built on top of diagrams and let us know how
it goes!

-   Last but certainly not least, just try it out for your pet graphics
generation needs and contribute your bug reports and feature
requests.

Happy diagramming!

Brought to you by the diagrams team:

-   Brent Yorgey
-   Ryan Yates

with contributions from:

-   Sam Griffin
-   Vilhelm Sjöberg
-   Luite Stegeman
-   Kanchalai Suveepattananont
-   Scott Walck

[1] http://code.google.com/p/diagrams/  
[2] http://hackage.haskell.org/package/diagrams  
[3] http://projects.haskell.org/diagrams/tutorial/DiagramsTutorial.html  
[4] http://groups.google.com/group/diagrams-discuss  
[5] http://code.google.com/p/diagrams/wiki/BackendProjects  
[6] http://code.google.com/p/diagrams/

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


[Haskell-cafe] Master Thesis on Haskell

2011-05-17 Thread Burak Ekici

Dear All,

I am planning to write a master thesis project on the monadic programming 
manner of Haskell PL.
What I want to kindly ask you is that if you have enough time and patience 
which can be shared with me, could you please have a quick look at the attached 
outline for the project I intend to write.
Your ideas and comments are valuable for me and I would be very appreciated if 
you share them.

Thanks a lot and best of regards,
Burak Ekici.


  

outline_burak.docx
Description: application/vnd.openxmlformats-officedocument.wordprocessingml.document
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] FW: Master Thesis on Haskell

2011-05-17 Thread Burak Ekici


Dear All,

I am not sure, if the attached files are allowed in the list or not.
Because of this reason, I want to send my outline attached as inline, in any 
case.

Thanks already now and best of regards.
Burak Ekici.

OUTLINE 



Basically, the objective of this project is to use some objects and also
the algebra among them (fuctors, monads, functor algebras , monad algebras),
originating from Category Theory, with the help of Haskell PL to create 
alternative
solution strategies to the problems (failure detection, purity, avoiding
side-effects, ...) existing in Computer Science, particularly, in the context
of functional programming. 

 

1.  
Category Theory - As a mathematical background

·
Categories

·
Functors

·
Natural Transformations

·
Monads

 

2.  
Haskell programming language

·
Basic Classifications of programming languages

·
What is Functional Programming

·
What is Haskell

·
Haskell's Type System (Static and Strong)

o  
Type Signature

o  
Type Variables

o  
Type Classes

o  
Creating new types in Haskell

o  
Definition of Haskell's HASK category (Types are
Objects, Functions between objects are Morphisms)

 

3.  
Functors of Haskell

·
From theory to coding (theory and its
representation in Haskell)

·
 Proofs

o  
Maybe as a functor 

o  
List as a functor

o  
State as a functor 

o  
Continuation as a functor 

o  
Either as a functor

o  
 Reader as
a functor

o  
Writer as a functor 

 

4.  
Monads of Haskell 

·
From theory to coding (theory and its
representation in Haskell)

·
Proofs

o  
Maybe as a monad -- Failure Detection

o  
List as a monad -- Non Determinism

o  
State as a monad -- Providing Purity

o  
Continuation as a monad -- Providing Continuation

o  
Either as a monad -- Exception Detection

o  
Reader as a monad -- Dependency

o  
 Writer as
a monad -- Output

o  
IO as an impure monad with the help of State
monad -- Avoiding Side Effects

·
Examples of monadic programming to show the
advantages of each.

·
Monad Transformers of Haskell

o  
MaybeT

o  
ListT

o  
StateT

o  
Examples

 

5.  
Functor Algebras   

·
Theory

o  
F-Algebras

o  
Initial Algebras

o  
Catamorphisms 

o  
Paramorphisms

·
Haskell Representations (if possible)

 

6.  
Monad Algebras

·
Theory

o  
T-Algebra

·
Haskell Representations (if possible)

 

7.  
Conclusion

 



From: ekcbu...@hotmail.com
To: haskell-cafe@haskell.org
Subject: Master Thesis on Haskell
Date: Tue, 17 May 2011 15:47:19 +








Dear All,

I am planning to write a master thesis project on the monadic programming 
manner of Haskell PL.
What I want to kindly ask you is that if you have enough time and patience 
which can be shared with me, could you please have a quick look at the attached 
outline for the project I intend to write.
Your ideas and comments are valuable for me and I would be very appreciated if 
you share them.

Thanks a lot and best of regards,
Burak Ekici.


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


[Haskell-cafe] I cannot find the module Data.Numbers.Primes

2011-05-17 Thread KC
-- 
--
Regards,
KC

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


Re: [Haskell-cafe] I cannot find the module Data.Numbers.Primes

2011-05-17 Thread Benedict Eastaugh
cabal install primes?

http://hackage.haskell.org/package/primes
https://github.com/sebfisch/primes

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


Re: [Haskell-cafe] ANNOUNCE: preview release of diagrams EDSL for declarative drawing

2011-05-17 Thread Stephen Tetley
Cool.

On 17 May 2011 16:42, Brent Yorgey byor...@seas.upenn.edu wrote:

 -   Create a higher-level module built on top of the diagrams framework
    (e.g. tree or graph layout, generating Turing machine configuration
    diagrams, Penrose tilings ... your imagination is the only limit!)
    and submit it for inclusion in a special diagrams-contrib package
    which will be created for such higher-level user-contributed
    modules.


Wumpus-Tree has a variant of Andrew Kennedy's [1] tree layout
algorithm which you might like to take the code from, unlike the paper
it uses absolute extents rather than relative ones.

The actual tree design code is quite straight forward (the other code
is tangled up with Wumpus administrivia):

http://hackage.haskell.org/packages/archive/wumpus-tree/0.9.0/doc/html/src/Wumpus-Tree-Design.html

[1] Functional Pearl: Drawing Trees
http://research.microsoft.com/en-us/um/people/akenn/fun/DrawingTrees.pdf

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


Re: [Haskell-cafe] ANNOUNCE: preview release of diagrams EDSL for declarative drawing

2011-05-17 Thread Warren Henning
Can we see some examples of the graphics it can produce?

On Tue, May 17, 2011 at 8:42 AM, Brent Yorgey byor...@seas.upenn.edu wrote:
 I am extremely pleased to announce a developer preview release of the
 diagrams framework [1] for declarative drawing. This is a
 well-thought-out, well-documented, working release with all core
 functionality in place, but with many planned features still missing
 (for example, support for rendering text and higher-level tools for
 constructing curves). If you are interested in

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


Re: [Haskell-cafe] I cannot find the module Data.Numbers.Primes

2011-05-17 Thread KC
Is there a way to tell when a function is included in the standard
Haskell Platform or when it needs to be loaded from Hackage?


On Tue, May 17, 2011 at 9:08 AM, Benedict Eastaugh ionf...@gmail.com wrote:
 cabal install primes?

 http://hackage.haskell.org/package/primes
 https://github.com/sebfisch/primes




-- 
--
Regards,
KC

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


Re: [Haskell-cafe] I cannot find the module Data.Numbers.Primes

2011-05-17 Thread Artyom Kazak
Yes, of course there is! You can find the index of all functions, types,  
typeclasses etc. here:


http://lambda.haskell.org/hp-tmp/docs/2011.2.0.0/doc-index.html


KC kc1...@gmail.com писал(а) в своём письме Tue, 17 May 2011 20:33:05  
+0300:



Is there a way to tell when a function is included in the standard
Haskell Platform or when it needs to be loaded from Hackage?


On Tue, May 17, 2011 at 9:08 AM, Benedict Eastaugh ionf...@gmail.com  
wrote:

cabal install primes?

http://hackage.haskell.org/package/primes
https://github.com/sebfisch/primes






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


Re: [Haskell-cafe] ANNOUNCE: preview release of diagrams EDSL for declarative drawing

2011-05-17 Thread Brent Yorgey
An excellent question!  There are a couple examples in my blog post:

  http://byorgey.wordpress.com/2011/05/17/announcing-diagrams-preview-release/

In the next few days I hope to set up a web site with a gallery of
more examples.

-Brent

On Tue, May 17, 2011 at 10:31:29AM -0700, Warren Henning wrote:
 Can we see some examples of the graphics it can produce?
 
 On Tue, May 17, 2011 at 8:42 AM, Brent Yorgey byor...@seas.upenn.edu wrote:
  I am extremely pleased to announce a developer preview release of the
  diagrams framework [1] for declarative drawing. This is a
  well-thought-out, well-documented, working release with all core
  functionality in place, but with many planned features still missing
  (for example, support for rendering text and higher-level tools for
  constructing curves). If you are interested in
 
 ___
 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: iterIO-0.1 - iteratee-based IO with pipe operators

2011-05-17 Thread Alexander Kjeldaas
On 16 May 2011 21:31, dm-list-haskell-c...@scs.stanford.edu wrote:

 At Mon, 16 May 2011 10:56:02 +0100,
 Simon Marlow wrote:
 
  Yes, it's not actually documented as far as I know, and we should fix
  that.  But if you think about it, sequential consistency is really the
  only sensible policy: suppose one processor creates a heap object and
  writes a reference to it in the IORef, then another processor reads the
  IORef.  The writes that created the heap object must be visible to the
  second processor, otherwise it will encounter uninitialised memory and
  crash.  So sequential consistency is necessary to ensure concurrent
  programs can't crash.
 
  Now perhaps it's possible to have a relaxed memory model that provides
  the no-crashes guarantee but still allows IORef writes to be reordered
  (e.g. some kind of causal consistency).  That might be important if
  there is some processor arcitecture that provides that memory model, but
  as far as I know there isn't.

 Actually, in your heap object example, it sounds like you only really
 care about preserving program order, rather than write atomicity.
 Thus, you can get away with less-than-sequential consistency and not
 crash.

 The x86 is an example of a relaxed memory model that provides the
 no-crashes guarantee you are talking about.  Specifically, the x86
 deviates from sequential consistency in two ways

  1. A load can finish before an earlier store to a different memory
 location.  [intel, Sec. 8.2.3.4]

  2. A thread can read its own writes early. [intel, 8.2.3.5]

  [Section references are to the intel architecture manual, vol 3a:
   http://www.intel.com/Assets/PDF/manual/253668.pdf]

 One could imagine an implementation of IORefs that relies on the fact
 that pointer writes are atomic and that program order is preserved to
 avoid mutex overhead for most calls.  E.g.:

  struct IORef {
spinlock_t lock; /* Only ever used by atomicModifyIORef */
HaskellValue *val;   /* Updated atomically because pointer-sized
writes are atomic */
  };

  HaskellValue *
  readIORef (struct IORef *ref)
  {
return ref-val;
  }

  void
  writeIORef (struct IORef *ref, HaskellValue *val)
  {
/* Note that if *val was initialized in the same thread, then by
 * the time another CPU sees ref-val, it will also see the
 * correct contents of *ref-val, because stores are seen in a
 * consistent order by other processors [intel, Sec. 8.2.3.7].
 *
 * If *val was initialized in a different thread, then since this
 * thread has seen it, other threads will too, because x86
 * guarantees stores are transitively visible [intel, Sec. 8.2.3.6].
 */
ref-val = val;
  }

  /* modifyIORef is built out of readIORef and writeIORef */

  HaskellValue *
  atomicModifyIORef (Struct IORef *ref, HaskellFunction *f)
  {
HaskellValue *result;
spinlock_acquire (ref-lock);

result = modifyIORef (ref, f);

spinlock_release (ref-lock);
return result;
  }

 This is actually how I assumed IORefs worked.  But then consider the
 following program:

  maybePrint :: IORef Bool - IORef Bool - IO ()
  maybePrint myRef yourRef = do
writeIORef myRef True
yourVal - readIORef yourRef
unless yourVal $ putStrLn critical section

  main :: IO ()
  main = do
r1 - newIORef False
r2 - newIORef False
forkOS $ maybePrint r1 r2
forkOS $ maybePrint r2 r1
threadDelay 100

 Under sequential consistency, the string critical section should be
 output at most once.  However, with the above IORef implementation on
 x86, since a read can finish before a write to a different location,
 both threads might see False for the value of yourVal.

 To prevent this deviation from sequential consistency, you would need
 to do something like stick an MFENCE instruction at the end of
 writeIORef, and that would slow down the common case where you don't
 care about sequential consistency.  In fact, I would argue that if you
 care about S.C., you should either be using atomicModifyIORef or
 MVars.


mfence is apparently slower than lock add.  see
http://blogs.oracle.com/dave/entry/instruction_selection_for_volatile_fences
so using mfence would make it slower than atomicModifyIORef, and with weaker
guarantees.  not a good combination.

Alexander


 Can you explain what actually happens inside the real IORef
 implementation?

 As an aside, these days one sees a lot of hand-wringing over the fact
 that CPU clock rates have been flat for a while and the only way to
 get more performance is through parallelism.  How are we going to
 teach programmers to write concurrent code when it's so hard to write
 and debug? I've heard numerous people ask.

 Haskell could be a major step in the right direction, since in the
 absence of variables, it's impossible to have data races.  (You can
 still have deadlock and other kinds of race condition, such as the one
 in maybePrint above, if you had my definition of 

Re: [Haskell-cafe] fishing for ST mutable Vector examples

2011-05-17 Thread Yves Parès
Hello all,

By the way, is there any reason to prefer package 'vector' over package
'array'? Do they just provide different interfaces to similar
functionnalities or are there real performance stakes?
I personnaly prefer Data.Array, since:
- It gives the possibility to index with something else than integers
(thanks to Ix class)
- It provides Foldable/Traversable instances (better abstraction, so)


2011/4/22 Daniel Fischer daniel.is.fisc...@googlemail.com

 On Friday 22 April 2011 20:14:38, Stephen Tetley wrote:
  Hi Brad
 
  I think all you can do with an ST array is covered by the MArray class
  and its derived operations - note the class is exported opaquely from
  Data.Array.MArray - it has these two members that aren't exported so
  aren't documented:
 
 
  unsafeRead  :: Ix i = a i e - Int - m e
  unsafeWrite :: Ix i = a i e - Int - e - m ()

 Those are available from Data.Array.Base. I use them a lot, because there's
 no point in letting the runtime check array bounds after I just did to
 determine whether the loop is finished.

 
  To actually read and write you have to use the safe derived operations
  which wrap the unsafe versions:
 
  readArray :: (MArray a e m, Ix i) = a i e - i - m e
  writeArray :: (MArray a e m, Ix i) = a i e - i - e - m ()
 
  For practical purposes I've found STArray's a bit of a white elephant

 I on the other hand use 'STUArray's very much. When you fill an array with
 an algorithm which works best with mutation (a sieve for example) and
 afterwards use it only for querying, runSTUArray (or runSTArray) is a great
 friend. ST guarantees that no other thread can mess with your array while
 you build it, when you're done it's immutable. IO doesn't give you these
 guarantees, you have to ascertain yourself that no other thread can mutate
 your array.

 It's the same for 'Vector's, ST's phantom type parameter isolates you from
 the outside world, with IOVectors, you have to do the protection yourself.
 I think vector doesn't provide an analogue to runST(U)Array, but if you
 need it, you can write

 runST (do
   vec - stuff
   frz - unsafeFreeze vec
   return frz

 yourself.

  - I always use IOArray instead, as I've either needed to initially
  read an array from file or write one to file at the end.

 On the other hand, if you're doing IO, an IOArray is a fairly natural
 choice.

 ___
 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] opening windows on a mac via ghci?

2011-05-17 Thread Conal Elliott
Has anyone figured out a way to get libraries that open windows to work with
ghci? With libraries like glut I get the body of a window, but no frame, and
the process wedges. I guess the problem has to do with lack of .app bundle.
If so, perhaps a work-around might involve running ghci in an app
bundle--though I'm just speculating from vast ignorance.

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


[Haskell-cafe] Status of Haskell + Mac + GUIs graphics

2011-05-17 Thread Conal Elliott
I still haven't found any way to do GUIs or interactive graphics in Haskell
on a Mac that isn't plagued one or more of the following serious problems:

* Incompatible with ghci, e.g., fails to make a window frame or kills the
process the second time one opens a top-level window,
* Goes through the X server, and so doesn't look or act like a Mac app,
* Doesn't support OpenGL.

A year or two ago, I put my Haskell GUI  graphics work on hold while
waiting  hoping for a functioning pathway to open. So far I haven't heard
of one.

If anyone has found a solution, I'd love to hear!

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


Re: [Haskell-cafe] fishing for ST mutable Vector examples

2011-05-17 Thread Don Stewart
Yes, the differences between

 * vector
 * array
 * repa

were discussed this week on Stack Overflow:

 
http://stackoverflow.com/questions/6006304/what-haskell-representation-is-recommended-for-2d-unboxed-pixel-arrays-with-mill

The reason to prefer vectors of arrays are:

 * flexible interface
 * generic interface
 * growable
 * fusible operations.

They do not support multi-dimension indexing though. For that, there
is repa, which has a rich interface, supports fusion and slicing, and
is automagically parallel.   However, repa arrays are not mutable. So
if you need multidimensional mutable arrays, either the regular array
package, or hmatrix.

On Tue, May 17, 2011 at 4:15 PM, Yves Parès limestr...@gmail.com wrote:
 Hello all,

 By the way, is there any reason to prefer package 'vector' over package
 'array'? Do they just provide different interfaces to similar
 functionnalities or are there real performance stakes?
 I personnaly prefer Data.Array, since:
 - It gives the possibility to index with something else than integers
 (thanks to Ix class)
 - It provides Foldable/Traversable instances (better abstraction, so)


 2011/4/22 Daniel Fischer daniel.is.fisc...@googlemail.com

 On Friday 22 April 2011 20:14:38, Stephen Tetley wrote:
  Hi Brad
 
  I think all you can do with an ST array is covered by the MArray class
  and its derived operations - note the class is exported opaquely from
  Data.Array.MArray - it has these two members that aren't exported so
  aren't documented:
 
 
  unsafeRead  :: Ix i = a i e - Int - m e
  unsafeWrite :: Ix i = a i e - Int - e - m ()

 Those are available from Data.Array.Base. I use them a lot, because
 there's
 no point in letting the runtime check array bounds after I just did to
 determine whether the loop is finished.

 
  To actually read and write you have to use the safe derived operations
  which wrap the unsafe versions:
 
  readArray :: (MArray a e m, Ix i) = a i e - i - m e
  writeArray :: (MArray a e m, Ix i) = a i e - i - e - m ()
 
  For practical purposes I've found STArray's a bit of a white elephant

 I on the other hand use 'STUArray's very much. When you fill an array with
 an algorithm which works best with mutation (a sieve for example) and
 afterwards use it only for querying, runSTUArray (or runSTArray) is a
 great
 friend. ST guarantees that no other thread can mess with your array while
 you build it, when you're done it's immutable. IO doesn't give you these
 guarantees, you have to ascertain yourself that no other thread can mutate
 your array.

 It's the same for 'Vector's, ST's phantom type parameter isolates you from
 the outside world, with IOVectors, you have to do the protection yourself.
 I think vector doesn't provide an analogue to runST(U)Array, but if you
 need it, you can write

 runST (do
   vec - stuff
   frz - unsafeFreeze vec
   return frz

 yourself.

  - I always use IOArray instead, as I've either needed to initially
  read an array from file or write one to file at the end.

 On the other hand, if you're doing IO, an IOArray is a fairly natural
 choice.

 ___
 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


Re: [Haskell-cafe] opening windows on a mac via ghci?

2011-05-17 Thread Jason Dagit
On Tue, May 17, 2011 at 4:17 PM, Conal Elliott co...@conal.net wrote:
 Has anyone figured out a way to get libraries that open windows to work with
 ghci? With libraries like glut I get the body of a window, but no frame, and
 the process wedges. I guess the problem has to do with lack of .app bundle.
 If so, perhaps a work-around might involve running ghci in an app
 bundle--though I'm just speculating from vast ignorance.

Conal, I would recommend not using GLUT.  I wrote an article about
picking a GUI library to use with OpenGL:
http://blog.codersbase.com/2011/03/picking-gui-library-to-use-with-opengl.html

My advice is to use GLFW-b.  There are a few mac specific bugs with
using that library right now but they are fixable, and I know the
author accepts patches because I've sent several myself:
https://github.com/bsl/GLFW-b/issues

The issues with the app bundle has to do with the way the resources
are located by OSX.  Anything I say beyond that is just speculation on
my part as I haven't studied the documentation in detail yet.

I hope that helps,
Jason

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


Re: [Haskell-cafe] fishing for ST mutable Vector examples

2011-05-17 Thread Felipe Almeida Lessa
On Tue, May 17, 2011 at 8:30 PM, Don Stewart don...@gmail.com wrote:
  * vector
  * array
  * repa

Don, do you think that repa is as recommended as vector for
production applications?  I'm asking so because it is my understanding
that accelerate still isn't mature enough to be used in production
code, but I'm told vector is =).

Cheers, =D

-- 
Felipe.

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


Re: [Haskell-cafe] fishing for ST mutable Vector examples

2011-05-17 Thread Don Stewart
Well, repa doesn't have a GPU backend. So if you need GPU stuff, you
probably do need to look at accelerate.
I think Repa is in beta now, the API might change a little (e.g.
we're discussing making the stuff under the hood Storable class
friendly). It also only has a small number of users, while vector has
thousands.

So, it depends on how much you like new code. There are probably still
bugs in Repa, and API changes ahead, however, it is more stable than
accelerate, which is a whole different beast. If you need
multi-dimensional, *mutable* arrays, hmatrix or the array package are
very stable, just not as much fun.

-- Don

On Tue, May 17, 2011 at 5:31 PM, Felipe Almeida Lessa
felipe.le...@gmail.com wrote:
 On Tue, May 17, 2011 at 8:30 PM, Don Stewart don...@gmail.com wrote:
  * vector
  * array
  * repa

 Don, do you think that repa is as recommended as vector for
 production applications?  I'm asking so because it is my understanding
 that accelerate still isn't mature enough to be used in production
 code, but I'm told vector is =).

 Cheers, =D

 --
 Felipe.


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


Re: [Haskell-cafe] Open CV or alternate image processing library for Haskell on windows?

2011-05-17 Thread Gregory Guthrie
Yes, I understand that - but if there is some install or usage dependency, or 
install procedure, I would hope to see it documented somewhere; perhaps I 
missed that?

The end result is that from the project page and install, it fails.  :-)

Earlier in the thread I noted that this was a Windows (w7 enterprise) system.
(I have first installed the standard Opencv distribution which should provide 
the cv libraries, but that did not help.)

The HOpenCv package page at hackage only describes Linux installation.
---
 -Original Message-
 From: Antoine Latter [mailto:aslat...@gmail.com]
 The error isn't referring to a Haskell package - it is saying that it cannot 
 find the libraries
 installed on your computer.
 
 Note the line Missing C libraries: cv, highgui, cv, highgui. These are not 
 referring to Haskell
 packages - they are referring to libcv and libhighgui, whatever those are.
 
 What sort of computer are you using?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] why doesn't ghc give you a type signature that works ?

2011-05-17 Thread briand
for example:

I will ask the glorious compiler, and it says:

*Main :t calcFFT
calcFFT
  :: (Math.FFT.Base.FFTWReal r) =
 V.Vector (Complex r) - V.Vector (Complex r)

I then put the signature in my code, reload it, and:

  Not in scope: type constructor or class `Math.FFT.Base.FFTWReal'


It seems very strange to me that the fully qualified module name doesn't work, 
nor does any combination thereof, e.g. FFT.FFTWReal, FFT.Base.FFTWReal, etc...

I'm importing FFT as:

  import qualified Math.FFT as FFT

I'm not sure if that causes the problem.

Generally speaking this happens to me quite a lot, and I've never tried to 
understand what's going on, because the signature is not required.  I've 
decided to try now :-)

Obviously I'll need some help.

Thanks,

Brian

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


Re: [Haskell-cafe] why doesn't ghc give you a type signature that works ?

2011-05-17 Thread Ivan Lazar Miljenovic
On 18 May 2011 13:44,  bri...@aracnet.com wrote:
 for example:

 I will ask the glorious compiler, and it says:

 *Main :t calcFFT
 calcFFT
  :: (Math.FFT.Base.FFTWReal r) =
     V.Vector (Complex r) - V.Vector (Complex r)

 I then put the signature in my code, reload it, and:

  Not in scope: type constructor or class `Math.FFT.Base.FFTWReal'


 It seems very strange to me that the fully qualified module name doesn't 
 work, nor does any combination thereof, e.g. FFT.FFTWReal, FFT.Base.FFTWReal, 
 etc...

 I'm importing FFT as:

  import qualified Math.FFT as FFT

What's happening is that the type involves the FFTWReal class.
However, this isn't immediately visible to ghci as it isn't in scope,
but it can figure out that it's found in Math.FFT.Base.  As such, you
need to import that module as well (as opposed to just the Math.FFT
class you have already imported).

-- 
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] why doesn't ghc give you a type signature that works ?

2011-05-17 Thread KC
If you're importing the module as

import qualified Math.FFT as FFT

Shouldn't Math.FFT become FFT?  :)


On Tue, May 17, 2011 at 8:44 PM,  bri...@aracnet.com wrote:
 for example:

 I will ask the glorious compiler, and it says:

 *Main :t calcFFT
 calcFFT
  :: (Math.FFT.Base.FFTWReal r) =
     V.Vector (Complex r) - V.Vector (Complex r)

 I then put the signature in my code, reload it, and:

  Not in scope: type constructor or class `Math.FFT.Base.FFTWReal'


 It seems very strange to me that the fully qualified module name doesn't 
 work, nor does any combination thereof, e.g. FFT.FFTWReal, FFT.Base.FFTWReal, 
 etc...

 I'm importing FFT as:

  import qualified Math.FFT as FFT

 I'm not sure if that causes the problem.

 Generally speaking this happens to me quite a lot, and I've never tried to 
 understand what's going on, because the signature is not required.  I've 
 decided to try now :-)

 Obviously I'll need some help.

 Thanks,

 Brian

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




-- 
--
Regards,
KC

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


Re: [Haskell-cafe] No fish, please

2011-05-17 Thread John Millikin
Is there any way to indicate to Hackage that it should not try to generate 
Haddock documentation? I'm concerned for two use cases for packages using a 
different docs system:

1) A user might see the commentless auto-generated haddock and believe the 
package is undocumented.
2) A user might find the haddock through Google, and not realize there's 
real documentation available elsewhere.

Purposfully causing Hackage's haddock step to fail will mark the package as 
a build failure, which gives a bad impression to potential users.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] No fish, please

2011-05-17 Thread Don Stewart
I'm intrigued by  the idea of Hackage docs that don't use Haddock.

IF you do have better docs, host them somewhere, and put a link
prominently in the .cabal file synopsis.

On Tue, May 17, 2011 at 9:25 PM, John Millikin jmilli...@gmail.com wrote:
 Is there any way to indicate to Hackage that it should not try to generate
 Haddock documentation? I'm concerned for two use cases for packages using a
 different docs system:

 1) A user might see the commentless auto-generated haddock and believe the
 package is undocumented.
 2) A user might find the haddock through Google, and not realize there's
 real documentation available elsewhere.

 Purposfully causing Hackage's haddock step to fail will mark the package as
 a build failure, which gives a bad impression to potential users.

 ___
 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] Open CV or alternate image processing library for Haskell on windows?

2011-05-17 Thread Ville Tirronen
Hi,

Yes, I understand that - but if there is some install or usage dependency,
 or install procedure, I would hope to see it documented somewhere; perhaps I
 missed that?



The only installation procedure I can document is how to do this in linux.
My guess is that it must be similar with windows.

1. Get the opencv library from opencv.willowgarage.com
2. Install it and make a note where it installs
3. cabal install CV. If this fails with missing C libraries, then,
(4). cabal install CV --with-extra-lib-dirs=where_the_opencv_libs_are
--with-extra-include-dirs=where_the_opencv_includes_are

However, wait few hours so I can push a new version to hackage. There are
few things I've already discovered that fail to work with other people and I
think I can fix them.

Disclaimer:
The CV package is something I threw together, originally in pre-cabal times.
Back then I arguably wasn't a very good haskell-programmer and the whole
thing was under an nda. Since then I've casually evolved the library to suit
my needs. After I saw CV-combinators library released I made a petition to
publish my codes in hopes that it would help other people doing similar
things.

In short, although CV package is very very useful for me, it is not a
perfect binding, and the implementation isn't really smart at places. I
would like to make it great, however.



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


Re: [Haskell-cafe] why doesn't ghc give you a type signature that works ?

2011-05-17 Thread wren ng thornton

On 5/17/11 11:53 PM, KC wrote:

If you're importing the module as

import qualified Math.FFT as FFT

Shouldn't Math.FFT become FFT?  :)


Nope.

Depending on your definition of should at least. Hierarchical modules 
are not considered entities exported by modules further up on the tree. 
So that's not the specified behavior of qualified imports. (Whether it 
should be is a separate debate.)




On Tue, May 17, 2011 at 8:44 PM,bri...@aracnet.com  wrote:

for example:

I will ask the glorious compiler, and it says:

*Main  :t calcFFT
calcFFT
  :: (Math.FFT.Base.FFTWReal r) =
 V.Vector (Complex r) -  V.Vector (Complex r)

I then put the signature in my code, reload it, and:

  Not in scope: type constructor or class `Math.FFT.Base.FFTWReal'


You can have functions in scope whose types include types which are not 
themselves in scope. In these situations, GHC/GHCi is smart enough to 
know where those types live, so it tells you; but since they're not in 
the current namespace you have no way of referring to them yourself.


The solution is just to import Math.FFT.Base (or any other module that 
re-exports FFTWReal).


--
Live well,
~wren

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


[Haskell-cafe] Is fusion overrated?

2011-05-17 Thread Roman Cheplyaka
If one thinks about Haskell data structures as of ordinary data
structures, fusion seems a great deal -- instead of producing
intermediate lists and possibly running out of memory, we just run a
loop and use constant amount of space.

But Haskell data structures are quite different -- they are produced as
demanded. Consider the example from the Stream Fusion paper[1]:

f :: Int → Int
f n = sum [ k ∗ m | k ← [1..n], m ← [1..k ] ]

Assuming the sum is a strict left fold, it consumes elements of lists
one-by-one and runs in constant space.

The list part can be transformed to

foldr (++) [] $ map (\k - map (\m - k*m) [1..k]) [1..n]

which is capable of producing elements one-by-one. So the whole thing
probably should run in constant space as well.

Of course I don't claim that fusion is useless -- just trying to
understand the problem it solves. Are we saving a few closures and cons
cells here?

[1] Stream Fusion. From Lists to Streams to Nothing at All.
Duncan Coutts, Roman Leshchinskiy, Don Stewart.

-- 
Roman I. Cheplyaka :: http://ro-che.info/
Don't worry what people think, they don't do it very often.

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