Re: [Haskell-cafe] ghc 7.2.1 and super simple DPH

2011-10-03 Thread Erik de Castro Lopo
Peter Braam wrote:

 Hi -
 
 I'm trying to compile DotP.hs from
 http://www.haskell.org/haskellwiki/GHC/Data_Parallel_Haskell#A_simple_example
 (see
 below)
 
 The compiler complains and says (twice in fact):
 
 DotP.hs:17:33: Not in scope: `fromPArrayP'
 
 Could someone help me out please?  Thanks a lot!


The code you posted had some wrapping issues and was missing an
import. I've included a version of the code that compiles for
me here (using ghc fromgit HEAD) using:

ghc -c -Odph -fdph-par DotP.hs

HTH,
Erik


{-# LANGUAGE ParallelArrays #-}
{-# OPTIONS_GHC -fvectorise #-}

module DotP (dotp_wrapper) where
import qualified Prelude

import Data.Array.Parallel
import Data.Array.Parallel.Prelude
import Data.Array.Parallel.Prelude.Double

dotp_double :: [:Double:] - [:Double:] - Double
dotp_double xs ys = sumP [:x * y | x - xs | y - ys:]

dotp_wrapper :: PArray Double - PArray Double - Double
{-# NOINLINE dotp_wrapper #-}
dotp_wrapper v w = dotp_double (fromPArrayP v) (fromPArrayP w)



-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/

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


Re: [Haskell-cafe] Is it possible to represent such polymorphism?

2011-10-03 Thread sdiyazg

Quoting Richard O'Keefe o...@cs.otago.ac.nz:



On 3/10/2011, at 7:15 AM, Du Xi wrote:


I guess this is what I want, thank you all. Although I still wonder  
 why something so simple in C++ is actually more verbose and   
requires less known features in Haskell...What was the design   
intent to disallow simple overloading?


It's not SIMPLE overloading you are asking for,
but AD HOC overloading, which may look simple, but really isn't.

Taking your C++ f() example, in what sense are the two functions   
_the same function_?






I understand that functions with the same name but different type  
signatures are not the same function, but are a family of  
functions,probably representing the same concept.


Also

identityInHaskell::a-a
identityInHaskell x = x
--I don't know if this is implemented as runtime polymorphism or  
compile-time polymorphism,

--but it is possible to implement this as compile-time polymorphism.

and

template typename T  T IdentityInCPP( T x ){ return x; }

are families of different functions.

I think the problem I have encountered can be broken down to 2 problems:

1. Haskell doesn't have a way to represent mapping from one type to  
another (consider metafunctions in C++), which is addressed by  
TypeFamilies.


2. Haskell disallows ad-hoc overloading. But I think implementing  
ad-hoc overloading itself should be no more complex than implementing  
type classes, perhaps it would tear a hole somewhere else?




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


Re: [Haskell-cafe] ghc 7.2.1 and super simple DPH

2011-10-03 Thread Erik de Castro Lopo
Erik de Castro Lopo wrote:

 The code you posted had some wrapping issues and was missing an
 import.

I should have also mentioned how I figured out what the missing
import was.

Firstly, I tried hoogle [0] but couldn't find it. I then realised
that it must be part of DPH and that I had a copy of the DPH sources
on my machine. Going to the DPH source tree I did:

  find . -name \*.hs | xargs grep ^fromPArrayP

which showed up this:

dph-common/Data/Array/Parallel.hs:fromPArrayP :: PArray a - [:a:]

Cheers,
Erik

[0] http://www.haskell.org/hoogle/
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/

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


Re: [Haskell-cafe] How to compile this example code?

2011-10-03 Thread Roel van Dijk
{- forgot to reply to list -}

This isn't Haskell syntax. Atleast not directly. It is either
hsc2hs[1] or c2hs [2]. Also see [3] for the difference between the
two. Soin order to compile that code you first have to run it through
aspecial preprocessor.
1 - http://www.haskell.org/ghc/docs/7.2.1/html/users_guide/hsc2hs.html2
- http://www.cse.unsw.edu.au/~chak/haskell/c2hs/3 -
http://stackoverflow.com/questions/6009031/difference-between-hsc2hs-and-c2hs
2011/10/3 Magicloud Magiclouds magicloud.magiclo...@gmail.com:
 Hi,
  I am learning to use data-flags, and got this example code:
 import Data.Flags
 newtype MyFlags = MyFlags CInt deriving (Eq, Flags)
 #{enum MyFlags, MyFlags
  , myFlag1 = C_FLAG1
  , myFlag2 = C_FLAG2
  , myFlag3 = C_FLAG3
  }

  I modified it trying to compile it. Well, I got illegal syntax at #{e.
  In fact, I am not quite know the syntax here. Any clue?

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


Re: [Haskell-cafe] Is it possible to represent such polymorphism?

2011-10-03 Thread Malcolm Wallace
 Although I still wonder why something so simple in C++ is actually more 
 verbose and requires less known features in Haskell...What was the design 
 intent to disallow simple overloading?

The simple C++ overloading you want to add to Haskell, is in fact rather 
semantically complex, and it leads to undecidability of the type system.  The 
inherent formal complexity here suggests that this form of overloading is 
highly unlikely to be the correct solution in practice to the problem you are 
trying to solve.  And even if it were a technically correct solution, it is 
likely to be unmaintainable and fragile to code changes.  There is a high 
probability that a more-formally-tractable solution exists, and that using it 
will improve your understanding of the problem at hand, and make your code more 
regular and robust to change.

Regards,
Malcolm

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


Re: [Haskell-cafe] Is it possible to represent such polymorphism?

2011-10-03 Thread sdiyazg

Quoting Felipe Almeida Lessa felipe.le...@gmail.com:


On Sun, Oct 2, 2011 at 4:26 PM, Edward Z. Yang ezy...@mit.edu wrote:

What are you actually trying to do?  This seems like a rather
unusual function.


If you're new to the language, most likely you're doing something
wrong if you need this kind of function.  =)

--
Felipe.



{-# LANGUAGE TypeFamilies,FlexibleInstances #-}

module RicherListOp ( generalizedFilter,generalizedMap,generalizedFilterMap )
where
import Data.List

generalizedFilter pred = impl.expand3 where
impl (dL,dR,step) = generalizedFilterMap tf (dL+dR+1,step) where
tf s = if pred s then [s !! dL] else []

generalizedMap tf = generalizedFilterMap $ \x-[tf x]

generalizedFilterMap tf ns ls = impl {-$ expand2-} ns where
impl (len,step) = f ls where
		f xs | length xs =len = (tf $ genericTake len xs) ++ (f $  
genericDrop step xs)

f _ = []

class Expand3 t where
type Result3 t
expand3 :: t-Result3 t

instance (Integral a,Integral b)=Expand3 (a,b) where
type Result3 (a,b) = (a,b,Int)
expand3 (l,r) = (l,r,1)

instance (Integral a,Integral b,Integral c)=Expand3 (a,b,c) where
type Result3 (a,b,c) = (a,b,c)
expand3 = id

--instance (Integral a)=Expand3 a where
--  type Result3 a = (a,a,a)
--  expand3 r = (0,r,1)

--class Expand2 t where
--  type Result2 t
--  expand2 :: t-Result2 t

--instance (Integral a)=Expand2 (a,a) where
--  type Result2 (a,a) = (a,a)
--  expand2 = id

--instance (Integral a)=Expand2 a where
--  type Result2 a = (a,a)
--  expand2 a = (a,1)

examples:
generalizedFilterMap (\[x,y,z]- if(x==1z==1)then [y*10] else  
[0]) (3,1) [1,2,3,4,1,2,1,3,1,4,1,5,2]

[0,0,0,0,20,0,30,0,40,0,0]
it :: [Integer]

generalizedFilter (\[x,y,z] - x==1z==1) (1,1) [1,2,3,4,1,2,1,3,1,4,1,5,2]

[2,3,4]
it :: [Integer]

The code commented out is what I still can't get working. (I'm no  
longer trying to finish them. They are included just to illustrate my  
idea). Of course, I could have simply used [Int] , (Num a)=[a] or  
(Int,Int,Int), but I'm trying to write code as generic as possible.



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


Re: [Haskell-cafe] Is it possible to represent such polymorphism?

2011-10-03 Thread sdiyazg

Quoting Andrew Coppin andrewcop...@btinternet.com:


On 02/10/2011 07:15 PM, Du Xi wrote:

In C++, the code is inferred from the types. (I.e., if a function is
overloaded, the correct implementation is selected depending on the
types of the arguments.)

In Haskell, the types are inferred from the code. (Which is why type
signatures are optional.)

Really, it's just approaching the same problem from a different direction.

Also, as others have said, you're probably just approaching the problem
from the wrong angle. You don't design an object-oriented program the
same way you'd design a procedural program; if you do, you end up with a
horrible design. Similarly, you don't design a functional program the
same way you would design an object-oriented one. It takes time (and
experience) to figure out how to approach FP - or any other radically
different paradigm, I suppose...

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




Quoting Brandon Allbery allber...@gmail.com:


On Sun, Oct 2, 2011 at 15:17, sdiy...@sjtu.edu.cn wrote:

Not for your meaning of clean.

C++ is an object-oriented programming language; given a method call, it
tries really hard to shoehorn the arguments to the call into some declared
method somewhere along the inheritance chain.  Haskell is a functional
programming language; it is strongly typed, and typeclasses are a mechanism
to allow that typing to be weakened in a strictly controlled fashion.  In
some sense, it's not *supposed* to be convenient, because the whole point is
you're not supposed to throw arbitrarily-typed expressions at arbitrary
functions.  Instead, a properly designed program is characterized by its
types; if the types are well designed for the problem being solved, they
very nearly write the program by themselves.

This doesn't mean that use of typeclasses / ad-hoc polymorphism is
automatically a sign of a poor design, but it *does* mean you should think
about what you're trying to do whenever you find yourself considering them.

Nor does it mean that C++ is in some sense wrong; it means the languages
are fundamentally different, and the appropriate design of a program is
therefore also usually different between the two.

--
brandon s allbery  allber...@gmail.com
wandering unix systems administrator (available) (412) 475-9364 vm/sms



This has nothing to do with OOP or being imperative.It's just about types.


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


Re: [Haskell-cafe] Is it possible to represent such polymorphism?

2011-10-03 Thread Ketil Malde
sdiy...@sjtu.edu.cn writes:

 This has nothing to do with OOP or being imperative. It's just about types.

Of course, it's not necessarily linked to OOP, but OO languages - to the
extent they have types - tend towards ad-hoc polymorphism instead of
parametric polymorphism.  There are different trade-offs, one is the
lack of return-type overloading in C++.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants

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


[Haskell-cafe] ANN: OpenCL 1.0.1.3 package

2011-10-03 Thread Luis Cabellos
Hello, all.

I want to show you the OpenCL package. I have done this using Jeff Heard
OpenCLRaw package, but I create a new one due the lack of updates of the
former.

# Where to get it

* Hackage page (http://hackage.haskell.org/package/OpenCL)
* Repository (https://github.com/zhensydow/opencl)
* Bugs (https://github.com/zhensydow/opencl/issues)
* Examples (https://github.com/zhensydow/opencl/tree/master/examples).

# Things:

* I write it's high-level binding to OpenCL libraries, but only because I
added more types to hide most of the alloc/free of the API, and hide the
enums using c2hs enums.
* The worst problem of the OpenCLRaw is the bad types it use, I learn to fix
32/64 bits issues with c2hs, and test it on linux machines.
* Tested on Linux + NVidia only.
* Jason Dagit is helping with Windows, OSX testing in own fork, also the
call-conv fork in github has changes to work on Windows

Please, Consider it's on experimental status but it works, I need lots of
feedbacks for detect posible errors,
Thanks,
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ghc 7.2.1 and super simple DPH

2011-10-03 Thread Peter Braam
Super helpful, thanks!

Peter

On Mon, Oct 3, 2011 at 12:54 AM, Erik de Castro Lopo
mle...@mega-nerd.comwrote:

 Erik de Castro Lopo wrote:

  The code you posted had some wrapping issues and was missing an
  import.

 I should have also mentioned how I figured out what the missing
 import was.

 Firstly, I tried hoogle [0] but couldn't find it. I then realised
 that it must be part of DPH and that I had a copy of the DPH sources
 on my machine. Going to the DPH source tree I did:

  find . -name \*.hs | xargs grep ^fromPArrayP

 which showed up this:

dph-common/Data/Array/Parallel.hs:fromPArrayP :: PArray a - [:a:]

 Cheers,
 Erik

 [0] http://www.haskell.org/hoogle/
 --
 --
 Erik de Castro Lopo
 http://www.mega-nerd.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


[Haskell-cafe] HEADS-UP: security fix, please upgrade clientsession to = 0.7.3.1

2011-10-03 Thread Felipe Almeida Lessa
Hello!

Please be advised that clientsession  0.7.3.1 is vulnerable to timing
attacks [1].  We have just released a fix and it's already on Hackage
[2].  We advise all users of clientsession (and, consequently, Yesod)
to upgrade as soon as possible to a version = 0.7.3.1.

With a timing attack a malicious user may be able to construct a valid
MAC for his message.  However, the attacker is not able to recover the
MAC key or the encryption key.  So you don't need to change your keys,
just upgrade ASAP.

Cheers, =)

[1] https://github.com/snoyberg/clientsession/pull/4
[2] http://hackage.haskell.org/package/clientsession-0.7.3.1

-- 
Felipe.

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


Re: [Haskell-cafe] haskell i18n best practices

2011-10-03 Thread Yitzchak Gale
Thanks for all the great information provided in this thread.

The wiki page that Paulo originally linked had Vasyl's
fantastic documentation for using his hgettext package,
but it did not mention any of the other methods we discussed.

I moved the gettext documentation to its own linked page
and tried to collect together the general information from
this thread.

Please take a moment and look it over. Correct any
mistakes I made.

http://haskell.org/haskellwiki/Internationalization_of_Haskell_programs

Rogan, especially, please look it over. I really had to
read between the lines to come up with a clear and concise
description of GF and what it does, so I may have gotten
it wrong.

Felipe, I put your wonderful example on its own linked
page.

Thanks,
Yitz

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


Re: [Haskell-cafe] HEADS-UP: security fix, please upgrade clientsession to = 0.7.3.1

2011-10-03 Thread Felipe Almeida Lessa
On Mon, Oct 3, 2011 at 10:01 AM, Felipe Almeida Lessa
felipe.le...@gmail.com wrote:
 With a timing attack a malicious user may be able to construct a valid
 MAC for his message.  However, the attacker is not able to recover the
 MAC key or the encryption key.  So you don't need to change your keys,
 just upgrade ASAP.

If you are really paranoid, you may worry about a malicious user that
created a valid cookie for an administrator expiring on 2030 while you
still haven't upgraded.  If have this level of security
paranoia/consciousness, you may want to generate new keys.  Just
delete client_session_key.aes before restarting your application with
the fixed clientsession = 0.7.3.1 and new, random keys will be
generated for you.

Cheers, =)

-- 
Felipe.

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


Re: [Haskell-cafe] haskell i18n best practices

2011-10-03 Thread Felipe Almeida Lessa
On Mon, Oct 3, 2011 at 10:05 AM, Yitzchak Gale g...@sefer.org wrote:
 Felipe, I put your wonderful example on its own linked
 page.

Thanks, I'm always lazy with wikis =).  I've corrected a few typos
I've made on my e-mail there.

Cheers,

-- 
Felipe.

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


Re: [Haskell-cafe] How to compile this example code?

2011-10-03 Thread Magicloud Magiclouds
On Mon, Oct 3, 2011 at 3:50 PM, Roel van Dijk vandijk.r...@gmail.com wrote:
 {- forgot to reply to list -}

 This isn't Haskell syntax. Atleast not directly. It is either
 hsc2hs[1] or c2hs [2]. Also see [3] for the difference between the
 two. Soin order to compile that code you first have to run it through
 aspecial preprocessor.
 1 - http://www.haskell.org/ghc/docs/7.2.1/html/users_guide/hsc2hs.html2
 - http://www.cse.unsw.edu.au/~chak/haskell/c2hs/3 -
 http://stackoverflow.com/questions/6009031/difference-between-hsc2hs-and-c2hs
 2011/10/3 Magicloud Magiclouds magicloud.magiclo...@gmail.com:
 Hi,
  I am learning to use data-flags, and got this example code:
 import Data.Flags
 newtype MyFlags = MyFlags CInt deriving (Eq, Flags)
 #{enum MyFlags, MyFlags
  , myFlag1 = C_FLAG1
  , myFlag2 = C_FLAG2
  , myFlag3 = C_FLAG3
  }

  I modified it trying to compile it. Well, I got illegal syntax at #{e.
  In fact, I am not quite know the syntax here. Any clue?

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


I see. I was mislead, did not noticed the c binding part.
Thank you.

-- 
竹密岂妨流水过
山高哪阻野云飞

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


[Haskell-cafe] Problem on using class as type.

2011-10-03 Thread Magicloud Magiclouds
Hi,
  I have a function:
post :: (ToJson p, FromJson q) = String - String - String -
Map.Map String p - IO q
  Now I'd like to call it like:
r - post site token user.addMedia (Map.fromList [ (users, users :: ToJson)
   , (medias, medias
:: ToJson) ])
  So I got the problem. If I used things like users :: ToJson, then
class used as a type error occurred. But if I did not use them, since
users and medias were actually different types, then fromList failed,
required the type of medias the same with users.

  How to resolve the conflict?
-- 
竹密岂妨流水过
山高哪阻野云飞

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


Re: [Haskell-cafe] Problem on using class as type.

2011-10-03 Thread Jesse Schalken
What about users :: ToJson a = a?

On Tue, Oct 4, 2011 at 12:42 AM, Magicloud Magiclouds 
magicloud.magiclo...@gmail.com wrote:

 Hi,
  I have a function:
 post :: (ToJson p, FromJson q) = String - String - String -
 Map.Map String p - IO q
  Now I'd like to call it like:
 r - post site token user.addMedia (Map.fromList [ (users, users ::
 ToJson)
   , (medias, medias
 :: ToJson) ])
  So I got the problem. If I used things like users :: ToJson, then
 class used as a type error occurred. But if I did not use them, since
 users and medias were actually different types, then fromList failed,
 required the type of medias the same with users.

  How to resolve the conflict?
 --
 竹密岂妨流水过
 山高哪阻野云飞

 ___
 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 on using class as type.

2011-10-03 Thread Brent Yorgey
On Mon, Oct 03, 2011 at 09:42:59PM +0800, Magicloud Magiclouds wrote:
 Hi,
   I have a function:
 post :: (ToJson p, FromJson q) = String - String - String -
 Map.Map String p - IO q
   Now I'd like to call it like:
 r - post site token user.addMedia (Map.fromList [ (users, users :: 
 ToJson)
, (medias, medias
 :: ToJson) ])
   So I got the problem. If I used things like users :: ToJson, then
 class used as a type error occurred. But if I did not use them, since
 users and medias were actually different types, then fromList failed,
 required the type of medias the same with users.

If users and medias are different types, then you cannot put them in
the same list.  The ToJson class provides a method

  toJson :: ToJson a = a - Json

so presumably you need to call this method on users and medias, like

  ... (users, toJson users)
, (medias, toJson medias)

-Brent

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


Re: [Haskell-cafe] Problem on using class as type.

2011-10-03 Thread Steffen Schuldenzucker

On 10/03/2011 10:42 PM, Magicloud Magiclouds wrote:

Hi,
   I have a function:
post :: (ToJson p, FromJson q) =  String -  String -  String -
Map.Map String p -  IO q
   Now I'd like to call it like:
r- post site token user.addMedia (Map.fromList [ (users, users :: ToJson)
, (medias, medias
:: ToJson) ])
   So I got the problem. If I used things like users :: ToJson, then
class used as a type error occurred. But if I did not use them, since
users and medias were actually different types, then fromList failed,
required the type of medias the same with users.

   How to resolve the conflict?


If 'users' and 'medias' are actually of a general type (like for all a 
with ToJson a, users describes a value of type a), use Jesse's 
suggestion. Otherwise (there is an a with ToJson a such that users 
describes a value of type a), you might want to use existentials:


{-# LANGUAGE ExistentialQuantification #-}
data SomeToJson = forall a. (ToJson a) = SomeToJson a

instance ToJson SomeToJson where
toJson (SomeToJson x) = toJson x  -- I guess your class looks like 
this?


And then:
r - post site token user.addMedia $ Map.fromList
[(users, SomeToJson users), (medias, SomeToJson medias)]

As a last remark, I needed this pattern exactly once, namely for dealing 
with rank 2 types in rendering functions using takusen. I can conclude 
that requiring it is often an indicator for a major design flaw in your 
program. In this case:


Why not:

-- assuming that there is an
-- instance ToJson Json where toJson = id
r - post site token user.addMedia $ Map.fromList
   [(users, toJson users), (medias, toJson medias)]

Cheers!

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


[Haskell-cafe] ghc with -fPIC support

2011-10-03 Thread Phyx
Hi All,

I'm trying to install GHC with -fPIC support in Fedora.
I've grabbed a source tarball since it seems no binary one has this.

In Build.mk i've changed the quick build type to

ifeq $(BuildFlavour) quick

SRC_HC_OPTS= -H64m -O0 -fasm -fPIC
GhcStage1HcOpts= -O -fasm -fPIC
GhcStage2HcOpts= -O0 -fasm -fPIC
GhcLibHcOpts   = -O -fasm -fPIC
SplitObjs  = NO
HADDOCK_DOCS   = NO
BUILD_DOCBOOK_HTML = NO
BUILD_DOCBOOK_PS   = NO
BUILD_DOCBOOK_PDF  = NO

endif

unfortunately, when compiling i still get the ld error

*** *** ghc -fglasgow-exts --make -shared -oHs2lib.a
/tmp/Hs2lib924498/Hs2lib.hs dllmain.o -static
-fno-warn-deprecated-flags -O2 -package ghc -package Hs2lib
-i/home/phyx/Documents/Haskell/Hs2lib -optl-Wl,-s
-funfolding-use-threshold=16 -optc-O3 -optc-ffast-math
Linking a.out ...
*** /usr/bin/ld: /tmp/Hs2lib924498/Hs2lib.o: relocation R_X86_64_32
against `ghczmprim_GHCziUnit_Z0T_closure' can not be used when making
a shared object; recompile with -fPIC
*** /tmp/Hs2lib924498/Hs2lib.o: could not read symbols: Bad value

I've also told cabal to build any packages with -fPIC and shared.

Anyone have any ideas?

Regards,
Phyx

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


Re: [Haskell-cafe] ANN: OpenCL 1.0.1.3 package

2011-10-03 Thread Jason Dagit
On Mon, Oct 3, 2011 at 9:04 AM, Jason Dagit dag...@gmail.com wrote:

 We could have a different version of the function for each return
 type, clGetDeviceInfo_FPConfig, clGetDeviceInfo_AddressBits, etc.
 It's a great naming convention but it has the property that someone
 searching the bindings or the bindings' haddocks for clGetDeviceInfo
 will find those functions.

I meant to say, It's NOT a great naming convention ...

Jason

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


Re: [Haskell-cafe] ANN: OpenCL 1.0.1.3 package

2011-10-03 Thread Jason Dagit
On Mon, Oct 3, 2011 at 3:56 AM, Luis Cabellos cabel...@ifca.unican.es wrote:
 Hello, all.
 I want to show you the OpenCL package. I have done this using Jeff Heard
 OpenCLRaw package, but I create a new one due the lack of updates of the
 former.
 # Where to get it
 * Hackage page (http://hackage.haskell.org/package/OpenCL)
 * Repository (https://github.com/zhensydow/opencl)
 * Bugs (https://github.com/zhensydow/opencl/issues)
 * Examples (https://github.com/zhensydow/opencl/tree/master/examples).
 # Things:
 * I write it's high-level binding to OpenCL libraries, but only because I
 added more types to hide most of the alloc/free of the API, and hide the
 enums using c2hs enums.
 * The worst problem of the OpenCLRaw is the bad types it use, I learn to fix
 32/64 bits issues with c2hs, and test it on linux machines.
 * Tested on Linux + NVidia only.
 * Jason Dagit is helping with Windows, OSX testing in own fork, also the
 call-conv fork in github has changes to work on Windows

Your bindings are a higher quality than the the OpenCLRaw bindings and
you're doing good technical work, but I stopped using your bindings
for a couple reasons:
  * The main reason is that I'm not comfortable with the license
you're using.  The original code by Jeff Heard was BSD3 with an
additional copyright notice.  Your code is AGPL3.  The GPL is known to
cause problems with Haskell code due to cross module inlining.  I
don't know how the A in AGPL changes things.
  * Some of the exposed function names have been changed from the
original name in the OpenCL specification.  This is the same thing
that was done with the OpenGL bindings and it is very confusing for
people who come to the Haskell bindings from the official
documentation.  I realize that some of the API functions require some
bit of name mangling, but I think the current way is not the right
way.  For example with this function:
http://www.khronos.org/registry/cl/sdk/1.0/docs/man/xhtml/clGetDeviceInfo.html

We could have a different version of the function for each return
type, clGetDeviceInfo_FPConfig, clGetDeviceInfo_AddressBits, etc.
It's a great naming convention but it has the property that someone
searching the bindings or the bindings' haddocks for clGetDeviceInfo
will find those functions.  I think this is better than naming it
clGetDeviceExtensions, which is not in the OpenCL specification.

I'd still be willing to test the changes you have, I just don't want
to contribute to your bindings due to the license.  I currently
thinking of starting my own bindings (Jeff's bindings contain too many
small bugs and if I'm going to change most lines of code then I might
as well start from scratch so that it can have a standard BSD3
license).

Jason

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


Re: [Haskell-cafe] Installing hledger-web

2011-10-03 Thread Simon Michael

On 10/2/11 10:12 AM, Arnaud Bailly wrote:

No problem ! BTW, have you ever thought of coupling hledger with git for saving 
a ledger ? There is ongoing work to
provide a native git interface.


Yes, Clint Adams has begun adapting it to use the filestore (rcs abstraction layer) lib, and this is a goal of the 0.17 
release. Additional help welcome!



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


[Haskell-cafe] Trying to experiment with tangible values using GuiTV

2011-10-03 Thread Martin Baldan
Hello all,

I'm very new to Haskell, but still I'd like to play with tangible values,
which I find really intriguing. After getting some kind help in
haskell-beginners, I managed to compile and run a small example. Which is as
follows:

--


{-# LANGUAGE OverlappingInstances, UndecidableInstances
   , IncoherentInstances, FlexibleContexts
   , TypeSynonymInstances, FlexibleInstances
   , MultiParamTypeClasses
   #-}
-- For ghc 6.6 compatibility
{-# OPTIONS -fglasgow-exts -fallow-overlapping-instances
-fallow-incoherent-instances #-}


 Some GuiTV examples.  See also the examples in TV.

import Data.List (sort)

-- my addition
import Data.Monoid
-- end my addition

import Interface.TV.UI
import Control.Arrow.DeepArrow
import Data.FunArr

-- TypeCompose
import Data.Title

-- To pick up the FunArr instance for OFun.
import Interface.TV.OFun()

reverseT :: CTV (String - String)
reverseT = tv (oTitle reverse defaultOut) reverse

main = runUI reverseT


---

There were some warnings during compilation:

-
[1 of 1] Compiling Main ( myexample.hs, myexample.o )

myexample.hs:7:11:
   Warning: -fallow-overlapping-instances is deprecated: use
-XOverlappingInstances or pragma {-# LANGUAGE OverlappingInstances #-}
instead

myexample.hs:7:11:
   Warning: -fallow-incoherent-instances is deprecated: use
-XIncoherentInstances or pragma {-# LANGUAGE IncoherentInstances #-}
instead
Linking myexample ...
martin@martin-desktop:/media/
ext4logicaUnTera/cosas_linux/programs/haskell/TV/examples/src/miejemplo$
ghc --make myexample.hs

myexample.hs:7:11:
   Warning: -fallow-overlapping-instances is deprecated: use
-XOverlappingInstances or pragma {-# LANGUAGE OverlappingInstances #-}
instead

myexample.hs:7:11:
   Warning: -fallow-incoherent-instances is deprecated: use
-XIncoherentInstances or pragma {-# LANGUAGE IncoherentInstances #-}
instead

-


When I run it, I get a little window with the reverse title and two
textboxes. However, when I write something in the upper box, nothing
happens. I must say that when I use runIO instead of runUI in this little
program, the interactive program does work. Only the GUI version doesn't.

So, the person who helped me (Brandon Allbery) said it's probably because of
a GuiTV being a bit too old. He recommended me to ask about the issue here,
at haskell-cafe.

Any suggestions? Maybe I should use GtkTV istead of GuiTV? Thanks in
advance!


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


[Haskell-cafe] Composing a list of Enumeratees into an Enumerator using ($=)

2011-10-03 Thread Román González
Hey guys,

Right now I'm facing with a type problem that is really nasty, I want to
compose a list of enumeratees using the ($=) operator to create a new
enumerator.  Whenever I'm trying to use the foldx function in conjunction
with ($=) I get this error:

* :t foldr ($=)*

interactive:1:7:
Occurs check: cannot construct the infinite type:
  b0 = Step ao0 m0 b0
Expected type: Enumerator ao0 m0 (Step ao0 m0 b0)
   - Enumeratee ao0 ao0 m0 b0
   - Enumeratee ao0 ao0 m0 b0
  Actual type: Enumerator ao0 m0 (Step ao0 m0 b0)
   - Enumeratee ao0 ao0 m0 b0
   - Enumerator ao0 m0 b0
In the first argument of `foldr', namely `($=)'
In the expression: foldr ($=)

* :t Prelude.foldl ($=)*

interactive:1:15:
Occurs check: cannot construct the infinite type:
  b0 = Step ao0 m0 b0
Expected type: Enumerator ao0 m0 (Step ao0 m0 b0)
   - Enumeratee ao0 ao0 m0 b0
   - Enumerator ao0 m0 (Step ao0 m0 b0)
  Actual type: Enumerator ao0 m0 (Step ao0 m0 b0)
   - Enumeratee ao0 ao0 m0 b0
   - Enumerator ao0 m0 b0
In the first argument of `Prelude.foldl', namely `($=)'
In the expression: Prelude.foldl ($=)

interactive:1:15:
Occurs check: cannot construct the infinite type:
  b0 = Step ao0 m0 b0
Expected type: Enumerator ao0 m0 (Step ao0 m0 b0)
   - Enumeratee ao0 ao0 m0 b0
   - Enumerator ao0 m0 (Step ao0 m0 b0)
  Actual type: Enumerator ao0 m0 (Step ao0 m0 b0)
   - Enumeratee ao0 ao0 m0 b0
   - Enumerator ao0 m0 b0
In the first argument of `Prelude.foldl', namely `($=)'
In the expression: Prelude.foldl ($=)

Obviously there is something I don't quite understand about the ($=) (=$)
functions, how can one compose a list of enumeratees, is it even possible?

Cheers.

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


Re: [Haskell-cafe] Composing a list of Enumeratees into an Enumerator using ($=)

2011-10-03 Thread Conrad Parker
2011/10/4 Román González romanand...@gmail.com:
 Hey guys,

 Right now I'm facing with a type problem that is really nasty, I want to
 compose a list of enumeratees using the ($=) operator to create a new
 enumerator.  Whenever I'm trying to use the foldx function in conjunction
 with ($=) I get this error:

 :t foldr ($=)

 interactive:1:7:
     Occurs check: cannot construct the infinite type:
   b0 = Step ao0 m0 b0
     Expected type: Enumerator ao0 m0 (Step ao0 m0 b0)
    - Enumeratee ao0 ao0 m0 b0
    - Enumeratee ao0 ao0 m0 b0
   Actual type: Enumerator ao0 m0 (Step ao0 m0 b0)
    - Enumeratee ao0 ao0 m0 b0
    - Enumerator ao0 m0 b0
     In the first argument of `foldr', namely `($=)'
     In the expression: foldr ($=)

 :t Prelude.foldl ($=)

 interactive:1:15:
     Occurs check: cannot construct the infinite type:
   b0 = Step ao0 m0 b0
     Expected type: Enumerator ao0 m0 (Step ao0 m0 b0)
    - Enumeratee ao0 ao0 m0 b0
    - Enumerator ao0 m0 (Step ao0 m0 b0)
   Actual type: Enumerator ao0 m0 (Step ao0 m0 b0)
    - Enumeratee ao0 ao0 m0 b0
    - Enumerator ao0 m0 b0
     In the first argument of `Prelude.foldl', namely `($=)'
     In the expression: Prelude.foldl ($=)

 interactive:1:15:
     Occurs check: cannot construct the infinite type:
   b0 = Step ao0 m0 b0
     Expected type: Enumerator ao0 m0 (Step ao0 m0 b0)
    - Enumeratee ao0 ao0 m0 b0
    - Enumerator ao0 m0 (Step ao0 m0 b0)
   Actual type: Enumerator ao0 m0 (Step ao0 m0 b0)
    - Enumeratee ao0 ao0 m0 b0
    - Enumerator ao0 m0 b0
     In the first argument of `Prelude.foldl', namely `($=)'
     In the expression: Prelude.foldl ($=)

 Obviously there is something I don't quite understand about the ($=) (=$)
 functions, how can one compose a list of enumeratees, is it even possible?

Hi,

what are you trying to actually do, ie. what kind of data are you
trying to transform, what are the inputs and outputs of each
enumeratee?

are you trying to feed the output of the first enumeratee into the
input of the second, and so on? or are you trying to run them all in
parallel?

Conrad.

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


Re: [Haskell-cafe] Installing hledger-web

2011-10-03 Thread Arnaud Bailly
Being a long time user of ledger though and a long time haskell fan, I would
be more than happy to lend a hand but my free time is short.
I will try to have a look to the sources and see if I can find opportunities
to help.

Regards,
Arnaud

On Mon, Oct 3, 2011 at 8:27 PM, Simon Michael si...@joyful.com wrote:

 On 10/2/11 10:12 AM, Arnaud Bailly wrote:

 No problem ! BTW, have you ever thought of coupling hledger with git for
 saving a ledger ? There is ongoing work to
 provide a native git interface.


 Yes, Clint Adams has begun adapting it to use the filestore (rcs
 abstraction layer) lib, and this is a goal of the 0.17 release. Additional
 help welcome!



 __**_
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://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] CAL or Frege as a Haskell replacement on JVM?

2011-10-03 Thread Tom Davies
Hi Karel,

I'm a (the? ;-) very keen user of CAL (ex user at the moment, as work and 
family doesn't leave me enough time for side projects).

Pro:
 - Very solid and high quality, practically bug-free in my experience.
 - Performs some useful optimisations (self tail recursion as iteration, 
unboxing of primitives, strictness annotations/analysis) which can give you 
Java-level performance in some cases.
 - Good (IMHO) though verbose Java interop -- you can often turn Java types 
into CAL types rather than needing to wrap them in another layer.

Con:
 - Haskell 98 type system (actually I found that a bit of a pro for learning fp)
 - Less syntactic sugar (do notation, equational definitions, pattern matching 
outside case statements)
 - Few users. There are occasional commits to forks of CAL at 
https://github.com/levans/Open-Quark and Luke Evans says that work on CAL 
continues at Indicee, but there's little visible activity.

None of these points are in comparison to Frege, which I haven't used at all.

Tom


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