Re: [Haskell-cafe] Haskell Platform's libstdc++-6.dll may be interfering with other applications

2013-05-13 Thread Henk-Jan van Tuyl
On Tue, 07 May 2013 20:27:06 +0200, Andrew Pennebaker  
andrew.penneba...@gmail.com wrote:



I use a number of different programming languages, so I have Haskell
Platform, Strawberry Perl, Node.js, RVM, and Git Bash installed at the  
same

time.

I've noticed that compiling packages with C dependencies (e.g. using
node-gyp during npm install node-mhash, or doing cpan install
PAR::Packer) often crashes during the build process with a popup:

The procedure entry point __gxx_personality_sj0 could not be located in  
the

dynamic link library libstdc++-6.dll.

As Roderich Schupp points
outhttps://rt.cpan.org/Public/Bug/Display.html?id=84949,
it appears that the different libstdc++-6.dll's are interfering with one
another. Haskell Platform comes with one, Vagrant comes with one, GIMP
comes with one, MinGW comes with one, and Strawberry Perl comes with two!
Objdump seems to indicate that Haskell Platform's DLL is the one to  
blame.

:
:
Would updating Haskell Platform's libstdc++-6.dll fix this issue? Is  
there
some way to cordon Haskell Platform off from the rest of the system,  
while

still making ghc.exe and friends available on PATH?

:

I think there will always be discrepancies between different versions of  
DLLs; one way to solve this, is to put the Haskell compiler directory at  
the beginning of the search path when you are compiling with it. When you  
decide that you are satisfied with your executable, put the  
libstdc++-6.dll in the executables directory, as this directory is  
searched first for DLLs, when running the executable.


Regards,
Henk-Jan van Tuyl


--
Folding@home
What if you could share your unused computer power to help find a cure? In  
just 5 minutes you can join  the world's biggest networked computer and  
get us closer sooner. Watch the video.

http://folding.stanford.edu/


http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
Haskell programming
--

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


[Haskell-cafe] ANN haskdogs-0.3.2

2013-05-13 Thread Sergey Mironov
Hi. I'm pleased to announce haskdogs-0.3.2, a source navigation helper.

Haskdogs is a small HSH-based tool which calls hasktags to create tag file for
entire haskell project. It takes into account first-level dependencies by
recursively scanning imports and adding matching packages to the final tag list.

As a result, programmer can use her text editor supporting tags (vim, for
example) to jump directly to definition of any function she uses.

Note that haskdogs call Unix shell commands like 'test' or 'mkdir' so this tool
will likely fail to work on pure Windows platforms. In return, haskdogs is
pretty small - only 125 lines long.

Changes:

* Generate extended tag file by default (hasktags -c -x)
* Add -d command line option which allows user to specify additional source
  directories
* Fix no-sources bug

Github: https://github.com/ierton/haskdogs
See also Vim-hint at https://github.com/ierton/haskdogs#vim-hint

Install:

cabal install hasktags haskdogs

Usage:

haskdogs [-d (FILE|'-')] [FLAGS]
FLAGS will be passed to hasktags as-is followed by
a list of files. Defaults to -c -x.


Basically, just run haskdogs in your Haskell project directory

Thanks to yihuang for the contributions!

Sergey

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


Re: [Haskell-cafe] Set monad

2013-05-13 Thread Petr Pudlák

On 04/12/2013 12:49 PM, o...@okmij.org wrote:

One problem with such monad implementations is efficiency. Let's define

 step :: (MonadPlus m) =  Int -  m Int
 step i = choose [i, i + 1]

 -- repeated application of step on 0:
 stepN :: (Monad m) =  Int -  m (S.Set Int)
 stepN = runSet . f
   where
 f 0 = return 0
 f n = f (n-1)= step

Then `stepN`'s time complexity is exponential in its argument. This is
because `ContT` reorders the chain of computations to right-associative,
which is correct, but changes the time complexity in this unfortunate way.
If we used Set directly, constructing a left-associative chain, it produces
the result immediately:

The example is excellent. And yet, the efficient genuine Set monad is
possible.

BTW, a simpler example to see the problem with the original CPS monad is to
repeat
 choose [1,1]  choose [1,1]choose [1,1]  return 1

and observe exponential behavior. But your example is much more
subtle.

Enclosed is the efficient genuine Set monad. I wrote it in direct
style (it seems to be faster, anyway). The key is to use the optimized
choose function when we can.

{-# LANGUAGE GADTs, TypeSynonymInstances, FlexibleInstances #-}

module SetMonadOpt where

import qualified Data.Set as S
import Control.Monad

data SetMonad a where
 SMOrd :: Ord a =  S.Set a -  SetMonad a
 SMAny :: [a] -  SetMonad a

instance Monad SetMonad where
 return x = SMAny [x]

 m= f = collect . map f $ toList m

toList :: SetMonad a -  [a]
toList (SMOrd x) = S.toList x
toList (SMAny x) = x

collect :: [SetMonad a] -  SetMonad a
collect []  = SMAny []
collect [x] = x
collect ((SMOrd x):t) = case collect t of
  SMOrd y -  SMOrd (S.union x y)
  SMAny y -  SMOrd (S.union x (S.fromList y))
collect ((SMAny x):t) = case collect t of
  SMOrd y -  SMOrd (S.union y (S.fromList x))
  SMAny y -  SMAny (x ++ y)

runSet :: Ord a =  SetMonad a -  S.Set a
runSet (SMOrd x) = x
runSet (SMAny x) = S.fromList x

instance MonadPlus SetMonad where
 mzero = SMAny []
 mplus (SMAny x) (SMAny y) = SMAny (x ++ y)
 mplus (SMAny x) (SMOrd y) = SMOrd (S.union y (S.fromList x))
 mplus (SMOrd x) (SMAny y) = SMOrd (S.union x (S.fromList y))
 mplus (SMOrd x) (SMOrd y) = SMOrd (S.union x y)

choose :: MonadPlus m =  [a] -  m a
choose = msum . map return


test1 = runSet (do
   n1- choose [1..5]
   n2- choose [1..5]
   let n = n1 + n2
   guard $ n  7
   return n)
-- fromList [2,3,4,5,6]

-- Values to choose from might be higher-order or actions
test1' = runSet (do
   n1- choose . map return $ [1..5]
   n2- choose . map return $ [1..5]
   n- liftM2 (+) n1 n2
   guard $ n  7
   return n)
-- fromList [2,3,4,5,6]

test2 = runSet (do
   i- choose [1..10]
   j- choose [1..10]
   k- choose [1..10]
   guard $ i*i + j*j == k * k
   return (i,j,k))
-- fromList [(3,4,5),(4,3,5),(6,8,10),(8,6,10)]

test3 = runSet (do
   i- choose [1..10]
   j- choose [1..10]
   k- choose [1..10]
   guard $ i*i + j*j == k * k
   return k)
-- fromList [5,10]

-- Test by Petr Pudlak

-- First, general, unoptimal case
step :: (MonadPlus m) =  Int -  m Int
step i = choose [i, i + 1]

-- repeated application of step on 0:
stepN :: Int -  S.Set Int
stepN = runSet . f
   where
   f 0 = return 0
   f n = f (n-1)= step

-- it works, but clearly exponential
{-
*SetMonad  stepN 14
fromList [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]
(0.09 secs, 31465384 bytes)
*SetMonad  stepN 15
fromList [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
(0.18 secs, 62421208 bytes)
*SetMonad  stepN 16
fromList [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
(0.35 secs, 124876704 bytes)
-}

-- And now the optimization
chooseOrd :: Ord a =  [a] -  SetMonad a
chooseOrd x = SMOrd (S.fromList x)

stepOpt :: Int -  SetMonad Int
stepOpt i = chooseOrd [i, i + 1]

-- repeated application of step on 0:
stepNOpt :: Int -  S.Set Int
stepNOpt = runSet . f
   where
   f 0 = return 0
   f n = f (n-1)= stepOpt

{-
stepNOpt 14
fromList [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]
(0.00 secs, 515792 bytes)
stepNOpt 15
fromList [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
(0.00 secs, 515680 bytes)
stepNOpt 16
fromList [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]
(0.00 secs, 515656 bytes)

stepNOpt 30
fromList 
[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]
(0.00 secs, 1068856 bytes)
-}


Oleg, thanks a lot for this example, and sorry for my late reply. I 
really like the idea and I'm hoping to a similar concept soon for a 
monad representing probability computations.


  With best regards,
  Petr

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


[Haskell-cafe] Parallel ghc --make

2013-05-13 Thread Niklas Hambüchen
I know this has been talked about before and also a bit in the recent
GSoC discussion.

I would like to know what prevents ghc --make from working in parallel,
who worked at that in the past, what their findings were and a general
estimation of the difficulty of the problem.

Afterwards, I would update
http://hackage.haskell.org/trac/ghc/ticket/910 with a short summary of
what the current situation is.

Thanks to those who know more!

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


[Haskell-cafe] Release Candidates for Haskell Platform 2013.2

2013-05-13 Thread Mark Lentczner
*Some of the release candidates for Haskell Platform 2013.2 are up.*
*These are what I expect to simply re-brand as the release, unless anyone
uncovers some issues.*
*If you decide to test these out, please let me know how it goes.*
*
*
The Mac OS X RC2 installers:

*32bit: *Haskell Platform 2013.2.0.0 32bit
rc2.signed.pkghttp://www.ozonehouse.com/mark/platform/Haskell%20Platform%202013.2.0.0%2032bit%20rc2.signed.pkg
*64bit: *Haskell Platform 2013.2.0.0 64bit
rc2.signed.pkghttp://www.ozonehouse.com/mark/platform/Haskell%20Platform%202013.2.0.0%2064bit%20rc2.signed.pkg

The source tarball (RC1):

haskell-platform-2013.2.0.0-rc1.tar.gzhttp://www.ozonehouse.com/mark/platform/haskell-platform-2013.2.0.0-rc1.tar.gz


*Notable new things in Haskell Platform 2013.2:*

   - GHC 7.6.3
   - Major update to *OpenGL*  *GLUT*
   - New packages:
  - *attoparsec*
  - *case-insensitive*
  - *hashable*
  - *unordered-containers*

— Mark mad releaser Lentczner
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Release Candidates for Haskell Platform 2013.2

2013-05-13 Thread Alfredo Di Napoli
That's awesome :)
I'm just curious to dig deeper inside the updates to OpenGL and GLUT, any
link or change notes I can read?

Thanks,
A.


On 13 May 2013 15:39, Mark Lentczner mark.lentcz...@gmail.com wrote:

 *Some of the release candidates for Haskell Platform 2013.2 are up.*
 *These are what I expect to simply re-brand as the release, unless
 anyone uncovers some issues.*
 *If you decide to test these out, please let me know how it goes.*
 *
 *
 The Mac OS X RC2 installers:

 *32bit: *Haskell Platform 2013.2.0.0 32bit 
 rc2.signed.pkghttp://www.ozonehouse.com/mark/platform/Haskell%20Platform%202013.2.0.0%2032bit%20rc2.signed.pkg
 *64bit: *Haskell Platform 2013.2.0.0 64bit 
 rc2.signed.pkghttp://www.ozonehouse.com/mark/platform/Haskell%20Platform%202013.2.0.0%2064bit%20rc2.signed.pkg

 The source tarball (RC1):

 haskell-platform-2013.2.0.0-rc1.tar.gzhttp://www.ozonehouse.com/mark/platform/haskell-platform-2013.2.0.0-rc1.tar.gz


 *Notable new things in Haskell Platform 2013.2:*

- GHC 7.6.3
- Major update to *OpenGL*  *GLUT*
- New packages:
   - *attoparsec*
   - *case-insensitive*
   - *hashable*
   - *unordered-containers*

 — Mark mad releaser Lentczner


 ___
 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] Release Candidates for Haskell Platform 2013.2

2013-05-13 Thread harry
Mark Lentczner mark.lentczner at gmail.com writes:

 Some of the release candidates for Haskell Platform 2013.2 are up.These
are what I expect to simply re-brand as the release, unless anyone
uncovers some issues.

Will they go on
http://trac.haskell.org/haskell-platform/wiki/ReleaseCandidates?
(http://trac.haskell.org/haskell-platform/ has a few outdated links. Does
anyone know what the current links are for the documentation sections?)


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


Re: [Haskell-cafe] Parallel ghc --make

2013-05-13 Thread Evan Laforge
I wrote a ghc-server that starts a persistent process for each cpu.
Then a 'ghc' frontend wrapper sticks each job in a queue.  It seemed
to be working, but timing tests didn't reveal any speed-up.  Then I
got a faster computer and lost motivation.  I didn't investigate very
deeply why it didn't speed up as I hoped.  It's possible the approach
is still valid, but I made some mistake in the implementation.

So I can stop writing this little blurb I put it on github:

https://github.com/elaforge/ghc-server

On Mon, May 13, 2013 at 8:40 PM, Niklas Hambüchen m...@nh2.me wrote:
 I know this has been talked about before and also a bit in the recent
 GSoC discussion.

 I would like to know what prevents ghc --make from working in parallel,
 who worked at that in the past, what their findings were and a general
 estimation of the difficulty of the problem.

 Afterwards, I would update
 http://hackage.haskell.org/trac/ghc/ticket/910 with a short summary of
 what the current situation is.

 Thanks to those who know more!

 ___
 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] Release Candidates for Haskell Platform 2013.2

2013-05-13 Thread Mark Lentczner
OpenGL and GLUT were very down-rev for quite a number or HP releases. The
recent changes are:

   - OpenGL http://hackage.haskell.org/package/OpenGL *2.2.3.1* ⟶ *2.8.0.0
   *
   - GLUT http://hackage.haskell.org/package/GLUT *2.1.2.1* ⟶ *2.4.0.0*

I know that this involved a fair bit of juggling and there are two new
modules OpenGLRaw and GLURaw.

Perhaps Jason D. can fill us in on the highlights?



On Mon, May 13, 2013 at 7:58 AM, Alfredo Di Napoli 
alfredo.dinap...@gmail.com wrote:

 That's awesome :)
 I'm just curious to dig deeper inside the updates to OpenGL and GLUT, any
 link or change notes I can read?

 Thanks,
 A.


 On 13 May 2013 15:39, Mark Lentczner mark.lentcz...@gmail.com wrote:

 *Some of the release candidates for Haskell Platform 2013.2 are up.*
 *These are what I expect to simply re-brand as the release, unless
 anyone uncovers some issues.*
  *If you decide to test these out, please let me know how it goes.*
 *
 *
 The Mac OS X RC2 installers:

 *32bit: *Haskell Platform 2013.2.0.0 32bit 
 rc2.signed.pkghttp://www.ozonehouse.com/mark/platform/Haskell%20Platform%202013.2.0.0%2032bit%20rc2.signed.pkg
 *64bit: *Haskell Platform 2013.2.0.0 64bit 
 rc2.signed.pkghttp://www.ozonehouse.com/mark/platform/Haskell%20Platform%202013.2.0.0%2064bit%20rc2.signed.pkg

 The source tarball (RC1):

 haskell-platform-2013.2.0.0-rc1.tar.gzhttp://www.ozonehouse.com/mark/platform/haskell-platform-2013.2.0.0-rc1.tar.gz


 *Notable new things in Haskell Platform 2013.2:*

- GHC 7.6.3
- Major update to *OpenGL*  *GLUT*
- New packages:
   - *attoparsec*
   - *case-insensitive*
   - *hashable*
   - *unordered-containers*

 — Mark mad releaser Lentczner


 ___
 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] Release Candidates for Haskell Platform 2013.2

2013-05-13 Thread Mark Lentczner
It's a wiki - please feel free to do some maintenance when you find it!
I fixed the ReleaseCandidates page.

- Mark


On Mon, May 13, 2013 at 8:21 AM, harry volderm...@hotmail.com wrote:

 Mark Lentczner mark.lentczner at gmail.com writes:

  Some of the release candidates for Haskell Platform 2013.2 are up.These
 are what I expect to simply re-brand as the release, unless anyone
 uncovers some issues.

 Will they go on
 http://trac.haskell.org/haskell-platform/wiki/ReleaseCandidates?
 (http://trac.haskell.org/haskell-platform/ has a few outdated links. Does
 anyone know what the current links are for the documentation sections?)


 ___
 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] Release Candidates for Haskell Platform 2013.2

2013-05-13 Thread Kim-Ee Yeoh
On Mon, May 13, 2013 at 9:39 PM, Mark Lentczner mark.lentcz...@gmail.comwrote:

 *Some of the release candidates for Haskell Platform 2013.2 are up.*


Kudos! Exactly 7 days from the scheduled date, as stated. Hope to give them
a whirl once the other OSes are baked.

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


Re: [Haskell-cafe] Problem with mailman at projects.haskell.org

2013-05-13 Thread Yitzchak Gale
The mailman daemon process on the server apparently exited
for some reason. I restarted it, and now mail traffic seems to be
going through normally again.

-Yitz


On Sun, May 12, 2013 at 9:21 PM, Carter Schonwald
carter.schonw...@gmail.com wrote:
 I've had this problem too. Was trying to sign up for the llvm HS lib list
 but cant. I asked on Haskell irc and no one seems to know who admins the
 lists currently.

 On May 12, 2013 7:24 AM, Tim Docker t...@dockerz.net wrote:

 Hi,

 Has anyone noticed problems with the mailman instance running at
 projects.haskell.org? As best I can see there are no new posts in any of the
 hosted list archives since mid April. I know that there have been posts made
 to ch...@projects.haskell.org in May, and these have neither be distributed
 or archived.

 I've not had a response from mail...@projects.haskell.org.

 Tim

 ___
 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] Problem with mailman at projects.haskell.org

2013-05-13 Thread Tim Docker
Thanks - I can confirm all is working again. I believe than, within some 
time window. some messages may have been dropped.


Tim

On 14/05/13 07:06, Yitzchak Gale wrote:

The mailman daemon process on the server apparently exited
for some reason. I restarted it, and now mail traffic seems to be
going through normally again.

-Yitz


On Sun, May 12, 2013 at 9:21 PM, Carter Schonwald
carter.schonw...@gmail.com wrote:

I've had this problem too. Was trying to sign up for the llvm HS lib list
but cant. I asked on Haskell irc and no one seems to know who admins the
lists currently.

On May 12, 2013 7:24 AM, Tim Docker t...@dockerz.net wrote:

Hi,

Has anyone noticed problems with the mailman instance running at
projects.haskell.org? As best I can see there are no new posts in any of the
hosted list archives since mid April. I know that there have been posts made
to ch...@projects.haskell.org in May, and these have neither be distributed
or archived.

I've not had a response from mail...@projects.haskell.org.

Tim

___
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] Problem with mailman at projects.haskell.org

2013-05-13 Thread Yitzchak Gale
Quite possible, though I did see some messages going through from two days
ago when the mailman daemon went south.

Anyone who sent out an important message to one of those lists during the past
two days should double check that it now went out to the list.

-Yitz

On Tue, May 14, 2013 at 12:17 AM, Tim Docker t...@dockerz.net wrote:
 Thanks - I can confirm all is working again. I believe than, within some
 time window. some messages may have been dropped.

 Tim


 On 14/05/13 07:06, Yitzchak Gale wrote:

 The mailman daemon process on the server apparently exited
 for some reason. I restarted it, and now mail traffic seems to be
 going through normally again.

 -Yitz


 On Sun, May 12, 2013 at 9:21 PM, Carter Schonwald
 carter.schonw...@gmail.com wrote:

 I've had this problem too. Was trying to sign up for the llvm HS lib list
 but cant. I asked on Haskell irc and no one seems to know who admins the
 lists currently.

 On May 12, 2013 7:24 AM, Tim Docker t...@dockerz.net wrote:

 Hi,

 Has anyone noticed problems with the mailman instance running at
 projects.haskell.org? As best I can see there are no new posts in any of
 the
 hosted list archives since mid April. I know that there have been posts
 made
 to ch...@projects.haskell.org in May, and these have neither be
 distributed
 or archived.

 I've not had a response from mail...@projects.haskell.org.

 Tim

 ___
 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] fromIntegral not enough?

2013-05-13 Thread Christopher Howard
This is probably a haskell-beginners sort of question, but I usually get
about 4x as many responses from cafe, about 10x as fast.

I have code like so:

code:

data Xy a = Xy a a

class Coord2 a where

  coords2 :: Fractional b = a b - Xy b

data CircAppr a b = CircAppr a b b -- number of points, rotation angle,
radius
deriving (Show)

instance Integral a = Coord2 (CircAppr a) where

  coords2 (CircAppr divns ang rad) =
  let dAng = 2 * pi / (fromIntegral divns) in
  let angles = map (* dAng) [0..divns] in
  undefined -- To be coded...


In the instance definition divns is an integral trying to divide a
fractional. I hoped wrapping it in fromIntegral would coerce, but
apparently not:

quote:

Could not deduce (Fractional a) arising from a use of `/'
from the context (Integral a)
  bound by the instance declaration
  at /scratch/cmhoward/pulse-spin/pulse-spin.hs:34:10-42
or from (Fractional b)
  bound by the type signature for
 coords2 :: Fractional b = CircAppr a b - Xy b
  at /scratch/cmhoward/pulse-spin/pulse-spin.hs:(36,3)-(39,15)
Possible fix:
  add (Fractional a) to the context of
the type signature for
  coords2 :: Fractional b = CircAppr a b - Xy b
or the instance declaration
In the expression: 2 * pi / (fromIntegral divns)
In an equation for `dAng': dAng = 2 * pi / (fromIntegral divns)
In the expression:
  let dAng = 2 * pi / (fromIntegral divns) in
  let angles = map (* dAng) [0 .. divns] in undefined


So, I'm wondering how I can do what I'm trying to do here, while still
keeping my types as generic as possible.

-- 
frigidcode.com



signature.asc
Description: OpenPGP digital signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] fromIntegral not enough?

2013-05-13 Thread Tom Ellis
On Mon, May 13, 2013 at 02:08:26PM -0800, Christopher Howard wrote:
 instance Integral a = Coord2 (CircAppr a) where
 
   coords2 (CircAppr divns ang rad) =
   let dAng = 2 * pi / (fromIntegral divns) in
   let angles = map (* dAng) [0..divns] in
   undefined -- To be coded...

Your definition of angles forces dAng to be of type a.  Then in order
to define dAng as the result of a / there must be a Fractional instance 
for
a.

Hope that helps.

Tom

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


Re: [Haskell-cafe] fromIntegral not enough?

2013-05-13 Thread Tom Ellis
On Mon, May 13, 2013 at 11:43:41PM +0100, Tom Ellis wrote:
 On Mon, May 13, 2013 at 02:08:26PM -0800, Christopher Howard wrote:
  instance Integral a = Coord2 (CircAppr a) where
  
coords2 (CircAppr divns ang rad) =
let dAng = 2 * pi / (fromIntegral divns) in
let angles = map (* dAng) [0..divns] in
undefined -- To be coded...
 
 Your definition of angles forces dAng to be of type a.  Then in order
 to define dAng as the result of a / there must be a Fractional instance 
 for
 a.

You probably want

let angles = map ((* dAng) . fromInteger) [0..divns] in
...

instead.

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


Re: [Haskell-cafe] fromIntegral not enough?

2013-05-13 Thread Christopher Howard
On 05/13/2013 02:53 PM, Tom Ellis wrote:
 On Mon, May 13, 2013 at 11:43:41PM +0100, Tom Ellis wrote:
 
 You probably want
 
 let angles = map ((* dAng) . fromInteger) [0..divns] in
 ...
 
 instead.
 

Ah, that works. Thanks all.

-- 
frigidcode.com



signature.asc
Description: OpenPGP digital signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Robot - Simulate keyboard and mouse events under X11

2013-05-13 Thread Chris Wong
Oh, I see now. I originally made the runRobot functions reset the
input state when the Robot finished running. That worked well for my
use case (testing GUIs), but as you have noticed, it causes
unintuitive behavior when runRobot is called at a high frequency.

In hindsight, that was a design flaw on my part: that resetting
behavior should be specified explicitly, not attached unconditionally
to every call to runRobot.

I've removed the offending code, and released it as version 1.1.
Hopefully I've ironed out the issues now :)


On Mon, May 13, 2013 at 12:49 PM, Niklas Hambüchen m...@nh2.me wrote:
 Can you show me the code that triggers that behavior?

 It is basically

 Just connection - connect
 forever $ do
   (x,y) - getGyroMovement
   runRobotWithConnection (moveBy x y) connection



--
Chris Wong, fixpoint conjurer
  e: lambda.fa...@gmail.com
  w: http://lfairy.github.io/

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


Re: [Haskell-cafe] ANN: Robot - Simulate keyboard and mouse events under X11

2013-05-13 Thread Niklas Hambüchen
Awesome, that works very well, and it even made my program run faster / 
with less CPU.

The reset functionality is useful, but I think optional is better. Did 
you remove it entirely or is it still available?

On Tue 14 May 2013 08:25:04 SGT, Chris Wong wrote:
 Oh, I see now. I originally made the runRobot functions reset the
 input state when the Robot finished running. That worked well for my
 use case (testing GUIs), but as you have noticed, it causes
 unintuitive behavior when runRobot is called at a high frequency.

 In hindsight, that was a design flaw on my part: that resetting
 behavior should be specified explicitly, not attached unconditionally
 to every call to runRobot.

 I've removed the offending code, and released it as version 1.1.
 Hopefully I've ironed out the issues now :)


 On Mon, May 13, 2013 at 12:49 PM, Niklas Hambüchen m...@nh2.me wrote:
 Can you show me the code that triggers that behavior?

 It is basically

 Just connection - connect
 forever $ do
   (x,y) - getGyroMovement
   runRobotWithConnection (moveBy x y) connection



 --
 Chris Wong, fixpoint conjurer
   e: lambda.fa...@gmail.com
   w: http://lfairy.github.io/

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


Re: [Haskell-cafe] ANN: Robot - Simulate keyboard and mouse events under X11

2013-05-13 Thread Chris Wong
I removed the functionality because I didn't really see a use for it
anymore. The `hold` and `tap` functions are already exception safe
(thanks to `bracket`), and anyone who uses the unguarded `press`
function probably wants to keep it held down anyway.

Chris


On Tue, May 14, 2013 at 12:46 PM, Niklas Hambüchen m...@nh2.me wrote:
 Awesome, that works very well, and it even made my program run faster /
 with less CPU.

 The reset functionality is useful, but I think optional is better. Did
 you remove it entirely or is it still available?

 On Tue 14 May 2013 08:25:04 SGT, Chris Wong wrote:
 Oh, I see now. I originally made the runRobot functions reset the
 input state when the Robot finished running. That worked well for my
 use case (testing GUIs), but as you have noticed, it causes
 unintuitive behavior when runRobot is called at a high frequency.

 In hindsight, that was a design flaw on my part: that resetting
 behavior should be specified explicitly, not attached unconditionally
 to every call to runRobot.

 I've removed the offending code, and released it as version 1.1.
 Hopefully I've ironed out the issues now :)


 On Mon, May 13, 2013 at 12:49 PM, Niklas Hambüchen m...@nh2.me wrote:
 Can you show me the code that triggers that behavior?

 It is basically

 Just connection - connect
 forever $ do
   (x,y) - getGyroMovement
   runRobotWithConnection (moveBy x y) connection



 --
 Chris Wong, fixpoint conjurer
   e: lambda.fa...@gmail.com
   w: http://lfairy.github.io/



--
Chris Wong, fixpoint conjurer
  e: lambda.fa...@gmail.com
  w: http://lfairy.github.io/

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