Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: haskell testing framework - missing htfpp (Ovidiu D)
2. Re: More than one way to skin a cat question - repeat
(Brent Yorgey)
3. Re: haskell testing framework - missing htfpp (Chadda? Fouch?)
4. FFI, export a ByteString (Kees Bleijenberg)
5. Re: Haskell type definitions (Gesh)
6. Will Haskell Platform 2012.4.0.0 uninstall cleanly for the
installation of 2013.2.0.0 (KC)
----------------------------------------------------------------------
Message: 1
Date: Thu, 11 Apr 2013 16:08:07 +0300
From: Ovidiu D <[email protected]>
Subject: Re: [Haskell-beginners] haskell testing framework - missing
htfpp
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Message-ID:
<CAKVsE7sftJuMaOhcKB1eYeriGAer=cte9tb_xlhx-kqbyc6...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
The fact that I didn't get any reply does this mean that people don't
actually use HTF?
On Mon, Apr 8, 2013 at 12:39 PM, Ovidiu D <[email protected]> wrote:
> I'm trying to use HTF by following this tutorial:
> http://hackage.haskell.org/packages/archive/HTF/0.9.0.0/doc/html/Test-Framework-Tutorial.html
>
> and when I build the project I get the error:
> ghc: could not execute: htfpp
>
> I'm using:
> $ dpkg -l | grep haskell-platform
> ii haskell-platform
> 2012.2.0.0ubuntu1 all Standard Haskell
> libraries and tools
>
>
> What am I doing wrong?
>
> Thanks,
> ovidiu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130411/ffb58ff9/attachment-0001.htm>
------------------------------
Message: 2
Date: Thu, 11 Apr 2013 11:41:41 -0400
From: Brent Yorgey <[email protected]>
Subject: Re: [Haskell-beginners] More than one way to skin a cat
question - repeat
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii
On Thu, Apr 11, 2013 at 10:53:03AM +0100, Tom Davie wrote:
>
> On 11 Apr 2013, at 10:47, Benjamin Edwards <[email protected]> wrote:
>
> > (:) is O(1), (++) is O(n). Try and implement (++) and it should be easy to
> > see why.
> >
> (++) is O(n) in the length of it's first argument, which here is a constant
> 1, so it's O(1).
>
> That said, the book's implementation is *margionally* better. The
> implementation using (++) creates the list [x], and then destroys it
> again, and creates another one when it does the append. The version
> using (:) does not do this.
Note, however, that it's quite likely the compiler will optimize this
away and they will generate identical code. (Even if it doesn't, this
is hardly worth worrying about.) That said, the version with (:) is
indeed more idiomatic.
-Brent
------------------------------
Message: 3
Date: Thu, 11 Apr 2013 17:50:25 +0200
From: Chadda? Fouch? <[email protected]>
Subject: Re: [Haskell-beginners] haskell testing framework - missing
htfpp
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Message-ID:
<CANfjZRY0=OFfgK770NaXJ7TNbReMYNXmO7VxSJf4CyZuhEnm=w...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
More probably you should rather have asked this on Haskell-Cafe, it's not
really a beginner question. htfpp sounds like a pre processor : ghc can use
any preprocessor on your source (it often just use cpp), so what's the
message is saying is that htfpp is not on the PATH. Which probably means
you installed HTF locally and ~/.cabal/bin is not part of your PATH.
--
Jeda?
On Thu, Apr 11, 2013 at 3:08 PM, Ovidiu D <[email protected]> wrote:
> The fact that I didn't get any reply does this mean that people don't
> actually use HTF?
>
>
> On Mon, Apr 8, 2013 at 12:39 PM, Ovidiu D <[email protected]> wrote:
>
>> I'm trying to use HTF by following this tutorial:
>> http://hackage.haskell.org/packages/archive/HTF/0.9.0.0/doc/html/Test-Framework-Tutorial.html
>>
>> and when I build the project I get the error:
>> ghc: could not execute: htfpp
>>
>> I'm using:
>> $ dpkg -l | grep haskell-platform
>> ii haskell-platform
>> 2012.2.0.0ubuntu1 all Standard Haskell
>> libraries and tools
>>
>>
>> What am I doing wrong?
>>
>> Thanks,
>> ovidiu
>>
>
>
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130411/a37fb78d/attachment-0001.htm>
------------------------------
Message: 4
Date: Thu, 11 Apr 2013 17:59:10 +0200
From: "Kees Bleijenberg" <[email protected]>
Subject: [Haskell-beginners] FFI, export a ByteString
To: <[email protected]>
Message-ID: <001501ce36cd$8179ecd0$846dc670$@[email protected]>
Content-Type: text/plain; charset="us-ascii"
My function in Haskell takes a CString and returns a ByteString (of Word8).
I tried to put this function in a Haskell made Windows dll. I want to use
this function in a program written in C.
The most simple program that compiled was:
Import qualified B.ByteString as B
import Foreign.StablePtr
import Foreign.C.String
import Foreign.Ptr
foreign export stdcall parseRuitType :: CString -> IO (Ptr ())
parseRuitType s = do
p <- (newStablePtr ( B.pack [10,11,12]))
return $ castStablePtrToPtr p
For testing I ignore s.
In the C-program :
hs_init(NULL,NULL)
res = parseRuitType ("5" )
No errors, but the returned value res (or the dereferenced res) makes no
sense (not 10,11,12).
My idea was: the result of the function(a ByteString of Word8) must be
locked. No garbage collection. But newStablePtr does not return a pointer.
So I have to convert the newStablePtr to a real pointer and then coerce this
in the C program to a pointer to a array of word8.?
I've tried to return the ByteString in the Haskell function. But now the
compiler complains: Unacceptable result type in foreign declaration :
B.ByteString
I'am missing the big picture. Any ideas?
Greetings
Kees
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130411/b270bd47/attachment-0001.htm>
------------------------------
Message: 5
Date: Thu, 11 Apr 2013 19:55:14 +0300
From: Gesh <[email protected]>
Subject: Re: [Haskell-beginners] Haskell type definitions
To: The Haskell-Beginners Mailing List - Discussion of primarily
beginner-level topics related to Haskell <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Also, this syntax can be used in general to specify the type of a value.
i.e. a :: (c1,c2,...,cn) => t means that the name a has type t, where
the type that t represents is constrained by all the constraints ci.
e.g. foo :: (Num a, Ord b, Eq a) => (a,b) -> (a -> b) -> (b,b)
notes that the type of foo is a function from pairs of a and b to
functions from functions from a to b to pairs of a and b. However,
the a and b previously noted are subject to the constraints that:
- a must be an instance of Num and Eq
- b must be an instance of Ord
This is useful in many cases, which include:
- Documenting the type of a function
- Coercing a literal to a specific type (e.g. 23 :: Float)
- When checking type inference, using (undefined :: a) as a parameter
allows me to check types without having to invent some input
- When using type aliases and typeclasses, telling GHCi that your
expression has some type will either give you a type error or clean
up the type signature for your expression. e.g. :t "foo" is [Char],
but :t "foo" :: String is String, so you can check whether the more
concise type signature is also correct.
Best regards, and wishing you much enjoyment studying Haskell,
Gesh
------------------------------
Message: 6
Date: Thu, 11 Apr 2013 15:42:15 -0700
From: KC <[email protected]>
Subject: [Haskell-beginners] Will Haskell Platform 2012.4.0.0
uninstall cleanly for the installation of 2013.2.0.0
To: Haskell Beginners <[email protected]>, haskell-cafe
<[email protected]>
Message-ID:
<CAMLKXy=MO=o5e0mtlezujen2qf136khqwjxzb0dh_2khmtd...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
:)
--
--
Regards,
KC
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130411/d782e06c/attachment.htm>
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 58, Issue 24
*****************************************