Hi Yves,
It works (on Gentoo) when I compile it as a shared library.
% g++ -o libstuff.so -fpic -shared Stuff.cpp
% ghci Main.hs -L$PWD -lstuff
GHCi, version 7.4.1: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp
The simplest solution is to parse the prefixes yourself and do not put
it into the table.
(Doing the infixes and | by hand is no big deal, too, and possibly
easier then figuring out the capabilities of buildExpressionParser)
Cheers C.
Am 07.03.2012 13:08, schrieb Troels Henriksen:
Hi!
When writing library code that should work with both String and Text I
find my self repeatedly introducing classes like:
class ToString a where
toString :: a - String
class ToText a where
toText :: a - Text
(I use this with newtype wrapped value types backed by Text or
On 8 March 2012 10:53, Simon Hengel s...@typeful.net wrote:
When writing library code that should work with both String and Text I
find my self repeatedly introducing classes like:
class ToString a where
toString :: a - String
class ToText a where
toText :: a - Text
Text
* Simon Hengel s...@typeful.net [2012-03-08 10:53:15+0100]
When writing library code that should work with both String and Text I
find my self repeatedly introducing classes like:
[...]
How do you guys deal with that? Any thoughts?
If it's fine to depend on FunDeps, you can use ListLike.
On Thu, Mar 08, 2012 at 11:00:34AM +0100, Christopher Done wrote:
On 8 March 2012 10:53, Simon Hengel s...@typeful.net wrote:
When writing library code that should work with both String and Text I
find my self repeatedly introducing classes like:
class ToString a where
toString
On Thu, Mar 08, 2012 at 12:18:56PM +0200, Roman Cheplyaka wrote:
If it's fine to depend on FunDeps, you can use ListLike.
http://hackage.haskell.org/package/ListLike
How would that help with toText?
Cheers,
Simon
___
Haskell-Cafe mailing list
* Simon Hengel s...@typeful.net [2012-03-08 11:48:41+0100]
On Thu, Mar 08, 2012 at 12:18:56PM +0200, Roman Cheplyaka wrote:
If it's fine to depend on FunDeps, you can use ListLike.
http://hackage.haskell.org/package/ListLike
How would that help with toText?
toText = fromListLike
If you just need to go back and forth from String to Text, why do you need
to be generic? pack and unpack from Data.Text do the job.
Plus, in the way of what Christopher said, you can use the
OverloadedStrings extension. You can then use the string syntax at a place
that expects a text:
{-#
Thanks Mark!
It works also here, and even without the -fpic flag. Was it necessary for
you?
2012/3/8 Mark Wright markwri...@internode.on.net
Hi Yves,
It works (on Gentoo) when I compile it as a shared library.
% g++ -o libstuff.so -fpic -shared Stuff.cpp
% ghci Main.hs -L$PWD -lstuff
On Thu, Mar 08, 2012 at 12:37:31PM +0100, Yves Parès wrote:
If you just need to go back and forth from String to Text, why do you need
to be generic? pack and unpack from Data.Text do the job.
Always going through String or Text may (depending on what your
underlying representation is) be less
On Thu, Mar 08, 2012 at 12:54:13PM +0200, Roman Cheplyaka wrote:
* Simon Hengel s...@typeful.net [2012-03-08 11:48:41+0100]
On Thu, Mar 08, 2012 at 12:18:56PM +0200, Roman Cheplyaka wrote:
If it's fine to depend on FunDeps, you can use ListLike.
http://hackage.haskell.org/package/ListLike
On Thu, 8 Mar 2012 12:55:51 +0100, Yves Parès yves.pa...@gmail.com wrote:
Thanks Mark!
It works also here, and even without the -fpic flag. Was it necessary for
you?
Hi Yves,
Yes it is necessary for me to use -fpic when building C/C++ shared libraries as:
- I'm on amd64
- Its a Gentoo
* Simon Hengel s...@typeful.net [2012-03-08 13:20:22+0100]
On Thu, Mar 08, 2012 at 12:54:13PM +0200, Roman Cheplyaka wrote:
* Simon Hengel s...@typeful.net [2012-03-08 11:48:41+0100]
On Thu, Mar 08, 2012 at 12:18:56PM +0200, Roman Cheplyaka wrote:
If it's fine to depend on FunDeps, you
On 8 Mar 2012, at 13:21, Mark Wright wrote:
It might work without -fpic on x86 (32 bit):
http://www.mail-archive.com/gentoo-dev@gentoo.org/msg01420.html
On OS X, it is always on; I tried the example on 10.7, Xcode 4.3. I had to add
ln -s /Applications/Xcode.app/Contents/Developer
Chris Smith wrote:
My first impression on this is that it seems a little vague, but
possibly promising.
My impression is also that this project proposal is rather vague. The
general goal Haskell as client-side language for websites is clear and
worthwhile, but I can't tell from the proposal
Christian Maeder christian.mae...@dfki.de writes:
The simplest solution is to parse the prefixes yourself and do not put
it into the table.
(Doing the infixes and | by hand is no big deal, too, and
possibly easier then figuring out the capabilities of
buildExpressionParser)
Is there
‘Ello.
Is there a generalization of this operator? It's all over the place,
it's basically
(!) :: (Monad m, Indexed collection index value) = index -
container - m value
We have `(!!)` on lists, `(!)` on maps, vectors, json objects, …
(doesn't seem there's one for bytestring)
(Though I
On 08/03/12 16:19, Christopher Done wrote:
‘Ello.
Is there a generalization of this operator? It's all over the place,
it's basically
(!) :: (Monad m, Indexed collection index value) = index -
container - m value
We have `(!!)` on lists, `(!)` on maps, vectors, json objects, …
(doesn't
Ops sorry, I had misunderstood, you don't want key-lookups but a simple
indexing. In that case you might want an almost identical class but with
different instances (e.g IxClass [a] Int a, etc.).
Also, I don't see why you need to throw monads in.
Francesco.
Ok, this should suit your needs better, without functional dependencies
as a bonus:
{-# LANGUAGE TypeFamilies, ScopedTypeVariables, FlexibleInstances #-}
module IxClass (IxClass(..)) where
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Hashable (Hashable)
import
On Thu, Mar 8, 2012 at 11:19 AM, Christopher Done
chrisd...@googlemail.com wrote:
‘Ello.
Is there a generalization of this operator? It's all over the place,
it's basically
(!) :: (Monad m, Indexed collection index value) = index -
container - m value
We have `(!!)` on lists, `(!)` on
(Though I seem to recall the monadic return value being frowned upon
but I don't recall why.)
The type signature that you wrote is very generic and doesn't help in
introducing effects while retrieving the indexed value, which I imagine
is what you wanted to do.
I guess you could define a
On 8 March 2012 18:32, Anthony Cowley acow...@seas.upenn.edu wrote:
Perhaps Data.Key meets your needs?
http://hackage.haskell.org/packages/archive/keys/2.1.2/doc/html/Data-Key.html
Ah, perhaps indeed. Thanks!
On 8 March 2012 19:12, Francesco Mazzoli f...@mazzo.li wrote:
The type signature
Because Maybe is already a monad and it's nice to fail in the monad of
choice, e.g. if I'm in the list monad I get empty list instead, or if
I'm in the Result monad from JSON it'll fail in there. ‘Course fail
is suboptimal and MonadError might be better.
'fail' really shouldn't be in Monad. My
On Thu, Mar 08, 2012 at 07:53:48PM +0100, Christopher Done wrote:
On 8 March 2012 18:32, Anthony Cowley acow...@seas.upenn.edu wrote:
Perhaps Data.Key meets your needs?
http://hackage.haskell.org/packages/archive/keys/2.1.2/doc/html/Data-Key.html
Ah, perhaps indeed. Thanks!
On 8 March
On 8 March 2012 21:43, Brent Yorgey byor...@seas.upenn.edu wrote:
‘Course fail is suboptimal and MonadError might be better.
Monads have nothing to do with failure. Instead of Monad you would
want to use something like MonadZero or MonadError.
Yeah that's what I said. GOSH.
27 matches
Mail list logo