Send Beginners mailing list submissions to
        beginners@haskell.org

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:  Not quite another Haskell tutorial, but ... (Hans van Thiel)
   2. Re:  Ensuring consistency in typeclass instances? (Brent Yorgey)
   3. Re:  Possible to update Haskell syntax (cm)
   4.  FFI, Foreign.Marshal.Array, etc. (Alexey Beshenov)
   5. Re:  FFI, Foreign.Marshal.Array, etc. (Alexey Beshenov)
   6.  Homework help (was Re: Help in Haskell) ([EMAIL PROTECTED])
   7. Re:  FFI, Foreign.Marshal.Array, etc. (Alexey Beshenov)
   8. Re:  Possible to update Haskell syntax (Brandon S. Allbery KF8NH)
   9.  Re: Homework help (was Re: Help in Haskell) (Benjamin L.Russell)


----------------------------------------------------------------------

Message: 1
Date: Wed, 26 Nov 2008 18:30:26 +0100
From: Hans van Thiel <[EMAIL PROTECTED]>
Subject: Re: [Haskell-beginners] Not quite another Haskell tutorial,
        but ...
To: Janis Voigtlaender <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED], beginners@haskell.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain


On Tue, 2008-11-25 at 13:37 +0100, Janis Voigtlaender wrote:
> ... I submitted my Habilitation thesis last week. The first few chapters
> of it try to give an introduction to Haskell with emphasis on types and
> reasoning principles. That might be an interesting read for some, so I
> made it accessible at http://wwwtcs.inf.tu-dresden.de/~voigt/habil.pdf.

I've downloaded it. Thanks!

Hans van Thiel



------------------------------

Message: 2
Date: Wed, 26 Nov 2008 15:04:00 -0500
From: Brent Yorgey <[EMAIL PROTECTED]>
Subject: Re: [Haskell-beginners] Ensuring consistency in typeclass
        instances?
To: beginners@haskell.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=us-ascii

On Wed, Nov 26, 2008 at 05:04:52PM +0000, Colin Paul Adams wrote:
> >>>>> "Brent" == Brent Yorgey <[EMAIL PROTECTED]> writes:
> 
> I don't see why. Eiffel is strongly typed too. But current compiler
> technology doesn't necessarily permit us to check all we would like
> statically (as you say below).
> 
> It seems to me, having read further, that QuickCheck does just this
> (and is an answer to my own original question). 

True, I should have mentioned QuickCheck in my previous email.  It's
not *quite* the same thing -- in particular, it tests properties you
specify on randomly generated values, rather than testing the actual
values which occur at runtime.  But in many cases that's just as good,
and has the additional benefit that it separates the property testing
from execution -- so you can have confidence in certain semantic
properties without the possibility of run-time exceptions.

-Brent


------------------------------

Message: 3
Date: Wed, 26 Nov 2008 12:27:47 -0800
From: "cm" <[EMAIL PROTECTED]>
Subject: Re: [Haskell-beginners] Possible to update Haskell syntax
To: <beginners@haskell.org>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="utf-8"

Thanks to Tillman Rendel for describing some of the philosphy behind Haskell 
syntax and for Brent Yorgey and Michael Snoyman for suggesting how the Haskell 
language itself could be used to produce a cleaner input syntax.  The 
multi-variable input functions are definitely of interest (but I have to 
understand how they work).

On another line of thought, I've always liked the syntax of the old PostScript 
language.  It then ocurred to me to search on the words "haskell postfix 
notation", and, naturally, someone in the Haskell world has considered this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20081126/176e4937/attachment-0001.htm

------------------------------

Message: 4
Date: Wed, 26 Nov 2008 23:32:58 +0300
From: Alexey Beshenov <[EMAIL PROTECTED]>
Subject: [Haskell-beginners] FFI, Foreign.Marshal.Array, etc.
To: beginners@haskell.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain;  charset="koi8-r"

Hi!

I'm playing with the FFI.
Could anyone help me with a practical example?

I have a function

  int solve_sys (double **a, int n, double b[]);

where a is an array of size n*n and b is an array of size n
(it contains the needed result if solve_sys returns 0).

How could I wrap it in something like

  solveSys :: [[Double]] -> [Double] -> [Double]

?

-- 
Setting Orange, Aftermath 38 YOLD 3174
Alexey Beshenov  http://beshenov.ru/



------------------------------

Message: 5
Date: Thu, 27 Nov 2008 01:16:17 +0300
From: Alexey Beshenov <[EMAIL PROTECTED]>
Subject: Re: [Haskell-beginners] FFI, Foreign.Marshal.Array, etc.
To: beginners@haskell.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain;  charset="koi8-r"

On Wednesday 26 November 2008 23:32:58 Alexey Beshenov wrote:
> Hi!
>
> I'm playing with the FFI.
> Could anyone help me with a practical example?
>
> I have a function
>
>   int solve_sys (double **a, int n, double b[]);
>
> where a is an array of size n*n and b is an array of size n
> (it contains the needed result if solve_sys returns 0).
>
> How could I wrap it in something like
>
>   solveSys :: [[Double]] -> [Double] -> [Double]
>
> ?

Something like this:

foreign import ccall "linear.h solve_sys" lSolve :: Ptr (Double) -> 
Int -> Ptr (Double) -> IO (Int)

solveSys :: [[Double]] -> [Double] -> IO()
solveSys a b = do
                  aptr <- newArray (concat a)
                  bptr <- newArray b
                  sol <- lSolve aptr n bptr
                  x <- peekArray n bptr
                  free aptr
                  free bptr
                  print x
               where n = length a

Does the trick, but I wonder is there a way to get a function 
returning [Double]...

-- 
Setting Orange, Aftermath 38 YOLD 3174
Alexey Beshenov  http://beshenov.ru/



------------------------------

Message: 6
Date: Wed, 26 Nov 2008 18:18:45 -0500
From: [EMAIL PROTECTED]
Subject: [Haskell-beginners] Homework help (was Re: Help in Haskell)
To: beginners@haskell.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain;       charset=ISO-8859-1;     DelSp="Yes";
        format="flowed"

G'day Benjamin.

Quoting "Benjamin L.Russell" <[EMAIL PROTECTED]>:

> As such, first, please follow the homework help procedure outlined in
> "Homework help - HaskellWiki" (see
> http://www.haskell.org/haskellwiki/Homework_help) (substitute
> "haskell-beginners or haskell-cafe" for "haskell-cafe," and just
> ignore the part about the existence of "stupid questions"--there is no
> such thing as a "stupid question"; however, there are such things as
> appropriate questions and inappropriate questions, and in order for us
> to help you appropriately in this context, you need to show us more
> specifically what you have done and where you are stuck, so that we
> can provide help that would be appropriate in this context).

It's a wiki.  If the wording is bad, fix it!

Cheers,
Andrew Bromage


------------------------------

Message: 7
Date: Thu, 27 Nov 2008 02:40:56 +0300
From: Alexey Beshenov <[EMAIL PROTECTED]>
Subject: Re: [Haskell-beginners] FFI, Foreign.Marshal.Array, etc.
To: beginners@haskell.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain;  charset="koi8-r"

On Thursday 27 November 2008 01:16:17 Alexey Beshenov wrote:
> Something like this:
>
> foreign import ccall "linear.h solve_sys" lSolve :: Ptr (Double) ->
> Int -> Ptr (Double) -> IO (Int)
>
> solveSys :: [[Double]] -> [Double] -> IO()
> solveSys a b = do
>                   aptr <- newArray (concat a)
>                   bptr <- newArray b
>                   sol <- lSolve aptr n bptr
>                   x <- peekArray n bptr
>                   free aptr
>                   free bptr
>                   print x
>                where n = length a
>
> Does the trick, but I wonder is there a way to get a function
> returning [Double]...

Eh, I have to do unsafePerformIO.

Sorry about that, I'm quite new to Haskell :-I

-- 
Setting Orange, Aftermath 38 YOLD 3174
Alexey Beshenov  http://beshenov.ru/



------------------------------

Message: 8
Date: Thu, 27 Nov 2008 01:03:21 -0500
From: "Brandon S. Allbery KF8NH" <[EMAIL PROTECTED]>
Subject: Re: [Haskell-beginners] Possible to update Haskell syntax
To: cm <[EMAIL PROTECTED]>
Cc: beginners@haskell.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="us-ascii"

On 2008 Nov 26, at 15:27, cm wrote:
> On another line of thought, I've always liked the syntax of the old  
> PostScript language.  It then ocurred to me to search on the words  
> "haskell postfix notation", and, naturally, someone in the Haskell  
> world has considered this.

Have you ever looked at Forth?

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon university    KF8NH


-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20081127/42981e15/attachment-0001.htm

------------------------------

Message: 9
Date: Thu, 27 Nov 2008 16:44:34 +0900
From: Benjamin L.Russell <[EMAIL PROTECTED]>
Subject: [Haskell-beginners] Re: Homework help (was Re: Help in
        Haskell)
To: beginners@haskell.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=us-ascii

On Wed, 26 Nov 2008 18:18:45 -0500, [EMAIL PROTECTED] wrote:

>G'day Benjamin.
>
>Quoting "Benjamin L.Russell" <[EMAIL PROTECTED]>:
>
>> As such, first, please follow the homework help procedure outlined in
>> "Homework help - HaskellWiki" (see
>> http://www.haskell.org/haskellwiki/Homework_help) (substitute
>> "haskell-beginners or haskell-cafe" for "haskell-cafe," and just
>> ignore the part about the existence of "stupid questions"--there is no
>> such thing as a "stupid question"; however, there are such things as
>> appropriate questions and inappropriate questions, and in order for us
>> to help you appropriately in this context, you need to show us more
>> specifically what you have done and where you are stuck, so that we
>> can provide help that would be appropriate in this context).
>
>It's a wiki.  If the wording is bad, fix it!

Actually, initially I had to fight the urge not to rewrite it in a
less elitist manner, in order to avoid the possibility of offending
the original author.

In fact, I had been thinking about changing that page since about
December of 2007, when I think I first saw it, but had hesitated out
of a concern that doing so would have gone against the intent of the
original author of that page.  On a related issue, I had previously
encountered a number of participants on Haskell-Cafe who had reacted
negatively against what they apparently thought were "stupid
questions":  One of them even asked (in private e-mail) that a
participant not "pollute" Haskell-Cafe by asking about whether screen
resolution was important in determining the precision of an algorithm
to compute prime numbers by picking points randomly from a square.  

I refrained from changing the page because of the possibility that the
original author may have been an elitist, who could have changed it
back immediately.

Part of my original purpose in suggesting the creation of
Haskell-Beginners was to create a more non-elitist, beginner-friendly
atmosphere.

More specifically, since HaskellWiki is also visible to participants
on Haskell-Cafe, and not just to those on Haskell-Beginners, if I
changed the original intent of the sentence by rephrasing the
following sentence (see
http://www.haskell.org/haskellwiki/Homework_help):

>Your lecturer/instructor may have told you that there is no such thing as a 
>stupid question. Inside your classroom, that is correct. Outside your 
>classroom, there are smart questions and stupid questions. If you ask a smart 
>question of the Haskell community, you will probably get a helpful answer. If 
>you ask a stupid question, you will probably get an unhelpful answer or, more 
>likely, no answer at all. 

to the following sentence:

>Your lecturer/instructor may have told you that there is no such thing as a 
>stupid question. Indeed, that is correct. However, independent of the context, 
>there are appropriate questions and inappropriate questions. If you first 
>attempt to solve a problem with a decent amount of effort, then get stuck, and 
>then ask for a hint from the Haskell community, your question will most likely 
>be viewed as appropriate, and you will probably get a helpful answer. If you 
>do not attempt to solve the problem, but try to get somebody else to solve the 
>entire problem for you, your question will most likely be viewed as 
>inappropriate, and you will probably get an unhelpful answer or, more likely, 
>no answer at all. 

I could have risked going against the cultural attitude of the
original author, who had deliberately used the pejorative term "stupid
question."  The term "stupid" has certain condescending connotations
that are not suggested by the relatively neutral term "inappropriate."
Perhaps those connotations had actually been deliberate, and not
coincidental, in which case changing the connotations could have
started a revision war, which I didn't want.

I disagree with the cultural attitude suggested by the term "stupid
question."  To me, there is no such thing as a "stupid question."  If
somebody asks an inappropriate question, it should be sufficient just
not to answer the question, or to suggest an alternative question,
rather than to respond in a hostile or condescending manner.

Nevertheless, this is just my personal opinion.  Everybody is entitled
to an opinion.  I didn't change the original wording, even though I
had to fight a desperate urge to do so, because I had thought that the
original author had just as much right to his/her wording as I did to
mine, and I wasn't sure if possibly changing the original intent, as
opposed to just the original wording, was appropriate.  However, if I
had been the original author, I would have definitely worded the
sentence in a less elitist manner.

-- Benjamin L. Russell



------------------------------

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 5, Issue 16
****************************************

Reply via email to