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:  TLS with RSA_PSK (Friedrich Wiemer)
   2.  pattern matching on function names or algebraic  type data
      constructors (TP)


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

Message: 1
Date: Sat, 22 Jun 2013 19:57:29 +0200
From: Friedrich Wiemer <[email protected]>
Subject: Re: [Haskell-beginners] TLS with RSA_PSK
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1

Thanks Brent and Patrick,
I'll try the GnuTLS wrapper.

And wasn't shure about which mailing list, but thanks for answering!

On 06/21/13 20:17, Patrick Mylund Nielsen wrote:
> The GnuTLS wrapper seems to support TLS-PSK (with or without DHE):
> http://hackage.haskell.org/packages/archive/hsgnutls/0.2.3.2/doc/html/Network-GnuTLS.html
>
> 
> 
> On Tue, Jun 18, 2013 at 5:37 AM, Friedrich Wiemer 
> <[email protected] <mailto:[email protected]>>
> wrote:
> 
> Hey,
> 
> is it possible to use RSA_PSK as a TLS-ciphersuit in any TLS
> library? I didnt found such a ciphersuit in Network.TLS.
> 
> Thanks in advance, Friedrich
> 
> _______________________________________________ Beginners mailing
> list [email protected] <mailto:[email protected]> 
> http://www.haskell.org/mailman/listinfo/beginners
> 
> 
> 
> 
> _______________________________________________ Beginners mailing
> list [email protected] 
> http://www.haskell.org/mailman/listinfo/beginners
> 



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

Message: 2
Date: Sun, 23 Jun 2013 11:34:41 +0200
From: TP <[email protected]>
Subject: [Haskell-beginners] pattern matching on function names or
        algebraic       type data constructors
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="ISO-8859-1"

Hi,

I ask myself if there is a way to make the following code work.
I would like to pattern match on function names:

-----------
f :: Float -> Int
f x = 1

g :: Float -> Int
g x = 2

pat :: (Float -> Int) -> Bool
pat t = case t of
        f -> True
        g -> False

main = do

print $ pat f
print $ pat g
-----------

I don't understand the output:

-----------
$ runghc test_pattern_match_on_function_2.hs 

test_pattern_match_on_function_2.hs:8:9: Warning:
    Pattern match(es) are overlapped
    In a case alternative: g -> ...
True
True
-----------

What is the reason for this message?

Now, I want to do it on data constructors in a GADT (which are functions if 
I am right):
-----------
{-# LANGUAGE GADTs #-}

data Foobar where
    Mult :: Float -> Foobar
    Plus :: Float -> Foobar

pat :: (Float -> Foobar) -> Bool
pat t = case t of
        Mult -> True
        Plus -> False

main = do

print $ pat Mult
print $ pat Plus
-----------

I obtain:

-----------
$ runghc test_pattern_match_on_function.hs 

test_pattern_match_on_function.hs:9:9:
    Constructor `Mult' should have 1 argument, but has been given none
    In the pattern: Mult
    In a case alternative: Mult -> True
    In the expression:
      case t of {
        Mult -> True
        Plus -> False }

test_pattern_match_on_function.hs:9:9:
    Couldn't match expected type `Float -> Foobar'
                with actual type `Foobar'
    In the pattern: Mult
    In a case alternative: Mult -> True
    In the expression:
      case t of {
        Mult -> True
        Plus -> False }
-----------

Why does it not work? If Mult and Plus are functions, then I should not need 
to put their arguments in pattern matching.

Thanks in advance,

TP




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

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 60, Issue 34
*****************************************

Reply via email to