[Haskell-cafe] Statically tracking validity - suggestions?

2010-08-31 Thread strejon

Hello. I'm using Haskell to write a specification for some software. The
software uses certificates (standard X.509 certificates) and stores user
name information in the Subject's CommonName field.

The X.509 standard doesn't actually require the presence of a CommonName
field so the contents of the Subject section (with the rest of the fields
omitted) are just represented by a Maybe User_Name.

 import Data.List (find, concat)
 import Data.Maybe (fromJust, isJust)

 type User_Name= String
 type Public_Key   = Integer
 data Subject_Name = Subject_Name (Maybe User_Name) deriving (Show, Eq)

 data Certificate = Certificate {
   certificate_subject :: Subject_Name,
   certificate_key :: Public_Key,
   certificate_issuer  :: String,
   certificate_serial  :: Integer
 } deriving (Show, Eq)

This is all well and good, but the problem is that the validity of
certificates isn't tracked statically and I have to use the following
as guards on all functions that only expect valid certificates (and
inevitably handle cases that I know can't actually happen but
have to be handled in pattern matching and the like, bloating
the specification):

 user_name :: Subject_Name - Maybe User_Name
 user_name (Subject_Name name) = name

 is_valid :: Certificate - Bool
 is_valid = isJust . user_name . certificate_subject

I'm aware of phantom types and the like, but I've been unable to
work out how to use them (or another type system extension)
to properly track validity on the type level. I'd want something
like:

validate :: Certificate Possibly_Valid - Maybe (Certificate Valid)

With later functions only accepting values of type Certificate Valid.

Is there a simple way to do this?
-- 
View this message in context: 
http://old.nabble.com/Statically-tracking-%22validity%22---suggestions--tp29579872p29579872.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

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


Re: [Haskell-cafe] Statically tracking validity - suggestions?

2010-08-31 Thread Chris Eidhof
On 31 aug 2010, at 08:24, strejon wrote:

 
 Hello. I'm using Haskell to write a specification for some software. The
 software uses certificates (standard X.509 certificates) and stores user
 name information in the Subject's CommonName field.
 
 The X.509 standard doesn't actually require the presence of a CommonName
 field so the contents of the Subject section (with the rest of the fields
 omitted) are just represented by a Maybe User_Name.
 
 import Data.List (find, concat)
 import Data.Maybe (fromJust, isJust)
 
 type User_Name= String
 type Public_Key   = Integer
 data Subject_Name = Subject_Name (Maybe User_Name) deriving (Show, Eq)
 
 data Certificate = Certificate {
  certificate_subject :: Subject_Name,
  certificate_key :: Public_Key,
  certificate_issuer  :: String,
  certificate_serial  :: Integer
 } deriving (Show, Eq)
 
 This is all well and good, but the problem is that the validity of
 certificates isn't tracked statically and I have to use the following
 as guards on all functions that only expect valid certificates (and
 inevitably handle cases that I know can't actually happen but
 have to be handled in pattern matching and the like, bloating
 the specification):
 
 user_name :: Subject_Name - Maybe User_Name
 user_name (Subject_Name name) = name
 
 is_valid :: Certificate - Bool
 is_valid = isJust . user_name . certificate_subject
 
 I'm aware of phantom types and the like, but I've been unable to
 work out how to use them (or another type system extension)
 to properly track validity on the type level. I'd want something
 like:
 
 validate :: Certificate Possibly_Valid - Maybe (Certificate Valid)
 
 With later functions only accepting values of type Certificate Valid.
 
 Is there a simple way to do this?

Yes. Introduce a wrapper datatype, ValidCertificate. Create a module and export 
only the wrapper datatype and a way to construct ValidCertificates in a safe 
way:

 module ValidateCertificate 
   ( ValidCertificate,
 fromValidCertificate,
 createValidCertificate
   ) where
 
 data ValidCertificate = ValidCertificate {fromValidCertificate :: Certificate}
 
 createValidCertificate :: Certificate - Maybe ValidCertificate
 createValidCertificate c | is_valid c = Just (ValidCertificate c)
  | otherwise  = Nothing
 
 is_valid :: Certificate - Bool
 is_valid = isJust . user_name . certificate_subject

The trick is not to export the constructor, but only a verified way to 
construct values of ValidCertificate.

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


Re: [Haskell-cafe] Statically tracking validity - suggestions?

2010-08-31 Thread Erik Hesselink
On Tue, Aug 31, 2010 at 08:24, strejon strej...@yahoo.com wrote:

 Hello. I'm using Haskell to write a specification for some software. The
 software uses certificates (standard X.509 certificates) and stores user
 name information in the Subject's CommonName field.

 The X.509 standard doesn't actually require the presence of a CommonName
 field so the contents of the Subject section (with the rest of the fields
 omitted) are just represented by a Maybe User_Name.

 import Data.List (find, concat)
 import Data.Maybe (fromJust, isJust)

 type User_Name    = String
 type Public_Key   = Integer
 data Subject_Name = Subject_Name (Maybe User_Name) deriving (Show, Eq)

 data Certificate = Certificate {
   certificate_subject :: Subject_Name,
   certificate_key     :: Public_Key,
   certificate_issuer  :: String,
   certificate_serial  :: Integer
 } deriving (Show, Eq)

 This is all well and good, but the problem is that the validity of
 certificates isn't tracked statically and I have to use the following
 as guards on all functions that only expect valid certificates (and
 inevitably handle cases that I know can't actually happen but
 have to be handled in pattern matching and the like, bloating
 the specification):

 user_name :: Subject_Name - Maybe User_Name
 user_name (Subject_Name name) = name

 is_valid :: Certificate - Bool
 is_valid = isJust . user_name . certificate_subject

 I'm aware of phantom types and the like, but I've been unable to
 work out how to use them (or another type system extension)
 to properly track validity on the type level. I'd want something
 like:

 validate :: Certificate Possibly_Valid - Maybe (Certificate Valid)

 With later functions only accepting values of type Certificate Valid.

 Is there a simple way to do this?

If you want to use types instead of modules and hiding as Chris
suggested, you can use a type index like this:

{-# LANGUAGE EmptyDataDecls, GADTs, KindSignatures #-}
data Nothing
data Just a

data Subject :: * - * where
  NoName :: Subject Nothing
  Name   :: String - Subject (Just String)

data Certificate a = Certificate
  { subject :: Subject a }

validate :: Certificate a - Maybe (Certificate (Just String))
validate c =
  case subject c of
NoName - Nothing
Name n - Just c

A Certificate (Just String) now always holds a name, and a
Certificate Nothing doesn't. A Certificate a can hold either.

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


Re: [Haskell-cafe] open and closed

2010-08-31 Thread Gábor Lehel
On Mon, Aug 30, 2010 at 1:23 PM, wren ng thornton w...@freegeek.org wrote:
 On 8/29/10 1:33 PM, Gábor Lehel wrote:

 Another thing I'm wondering about is that there's a fairly intuitive
 correspondence between functions at the value level vs. functions at
 the type level, and datatypes to classify the value level vs.
 datakinds to classify the type level, but what corresponds to type
 classes at the value level?

 Wouldn't you go the other way: kind classes? Type classes are predicates on
 types, and the application of a class to a type forms a proposition which
 represents the type of proofs that the proposition holds (i.e., the type of
 instance dictionaries). This can be easily extended upwards by having
 predicates on kinds yielding propositions that represent the kinds of
 (type-level) proofs. IIRC, this is the perspective that Omega takes.

 To extend it downward we'd have to ask what it would mean to have a
 predicate on values. The value-level propositions formed by applying those
 predicates couldn't have proofs (because there is no sub-value level), so
 it's not entirely clear what that would mean. If anything, the value-level
 correspondent of type classes are just uninterpreted predicates, i.e. data
 constructors. Whether this line of thinking is sensible or just a fallacious
 attempt to unify everything, I can't say off hand.

 I think it's better to think of contexts as the type of the invisible lambda
 for passing dictionaries, just as forall is the type of (the invisible)
 big-lambda, and - is the type of lambda. Thus, the dictionaries are the
 concrete thing you want to generalize to higher levels; the classes will be
 at the next level up.

Hmm, I see. I think what had me confused was that type classes seem to
be at the same level as types, and, like functions, to interact with
things at their own level; but then they also interact with something
from one level lower (instance dictionaries), which is why it doesn't
make sense to transplant them to the lowest level (values). Thanks for
the explanation!



 --
 Live well,
 ~wren
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




-- 
Work is punishment for failing to procrastinate effectively.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Statically tracking validity - suggestions?

2010-08-31 Thread strejon


Erik Hesselink wrote:
 
 If you want to use types instead of modules and hiding as Chris
 suggested, you can use a type index like this:
 
 {-# LANGUAGE EmptyDataDecls, GADTs, KindSignatures #-}
 data Nothing
 data Just a
 
 data Subject :: * - * where
   NoName :: Subject Nothing
   Name   :: String - Subject (Just String)
 
 data Certificate a = Certificate
   { subject :: Subject a }
 
 validate :: Certificate a - Maybe (Certificate (Just String))
 validate c =
   case subject c of
 NoName - Nothing
 Name n - Just c
 
 A Certificate (Just String) now always holds a name, and a
 Certificate Nothing doesn't. A Certificate a can hold either.
 
 Erik
 

Thanks, both of you. The GADT version seems slightly easier
to work with in our case.

-- 
View this message in context: 
http://old.nabble.com/Statically-tracking-%22validity%22---suggestions--tp29579872p29581285.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

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


Re: [Haskell-cafe] Statically tracking validity - suggestions?

2010-08-31 Thread Luke Palmer
I have a description of the design pattern you need, appropriately
named: http://lukepalmer.wordpress.com/2009/03/24/certificate-design-pattern/

On Tue, Aug 31, 2010 at 12:24 AM, strejon strej...@yahoo.com wrote:

 Hello. I'm using Haskell to write a specification for some software. The
 software uses certificates (standard X.509 certificates) and stores user
 name information in the Subject's CommonName field.

 The X.509 standard doesn't actually require the presence of a CommonName
 field so the contents of the Subject section (with the rest of the fields
 omitted) are just represented by a Maybe User_Name.

 import Data.List (find, concat)
 import Data.Maybe (fromJust, isJust)

 type User_Name    = String
 type Public_Key   = Integer
 data Subject_Name = Subject_Name (Maybe User_Name) deriving (Show, Eq)

 data Certificate = Certificate {
   certificate_subject :: Subject_Name,
   certificate_key     :: Public_Key,
   certificate_issuer  :: String,
   certificate_serial  :: Integer
 } deriving (Show, Eq)

 This is all well and good, but the problem is that the validity of
 certificates isn't tracked statically and I have to use the following
 as guards on all functions that only expect valid certificates (and
 inevitably handle cases that I know can't actually happen but
 have to be handled in pattern matching and the like, bloating
 the specification):

 user_name :: Subject_Name - Maybe User_Name
 user_name (Subject_Name name) = name

 is_valid :: Certificate - Bool
 is_valid = isJust . user_name . certificate_subject

 I'm aware of phantom types and the like, but I've been unable to
 work out how to use them (or another type system extension)
 to properly track validity on the type level. I'd want something
 like:

 validate :: Certificate Possibly_Valid - Maybe (Certificate Valid)

 With later functions only accepting values of type Certificate Valid.

 Is there a simple way to do this?
 --
 View this message in context: 
 http://old.nabble.com/Statically-tracking-%22validity%22---suggestions--tp29579872p29579872.html
 Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.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


Re: [Haskell-cafe] Quick Question for QuickCheck2

2010-08-31 Thread Lyndon Maydwell
ghc-pkg check doesn't list any broken dependencies.

On Tue, Aug 31, 2010 at 9:27 AM, Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com wrote:
 On 31 August 2010 03:18, Lyndon Maydwell maydw...@gmail.com wrote:
 Thanks!

 This makes perfect sense, but as I just discovered using ghci -v there
 is an even stranger problem. I'm side-tracking slightly from the
 original question here, but nevertheless...

 GHC gives the following output:

 ---
 GHCi, version 6.12.3: http://www.haskell.org/ghc/  :? for help
 command line: cannot satisfy -package QuickCheck-2.1.1.1:
    QuickCheck-2.1.1.1-c7435cb0d5b5de72fe9540c48335606d is unusable
 due to missing or recursive dependencies:
      ghc-6.12.3-66a382195c8a71849653439b67021fd1
    (use -v for more information)

 shell returned 1

 What does ghc-pkg check say?

 To me, it sounds like you upgraded a boot library, which is a big no-no.

 (The ghc mentioned here is the ghc library, not the compiler itself.)

 --
 Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com
 IvanMiljenovic.wordpress.com

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


Re: [Haskell-cafe] Slightly humorous: Headhunters toolbox (example for Germany)

2010-08-31 Thread Henk-Jan van Tuyl
On Sat, 28 Aug 2010 00:45:23 +0200, sylvain sylvain.na...@googlemail.com  
wrote:



Apart the programming language, I have encountered this term only as a
family name. I would find interesting to know if there is a language in
which this word exists and has yet another meaning.



It is amongst others the name of a city in Arkansas, several counties in  
the USA, the first name of Haskell B. Curry and it occurs in the name of  
shops, like Haskell's . There are several street names, like Haskell  
Street, Haskell Lane, Haskell Avenue. Try Google earth, it list nine  
locations with Haskell in the name. Furthermore, there are the Haskell  
Free Library and Opera House, the Haskell Indian Nations University,  
the Haskell Invitational Handicap and the Haskell Oriental Museum.


Regards,
Henk-Jan van Tuyl


--
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
--
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Quick Question for QuickCheck2

2010-08-31 Thread Ivan Lazar Miljenovic
On 31 August 2010 20:38, Lyndon Maydwell maydw...@gmail.com wrote:
 ghc-pkg check doesn't list any broken dependencies.

You sure this is with the same user?  ghci is unlikely to complain
about broken libraries if ghc-pkg check doesn't...

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANNOUNCE: iteratee-compress 0.1

2010-08-31 Thread Maciej Piechotka
Iteratee-compress provides compressing and decompressing enumerators.
Currently only gzip is provided but at least bzip is planned.

Additionally more fine-control over stream (i.e. flushing) is planned.


Library currently depends on zlib haskell library only for sharing
parameters data. However no zlib function is called (the needed
functions are not exported) and the symbols it uses from necessity are
deprecated. Would it be better to copy the parameters from zlib and drop
the dependency?

Please note also that the library do not bundle zlib (C) as zlib
(Haskell) do.


signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Quick Question for QuickCheck2

2010-08-31 Thread Lyndon Maydwell
Yep. Definitely the same user.

On Tue, Aug 31, 2010 at 7:35 PM, Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com wrote:
 On 31 August 2010 20:38, Lyndon Maydwell maydw...@gmail.com wrote:
 ghc-pkg check doesn't list any broken dependencies.

 You sure this is with the same user?  ghci is unlikely to complain
 about broken libraries if ghc-pkg check doesn't...

 --
 Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com
 IvanMiljenovic.wordpress.com

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


[Haskell-cafe] :Trace has no history

2010-08-31 Thread Steve
I am trying to debug a problem in GHCI. I invoke my method with trace
but when it breaks on exception i can't get this history. Output is
below. Thanks.


relude Symbols :set -fbreak-on-exception
Prelude Symbols :trace myMethod
Loading package HUnit-1.2.2.1 ... linking ... done.
Loading package syb-0.1.0.2 ... linking ... done.
Loading package base-3.0.3.2 ... linking ... done.
Loading package old-locale-1.0.0.2 ... linking ... done.
Loading package time-1.1.4 ... linking ... done.
Loading package random-1.0.0.2 ... linking ... done.
Loading package QuickCheck-1.2.0.0 ... linking ... done.
Loading package Decimal-0.1.0 ... linking ... done.
Loading package array-0.3.0.0 ... linking ... done.
Loading package Diff-0.1.2 ... linking ... done.
Loading package bytestring-0.9.1.5 ... linking ... done.
Loading package containers-0.3.0.0 ... linking ... done.
Loading package mtl-1.1.0.2 ... linking ... done.
Loading package old-time-1.0.0.3 ... linking ... done.
Loading package convertible-1.0.9 ... linking ... done.
Loading package utf8-string-0.3.4 ... linking ... done.
Loading package HDBC-2.2.6 ... linking ... done.
Loading package HDBC-mysql-0.6.3 ... linking ... done.
Loading package parsec-2.1.0.1 ... linking ... done.
Loading package network-2.2.1.7 ... linking ... done.
Loading package HTTP-4000.0.9 ... linking ... done.
Loading package binary-0.5.0.2 ... linking ... done.
Loading package digest-0.0.0.8 ... linking ... done.
Loading package filepath-1.1.0.3 ... linking ... done.
Loading package unix-2.4.0.0 ... linking ... done.
Loading package directory-1.0.1.0 ... linking ... done.
Loading package pretty-1.0.1.1 ... linking ... done.
Loading package zlib-0.5.2.0 ... linking ... done.
Loading package zip-archive-0.1.1.6 ... linking ... done.
Loading package Core-0.0.1 ... linking ... done.
Beginning Update
Stopped at exception thrown
_exception ::
 e = GHC.Exception.SomeException (GHC.Exception.D:Exception _

(GHC.Show.D:Show ...) )
 (GHC.IO.Exception.IOError Nothing
GHC.IO.Exception.UserError )
[exception thrown] Prelude Symbols :history
Empty history. Perhaps you forgot to use :trace?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Searching for Haskell (was: [Haskell-cafe] Slightly humorous: Headhunters toolbox (example for Germany))

2010-08-31 Thread Henk-Jan van Tuyl
On Tue, 31 Aug 2010 13:57:42 +0200, Alberto G. Corona   
agocor...@gmail.com wrote:



Entering  haskell  language  instead of haskell the ambiguity
dissapears. Then, Jamaica no longer appears in the crude reality . The
weigth of USA is hides all other country here.

I think that a more appropriate term  to look for  haskell interest is
monad although it may catch some crazy philosophers too. The result is
interesting,



You can still get things like a page titled Ben Haskell - Language  
Technologies Institute - Carnegie Mellon, and of course, not all pages  
about the programming language contain the word language. To get proper  
results you would need a good semantic search engine, but these search  
engines seem to be in early research stage.


Regards,
Henk-Jan van Tuyl


--
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
--
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Slightly humorous: Headhunters toolbox (example for Germany)

2010-08-31 Thread Henk-Jan van Tuyl

On Sat, 28 Aug 2010 00:45:23 +0200, sylvain sylvain.na...@googlemail.com
wrote:


Apart the programming language, I have encountered this term only as a
family name. I would find interesting to know if there is a language in
which this word exists and has yet another meaning.



It is amongst others the name of a city in Arkansas, several counties in
the USA, the first name of Haskell B. Curry and it occurs in the name of
shops, like Haskell's . There are several street names, like Haskell
Street, Haskell Lane, Haskell Avenue. Try Google earth, it list nine
locations with Haskell in the name. Furthermore, there are the Haskell
Free Library and Opera House, the Haskell Indian Nations University,
the Haskell Invitational Handicap and the Haskell Oriental Museum.

Regards,
Henk-Jan van Tuyl


--
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
--
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Quick Question for QuickCheck2

2010-08-31 Thread Sebastian Höhn

Do you have ~/.cabal/bin/ in your PATH?

- Sebastian

Am 31.08.2010 um 15:57 schrieb Lyndon Maydwell:

 Yep. Definitely the same user.
 
 On Tue, Aug 31, 2010 at 7:35 PM, Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com wrote:
 On 31 August 2010 20:38, Lyndon Maydwell maydw...@gmail.com wrote:
 ghc-pkg check doesn't list any broken dependencies.
 
 You sure this is with the same user?  ghci is unlikely to complain
 about broken libraries if ghc-pkg check doesn't...
 
 --
 Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com
 IvanMiljenovic.wordpress.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] On to applicative

2010-08-31 Thread michael rice
Learn You a Haskell ...  says that (-) is a type just like Either. Where can 
I find its type definition?

Michael



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


Re: [Haskell-cafe] On to applicative

2010-08-31 Thread Vo Minh Thu
2010/8/31 michael rice nowg...@yahoo.com

 Learn You a Haskell ...  says that (-) is a type just like Either. Where 
 can I find its type definition?

You can't define it *in* Haskell as user code. It is a built-in infix
type constructor (Either or Maybe are type constructors too, not just
types). In fact, if you want to implement a simple, typed functional
language, you'll find it is the only built-in type constructor you
have to implement (as the implementor of the language).

Also,
  Show a = a
is a type too, but you won't find a definition for 'a' or for '='.
All those things are defined by the language.

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


Re: [Haskell-cafe] On to applicative

2010-08-31 Thread michael rice
So it's a type constructor, not a type? Could you please provide a simple 
example of its usage?

Michael

--- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote:

From: Vo Minh Thu not...@gmail.com
Subject: Re: [Haskell-cafe] On to applicative
To: michael rice nowg...@yahoo.com
Cc: haskell-cafe@haskell.org
Date: Tuesday, August 31, 2010, 1:17 PM

2010/8/31 michael rice nowg...@yahoo.com

 Learn You a Haskell ...  says that (-) is a type just like Either. Where 
 can I find its type definition?

You can't define it *in* Haskell as user code. It is a built-in infix
type constructor (Either or Maybe are type constructors too, not just
types). In fact, if you want to implement a simple, typed functional
language, you'll find it is the only built-in type constructor you
have to implement (as the implementor of the language).

Also,
  Show a = a
is a type too, but you won't find a definition for 'a' or for '='.
All those things are defined by the language.

Cheers,
Thu



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


Re: [Haskell-cafe] Quick Question for QuickCheck2

2010-08-31 Thread Lyndon Maydwell
Yep :)

Is there a batch of information that might be useful? I can send any
relevant files, aliases, versions, etc at once to help if you like.

On Wed, Sep 1, 2010 at 12:35 AM, Sebastian Höhn
sebastian.ho...@iig.uni-freiburg.de wrote:

 Do you have ~/.cabal/bin/ in your PATH?

 - Sebastian

 Am 31.08.2010 um 15:57 schrieb Lyndon Maydwell:

 Yep. Definitely the same user.

 On Tue, Aug 31, 2010 at 7:35 PM, Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com wrote:
 On 31 August 2010 20:38, Lyndon Maydwell maydw...@gmail.com wrote:
 ghc-pkg check doesn't list any broken dependencies.

 You sure this is with the same user?  ghci is unlikely to complain
 about broken libraries if ghc-pkg check doesn't...

 --
 Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com
 IvanMiljenovic.wordpress.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 mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re[2]: [Haskell-cafe] On to applicative

2010-08-31 Thread Bulat Ziganshin
Hello michael,

Tuesday, August 31, 2010, 9:27:17 PM, you wrote:

f :: Int - Int

i.e. it's used when you define function types

 So it's a type constructor, not a type? Could you please provide a simple 
 example of its usage?

 Michael

 --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote:

 From: Vo Minh Thu not...@gmail.com
 Subject: Re: [Haskell-cafe] On to applicative
 To: michael rice nowg...@yahoo.com
 Cc: haskell-cafe@haskell.org
 Date: Tuesday, August 31, 2010, 1:17 PM

 2010/8/31 michael rice nowg...@yahoo.com

 Learn You a Haskell ...  says that (-) is a type just like Either. Where 
 can I find its type definition?

 You can't define it *in* Haskell as user code. It is a  built-in infix
 type constructor (Either or Maybe are type constructors too, not just
 types). In fact, if you want to implement a simple, typed functional
 language, you'll find it is the only built-in type constructor you
 have to implement (as the implementor of the language).

 Also,
   Show a = a
 is a type too, but you won't find a definition for 'a' or for '='.
 All those things are defined by the language.

 Cheers,
 Thu


   


-- 
Best regards,
 Bulatmailto:bulat.zigans...@gmail.com

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


Re: [Haskell-cafe] On to applicative

2010-08-31 Thread Vo Minh Thu
2010/8/31 michael rice nowg...@yahoo.com

 So it's a type constructor, not a type? Could you please provide a simple 
 example of its usage?

Sure, although I'm sure you've come by some already.

-- the identity function
id :: a - a
-- often, we write it like this:
-- id x = x
-- but here we see the relationship between the ananymous function
syntax and the function type:
id = \x - x

In fact, if you write in prefix form, it is quite familiar:
f :: (-) Int Bool
e = Either String Float

Cheers,
Thu

 Michael

 --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote:

 From: Vo Minh Thu not...@gmail.com
 Subject: Re: [Haskell-cafe] On to applicative
 To: michael rice nowg...@yahoo.com
 Cc: haskell-cafe@haskell.org
 Date: Tuesday, August 31, 2010, 1:17 PM

 2010/8/31 michael rice nowg...@yahoo.com
 
  Learn You a Haskell ...  says that (-) is a type just like Either. Where 
  can I find its type definition?

 You can't define it *in* Haskell as user code. It is a built-in infix
 type constructor (Either or Maybe are type constructors too, not just
 types). In fact, if you want to implement a simple, typed functional
 language, you'll find it is the only built-in type constructor you
 have to implement (as the implementor of the language).

 Also,
   Show a = a
 is a type too, but you won't find a definition for 'a' or for '='.
 All those things are defined by the language.

 Cheers,
 Thu

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


Fwd: Searching for Haskell (was: [Haskell-cafe] Slightly humorous: Headhunters toolbox (example for Germany))

2010-08-31 Thread Alberto G. Corona
Ooops

Just after sending this I relized that it is possible to narrow the search
using categories.

Using the category programming:

http://www.google.com/insights/search/?hl=en-US#cat=31q=haskellcmpt=q

http://www.google.com/insights/search/?hl=en-US#cat=31q=haskellcmpt=qit
is even possible to compare the evolution of the term against the whole
category. Both go down with time (because technical people dominate less and
less the wen searches) . But the slope of Haskell is lesser than the one
of  programming.


By the way, it is possible to compare two or more search terms. Within the
category programming, monad, and type class are scarce compared with
object but  the slope of the former ones are clearly up while object is
down.  (press growth compared with the programing category).

What happened in the first half of 2006? monads were high there!.

An further example is lazy versus strict. Both are comparable in percentage,
but lazy is scandalously up while strict is down at the same rate.

http://www.google.com/insights/search/?hl=en-US#cat=31q=lazy%2Cstrict%2Ccmpt=q


By the way, the term tired  has increasing share in the programming
category ;)

2010/8/31 Henk-Jan van Tuyl hjgt...@chello.nl

On Tue, 31 Aug 2010 13:57:42 +0200, Alberto G. Corona  agocor...@gmail.com
 wrote:

  Entering  haskell  language  instead of haskell the ambiguity
 dissapears. Then, Jamaica no longer appears in the crude reality . The
 weigth of USA is hides all other country here.

 I think that a more appropriate term  to look for  haskell interest is
 monad although it may catch some crazy philosophers too. The result is
 interesting,


 You can still get things like a page titled Ben Haskell - Language
 Technologies Institute - Carnegie Mellon, and of course, not all pages
 about the programming language contain the word language. To get proper
 results you would need a good semantic search engine, but these search
 engines seem to be in early research stage.

 Regards,
 Henk-Jan van Tuyl


 --
 http://Van.Tuyl.eu/
 http://members.chello.nl/hjgtuyl/tourdemonad.html
 --

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


Re: [Haskell-cafe] :Trace has no history

2010-08-31 Thread Pepe Iborra
Hi Steve

The debugger only traces calls in interpreted code. Perhaps the call
to myMethod is being made from object code?

Admittedly, the ghci debugger can take some effort to learn to use
properly. Make sure that you give a look to the ghc user guide if you
haven't done so yet.


Best,
pepe

On Tuesday, August 31, 2010, Steve sseve...@gmail.com wrote:
 I am trying to debug a problem in GHCI. I invoke my method with trace
 but when it breaks on exception i can't get this history. Output is
 below. Thanks.


 relude Symbols :set -fbreak-on-exception
 Prelude Symbols :trace myMethod
 Loading package HUnit-1.2.2.1 ... linking ... done.
 Loading package syb-0.1.0.2 ... linking ... done.
 Loading package base-3.0.3.2 ... linking ... done.
 Loading package old-locale-1.0.0.2 ... linking ... done.
 Loading package time-1.1.4 ... linking ... done.
 Loading package random-1.0.0.2 ... linking ... done.
 Loading package QuickCheck-1.2.0.0 ... linking ... done.
 Loading package Decimal-0.1.0 ... linking ... done.
 Loading package array-0.3.0.0 ... linking ... done.
 Loading package Diff-0.1.2 ... linking ... done.
 Loading package bytestring-0.9.1.5 ... linking ... done.
 Loading package containers-0.3.0.0 ... linking ... done.
 Loading package mtl-1.1.0.2 ... linking ... done.
 Loading package old-time-1.0.0.3 ... linking ... done.
 Loading package convertible-1.0.9 ... linking ... done.
 Loading package utf8-string-0.3.4 ... linking ... done.
 Loading package HDBC-2.2.6 ... linking ... done.
 Loading package HDBC-mysql-0.6.3 ... linking ... done.
 Loading package parsec-2.1.0.1 ... linking ... done.
 Loading package network-2.2.1.7 ... linking ... done.
 Loading package HTTP-4000.0.9 ... linking ... done.
 Loading package binary-0.5.0.2 ... linking ... done.
 Loading package digest-0.0.0.8 ... linking ... done.
 Loading package filepath-1.1.0.3 ... linking ... done.
 Loading package unix-2.4.0.0 ... linking ... done.
 Loading package directory-1.0.1.0 ... linking ... done.
 Loading package pretty-1.0.1.1 ... linking ... done.
 Loading package zlib-0.5.2.0 ... linking ... done.
 Loading package zip-archive-0.1.1.6 ... linking ... done.
 Loading package Core-0.0.1 ... linking ... done.
 Beginning Update
 Stopped at exception thrown
 _exception ::
  e = GHC.Exception.SomeException (GHC.Exception.D:Exception _

 (GHC.Show.D:Show ...) )
                                  (GHC.IO.Exception.IOError Nothing
 GHC.IO.Exception.UserError )
 [exception thrown] Prelude Symbols :history
 Empty history. Perhaps you forgot to use :trace?
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


-- 
-- José Iborrahttp://www.dsic.upv.es/~jiborra
-- UPV Valencia   Telf. (+34) 96 387 00 00 (ext) 83529
-- Camino de Vera s/n. 46022 Valencia (Spain)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Arrow transformers: how to make them wright?

2010-08-31 Thread Permjacov Evgeniy
 A Control.Arrow in base package introduces an arrow type, and ghc have
good support for arrow notation. Many things, avaible in monads, are
avaible in arrows as well. There is an arrows package, that introduces
some arrow classes : state, reader, writer and so on. However, it does
not introduce systematic lifting of arrow classes operations.

Arrows are generalisation of monads. There are libraries, that
introduces systematic lifting of operations from monad classes.

So, the quesions are:
 what operations should be in arrow transformer class? Captain Obvious
says, it should look at least like:
class ArrowTrans t where
lift :: ( Arrow a, Arrow (t a) ) = a b c - t a b c

 what laws arrow transformers must obey? C.O. says, at least
lift a b c  lift a c d == lift ( a b c  a c d )
 how to perform lifting of actions for classes like this:
  class Arrow a = ArrowError a e| a- e where
 raise :: a e ()
 handle :: a e c - a b c - a b c

class Arrow a = ArrowReader a e | a - e where
   look :: a () e
   local :: a b c - a (b,e) c

The answers lies somewhere in category theory, C.O. says. Of course,
such answer is not satisfactory.

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


Re: [Haskell-cafe] Arrow transformers: how to make them wright?

2010-08-31 Thread Bulat Ziganshin
Hello Permjacov,

Tuesday, August 31, 2010, 10:07:38 PM, you wrote:

  what operations should be in arrow transformer class?

oh, these Russians :)


-- 
Best regards,
 Bulatmailto:bulat.zigans...@gmail.com

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


Re: [Haskell-cafe] Statically tracking validity - suggestions?

2010-08-31 Thread Andrew Coppin

Luke Palmer wrote:

I have a description of the design pattern you need, appropriately
named: http://lukepalmer.wordpress.com/2009/03/24/certificate-design-pattern/
  


Mmm, I like that.

There are two small problems:

* In my web browser, some of the code snippets get the right-hand edge 
chopped off.


* Double-precision floating-point arithmetic is inexact, so half your 
code won't actually work in the real world. (But obviously, it's only 
supposed to be an example for illustration purposes.)


With regard to the second, does anybody know of anything on Hackage for 
testing whether two values are approximately equal? It must be a 
common programming problem, and it's more tricky than you think to solve 
it well.


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


Re: [Haskell-cafe] On to applicative

2010-08-31 Thread michael rice
I'm not sure if my terminology is correct or even if my question makes sense, 
but I can create instances of Maybe, List, IO, and Either.

Prelude Data.Either let m = Just 7
Prelude Data.Either :t m
m :: Maybe Integer

Prelude Data.Either let l = 2:[]
Prelude Data.Either :t l
l :: [Integer]

Prelude Data.Either let g = getLine
Prelude Data.Either :t g
g :: IO String

Prelude Data.Either let e = Right abc
Prelude Data.Either :t e
e :: Either a [Char]

All these instances are functors, each with its own version of fmap that can be 
applied to it.

How can I similarly create an instance of (-) so I can apply (-)'s version of 
fmap

instance Functor ((-) r) where  
    fmap f g = (\x - f (g x))

to it?

Michael

--- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote:

From: Vo Minh Thu not...@gmail.com
Subject: Re: [Haskell-cafe] On to applicative
To: michael rice nowg...@yahoo.com
Cc: haskell-cafe@haskell.org
Date: Tuesday, August 31, 2010, 1:50 PM

2010/8/31 michael rice nowg...@yahoo.com

 So it's a type constructor, not a type? Could you please provide a simple 
 example of its usage?

Sure, although I'm sure you've come by some already.

-- the identity function
id :: a - a
-- often, we write it like this:
-- id x = x
-- but here we see the relationship between the ananymous function
syntax and the function type:
id = \x - x

In fact, if you write in prefix form, it is quite familiar:
f :: (-) Int Bool
e = Either String Float

Cheers,
Thu

 Michael

 --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote:

 From: Vo Minh Thu not...@gmail.com
 Subject: Re: [Haskell-cafe] On to applicative
 To: michael rice nowg...@yahoo.com
 Cc: haskell-cafe@haskell.org
 Date: Tuesday, August 31, 2010, 1:17 PM

 2010/8/31 michael rice nowg...@yahoo.com
 
  Learn You a Haskell ...  says that (-) is a type just like Either. Where 
  can I find its type definition?

 You can't define it *in* Haskell as user code. It is a built-in infix
 type constructor (Either or Maybe are type constructors too, not just
 types). In fact, if you want to implement a simple, typed functional
 language, you'll find it is the only built-in type constructor you
 have to implement (as the implementor of the language).

 Also,
   Show a = a
 is a type too, but you won't find a definition for 'a' or for '='.
 All those things are defined by the language.

 Cheers,
 Thu




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


Re: [Haskell-cafe] Statically tracking validity - suggestions?

2010-08-31 Thread Vo Minh Thu
2010/8/31 Andrew Coppin andrewcop...@btinternet.com:
 Luke Palmer wrote:

 I have a description of the design pattern you need, appropriately
 named:
 http://lukepalmer.wordpress.com/2009/03/24/certificate-design-pattern/


 Mmm, I like that.

 There are two small problems:

 * In my web browser, some of the code snippets get the right-hand edge
 chopped off.

 * Double-precision floating-point arithmetic is inexact, so half your code
 won't actually work in the real world. (But obviously, it's only supposed to
 be an example for illustration purposes.)

 With regard to the second, does anybody know of anything on Hackage for
 testing whether two values are approximately equal? It must be a common
 programming problem, and it's more tricky than you think to solve it well.

I think something has been added to Hackage recently about that.

There is this one, but I don't know if it is the one I was thinking about.
http://hackage.haskell.org/package/ieee

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


Re: [Haskell-cafe] On to applicative

2010-08-31 Thread Ryan Ingram
Prelude FmapFunc let s = show :: ((-) Int) String
Prelude FmapFunc :t s
s :: Int - String
Prelude FmapFunc let v = fmap (hello  ++) s
Prelude FmapFunc :t v
v :: Int - String
Prelude FmapFunc v 1
hello 1

  -- ryan

On Tue, Aug 31, 2010 at 11:28 AM, michael rice nowg...@yahoo.com wrote:

 I'm not sure if my terminology is correct or even if my question makes
 sense, but I can create instances of Maybe, List, IO, and Either.

 Prelude Data.Either let m = Just 7
 Prelude Data.Either :t m
 m :: Maybe Integer

 Prelude Data.Either let l = 2:[]
 Prelude Data.Either :t l
 l :: [Integer]

 Prelude Data.Either let g = getLine
 Prelude Data.Either :t g
 g :: IO String

 Prelude Data.Either let e = Right abc
 Prelude Data.Either :t e
 e :: Either a [Char]

 All these instances are functors, each with its own version of fmap that
 can be applied to it.

 How can I similarly create an instance of (-) so I can apply (-)'s
 version of fmap

 instance Functor ((-) r) where
 fmap f g = (\x - f (g x))

 to it?


 Michael

 --- On *Tue, 8/31/10, Vo Minh Thu not...@gmail.com* wrote:


 From: Vo Minh Thu not...@gmail.com
 Subject: Re: [Haskell-cafe] On to applicative
 To: michael rice nowg...@yahoo.com
 Cc: haskell-cafe@haskell.org
 Date: Tuesday, August 31, 2010, 1:50 PM


 2010/8/31 michael rice 
 nowg...@yahoo.comhttp://mc/compose?to=nowg...@yahoo.com
 
 
  So it's a type constructor, not a type? Could you please provide a simple
 example of its usage?

 Sure, although I'm sure you've come by some already.

 -- the identity function
 id :: a - a
 -- often, we write it like this:
 -- id x = x
 -- but here we see the relationship between the ananymous function
 syntax and the function type:
 id = \x - x

 In fact, if you write in prefix form, it is quite familiar:
 f :: (-) Int Bool
 e = Either String Float

 Cheers,
 Thu

  Michael
 
  --- On Tue, 8/31/10, Vo Minh Thu 
  not...@gmail.comhttp://mc/compose?to=not...@gmail.com
 wrote:
 
  From: Vo Minh Thu not...@gmail.comhttp://mc/compose?to=not...@gmail.com
 
  Subject: Re: [Haskell-cafe] On to applicative
  To: michael rice 
  nowg...@yahoo.comhttp://mc/compose?to=nowg...@yahoo.com
 
  Cc: haskell-cafe@haskell.orghttp://mc/compose?to=haskell-c...@haskell.org
  Date: Tuesday, August 31, 2010, 1:17 PM
 
  2010/8/31 michael rice 
  nowg...@yahoo.comhttp://mc/compose?to=nowg...@yahoo.com
 
  
   Learn You a Haskell ...  says that (-) is a type just like Either.
 Where can I find its type definition?
 
  You can't define it *in* Haskell as user code. It is a built-in infix
  type constructor (Either or Maybe are type constructors too, not just
  types). In fact, if you want to implement a simple, typed functional
  language, you'll find it is the only built-in type constructor you
  have to implement (as the implementor of the language).
 
  Also,
Show a = a
  is a type too, but you won't find a definition for 'a' or for '='.
  All those things are defined by the language.
 
  Cheers,
  Thu
 



 ___
 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] Arrow transformers: how to make them wright?

2010-08-31 Thread David Menendez
On Tue, Aug 31, 2010 at 2:07 PM, Permjacov Evgeniy permea...@gmail.com wrote:
  A Control.Arrow in base package introduces an arrow type, and ghc have
 good support for arrow notation. Many things, avaible in monads, are
 avaible in arrows as well. There is an arrows package, that introduces
 some arrow classes : state, reader, writer and so on. However, it does
 not introduce systematic lifting of arrow classes operations.

Are you referring to the arrows package at
http://hackage.haskell.org/package/arrows? If so, what do you mean
by systematic lifting, because it does lift operations through the
transformers where possible.

-- 
Dave Menendez d...@zednenem.com
http://www.eyrie.org/~zednenem/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] On to applicative

2010-08-31 Thread Vo Minh Thu
2010/8/31 michael rice nowg...@yahoo.com

 I'm not sure if my terminology is correct or even if my question makes sense, 
 but I can create instances of Maybe, List, IO, and Either.

 Prelude Data.Either let m = Just 7
 Prelude Data.Either :t m
 m :: Maybe Integer

We say that m has type Maybe Integer, so :: is pronounced 'has type'.
We also say that m is a value. Just is a type constructor, Maybe Int
is a type, and Just 7, like m, is a value.

So we don't talk about instance here. Informally you could say that 7
is an instance of Int, but in Haskell we use 'instance' to mean
something (precisely) else.

This pharse is correct w.r.t to the use of 'instance' in Haskell:
Maybe is an instance of the Functor class.

 Prelude Data.Either let l = 2:[]
 Prelude Data.Either :t l
 l :: [Integer]

 Prelude Data.Either let g = getLine
 Prelude Data.Either :t g
 g :: IO String

 Prelude Data.Either let e = Right abc
 Prelude Data.Either :t e
 e :: Either a [Char]

 All these instances are functors, each with its own version of fmap that can 
 be applied to it.

 How can I similarly create an instance of (-) so I can apply (-)'s version 
 of fmap

 instance Functor ((-) r) where
     fmap f g = (\x - f (g x))

 to it?

Note that for Maybe, the instance is define with
  instance Functor Maybe where ...

Note how the type argument of Maybe is not given.
But above, when you create a value, it has type Maybe Int, not only Maybe.

So for the ((-) r) case, you still want to complete it.
E.g.
m :: Maybe Int -- not just Maybe
(+) :: (-) Int Int -- and not only (-) Int

Cheers,
Thu

 Michael

 --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote:

 From: Vo Minh Thu not...@gmail.com
 Subject: Re: [Haskell-cafe] On to applicative
 To: michael rice nowg...@yahoo.com
 Cc: haskell-cafe@haskell.org
 Date: Tuesday, August 31, 2010, 1:50 PM

 2010/8/31 michael rice nowg...@yahoo.com
 
  So it's a type constructor, not a type? Could you please provide a simple 
  example of its usage?

 Sure, although I'm sure you've come by some already.

 -- the identity function
 id :: a - a
 -- often, we write it like this:
 -- id x = x
 -- but here we see the relationship between the ananymous function
 syntax and the function type:
 id = \x - x

 In fact, if you write in prefix form, it is quite familiar:
 f :: (-) Int Bool
 e = Either String Float

 Cheers,
 Thu

  Michael
 
  --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote:
 
  From: Vo Minh Thu not...@gmail.com
  Subject: Re: [Haskell-cafe] On to applicative
  To: michael rice nowg...@yahoo.com
  Cc: haskell-cafe@haskell.org
  Date: Tuesday, August 31, 2010, 1:17 PM
 
  2010/8/31 michael rice nowg...@yahoo.com
  
   Learn You a Haskell ...  says that (-) is a type just like Either. 
   Where can I find its type definition?
 
  You can't define it *in* Haskell as user code. It is a built-in infix
  type constructor (Either or Maybe are type constructors too, not just
  types). In fact, if you want to implement a simple, typed functional
  language, you'll find it is the only built-in type constructor you
  have to implement (as the implementor of the language).
 
  Also,
    Show a = a
  is a type too, but you won't find a definition for 'a' or for '='.
  All those things are defined by the language.
 
  Cheers,
  Thu
 

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


Re: [Haskell-cafe] On to applicative

2010-08-31 Thread michael rice
Hi, Ryan and all,

Bingo! I guess my question was all right after all.

I tried creating an instance earlier but 

*Main :t (-) Int Char

interactive:1:1: parse error on input `-'

What got loaded with FmapFunc? I Hoogled it and got back nothing.

Michael

--- On Tue, 8/31/10, Ryan Ingram ryani.s...@gmail.com wrote:

From: Ryan Ingram ryani.s...@gmail.com
Subject: Re: [Haskell-cafe] On to applicative
To: michael rice nowg...@yahoo.com
Cc: Vo Minh Thu not...@gmail.com, haskell-cafe@haskell.org
Date: Tuesday, August 31, 2010, 2:36 PM

Prelude FmapFunc let s = show :: ((-) Int) String
Prelude FmapFunc :t s
s :: Int - String
Prelude FmapFunc let v = fmap (hello  ++) s
Prelude FmapFunc :t v
v :: Int - String

Prelude FmapFunc v 1
hello 1

  -- ryan

On Tue, Aug 31, 2010 at 11:28 AM, michael rice nowg...@yahoo.com wrote:


I'm not sure if my terminology is correct or even if my question makes sense, 
but I can create instances of Maybe, List, IO, and Either.

Prelude Data.Either let m = Just 7
Prelude Data.Either :t m

m :: Maybe Integer

Prelude Data.Either let l = 2:[]
Prelude Data.Either :t l
l :: [Integer]

Prelude Data.Either let g = getLine
Prelude Data.Either :t g
g :: IO String

Prelude Data.Either let e = Right abc

Prelude Data.Either :t e
e :: Either a [Char]

All these instances are functors, each with its own version of fmap that can be 
applied to it.

How can I similarly create an instance of (-) so I can apply (-)'s version of 
fmap


instance Functor ((-) r) where  
    fmap f g = (\x - f (g x))

to
 it?

Michael

--- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote:


From: Vo Minh Thu not...@gmail.com
Subject: Re: [Haskell-cafe] On to applicative
To: michael rice nowg...@yahoo.com

Cc: haskell-cafe@haskell.org
Date: Tuesday, August 31, 2010, 1:50 PM

2010/8/31 michael rice nowg...@yahoo.com


 So it's a type constructor, not a type? Could you please provide a simple 
 example of its usage?

Sure, although I'm sure you've come by some already.

-- the identity function
id :: a - a

-- often, we write it like this:
-- id x = x
-- but here we see the relationship between the ananymous function
syntax and the function
 type:
id = \x - x

In fact, if you write in prefix form, it is quite familiar:
f :: (-) Int Bool
e = Either String Float

Cheers,
Thu

 Michael

 --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote:


 From: Vo Minh Thu not...@gmail.com
 Subject: Re: [Haskell-cafe] On to applicative
 To: michael rice nowg...@yahoo.com

 Cc: haskell-cafe@haskell.org
 Date: Tuesday, August 31, 2010, 1:17 PM

 2010/8/31 michael rice nowg...@yahoo.com

 
  Learn You a Haskell ...  says that (-) is a type just like Either. Where 
  can I find its type definition?

 You can't define it *in* Haskell as user code. It is a built-in infix

 type constructor (Either or Maybe are type constructors too, not just
 types). In fact, if you want to implement a simple, typed functional
 language, you'll find it is the only built-in type constructor you

 have to implement (as the implementor of the language).

 Also,
   Show a = a
 is a type too, but you won't find a definition for 'a' or for '='.
 All those things are defined by the language.


 Cheers,
 Thu




  
___

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] On to applicative

2010-08-31 Thread Vo Minh Thu
2010/8/31 michael rice nowg...@yahoo.com

 Hi, Ryan and all,

 Bingo! I guess my question was all right after all.

 I tried creating an instance earlier but

 *Main :t (-) Int Char

 interactive:1:1: parse error on input `-'

  :t Int
does not make sense but
  :t undefined :: Int
is ok, just like
   :t undefined :: (-) Int Int

 What got loaded with FmapFunc? I Hoogled it and got back nothing.

 Michael

 --- On Tue, 8/31/10, Ryan Ingram ryani.s...@gmail.com wrote:

 From: Ryan Ingram ryani.s...@gmail.com
 Subject: Re: [Haskell-cafe] On to applicative
 To: michael rice nowg...@yahoo.com
 Cc: Vo Minh Thu not...@gmail.com, haskell-cafe@haskell.org
 Date: Tuesday, August 31, 2010, 2:36 PM

 Prelude FmapFunc let s = show :: ((-) Int) String
 Prelude FmapFunc :t s
 s :: Int - String
 Prelude FmapFunc let v = fmap (hello  ++) s
 Prelude FmapFunc :t v
 v :: Int - String
 Prelude FmapFunc v 1
 hello 1

   -- ryan

 On Tue, Aug 31, 2010 at 11:28 AM, michael rice nowg...@yahoo.com wrote:

 I'm not sure if my terminology is correct or even if my question makes sense, 
 but I can create instances of Maybe, List, IO, and Either.

 Prelude Data.Either let m = Just 7
 Prelude Data.Either :t m
 m :: Maybe Integer

 Prelude Data.Either let l = 2:[]
 Prelude Data.Either :t l
 l :: [Integer]

 Prelude Data.Either let g = getLine
 Prelude Data.Either :t g
 g :: IO String

 Prelude Data.Either let e = Right abc
 Prelude Data.Either :t e
 e :: Either a [Char]

 All these instances are functors, each with its own version of fmap that can 
 be applied to it.

 How can I similarly create an instance of (-) so I can apply (-)'s version 
 of fmap

 instance Functor ((-) r) where
     fmap f g = (\x - f (g x))

 to it?

 Michael

 --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote:

 From: Vo Minh Thu not...@gmail.com
 Subject: Re: [Haskell-cafe] On to applicative
 To: michael rice nowg...@yahoo.com
 Cc: haskell-cafe@haskell.org
 Date: Tuesday, August 31, 2010, 1:50 PM

 2010/8/31 michael rice nowg...@yahoo.com
 
  So it's a type constructor, not a type? Could you please provide a simple 
  example of its usage?

 Sure, although I'm sure you've come by some already.

 -- the identity function
 id :: a - a
 -- often, we write it like this:
 -- id x = x
 -- but here we see the relationship between the ananymous function
 syntax and the function type:
 id = \x - x

 In fact, if you write in prefix form, it is quite familiar:
 f :: (-) Int Bool
 e = Either String Float

 Cheers,
 Thu

  Michael
 
  --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote:
 
  From: Vo Minh Thu not...@gmail.com
  Subject: Re: [Haskell-cafe] On to applicative
  To: michael rice nowg...@yahoo.com
  Cc: haskell-cafe@haskell.org
  Date: Tuesday, August 31, 2010, 1:17 PM
 
  2010/8/31 michael rice nowg...@yahoo.com
  
   Learn You a Haskell ...  says that (-) is a type just like Either. 
   Where can I find its type definition?
 
  You can't define it *in* Haskell as user code. It is a built-in infix
  type constructor (Either or Maybe are type constructors too, not just
  types). In fact, if you want to implement a simple, typed functional
  language, you'll find it is the only built-in type constructor you
  have to implement (as the implementor of the language).
 
  Also,
    Show a = a
  is a type too, but you won't find a definition for 'a' or for '='.
  All those things are defined by the language.
 
  Cheers,
  Thu
 


 ___
 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] On to applicative

2010-08-31 Thread michael rice
Hi Vo,

Pardon, I grabbed the wrong lines.

*Main :t (-) 3 abc

interactive:1:1: parse error on input `-'

Michael

--- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote:

From: Vo Minh Thu not...@gmail.com
Subject: Re: [Haskell-cafe] On to applicative
To: michael rice nowg...@yahoo.com
Cc: Ryan Ingram ryani.s...@gmail.com, haskell-cafe@haskell.org
Date: Tuesday, August 31, 2010, 3:07 PM

2010/8/31 michael rice nowg...@yahoo.com

 Hi, Ryan and all,

 Bingo! I guess my question was all right after all.

 I tried creating an instance earlier but

 *Main :t (-) Int Char

 interactive:1:1: parse error on input `-'

  :t Int
does not make sense but
  :t undefined :: Int
is ok, just like
   :t undefined :: (-) Int Int

 What got loaded with FmapFunc? I Hoogled it and got back nothing.

 Michael

 --- On Tue, 8/31/10, Ryan Ingram ryani.s...@gmail.com wrote:

 From: Ryan Ingram ryani.s...@gmail.com
 Subject: Re: [Haskell-cafe] On to applicative
 To: michael rice nowg...@yahoo.com
 Cc: Vo Minh Thu not...@gmail.com, haskell-cafe@haskell.org
 Date: Tuesday, August 31, 2010, 2:36 PM

 Prelude FmapFunc let s = show :: ((-) Int) String
 Prelude FmapFunc :t s
 s :: Int - String
 Prelude FmapFunc let v = fmap (hello  ++) s
 Prelude FmapFunc :t v
 v :: Int - String
 Prelude FmapFunc v 1
 hello 1

   -- ryan

 On Tue, Aug 31, 2010 at 11:28 AM, michael rice nowg...@yahoo.com wrote:

 I'm not sure if my terminology is correct or even if my question makes sense, 
 but I can create instances of Maybe, List, IO, and Either.

 Prelude Data.Either let m = Just 7
 Prelude Data.Either :t m
 m :: Maybe Integer

 Prelude Data.Either let l = 2:[]
 Prelude Data.Either :t l
 l :: [Integer]

 Prelude Data.Either let g = getLine
 Prelude Data.Either :t g
 g :: IO String

 Prelude Data.Either let e = Right abc
 Prelude Data.Either :t e
 e :: Either a [Char]

 All these instances are functors, each with its own version of fmap that can 
 be applied to it.

 How can I similarly create an instance of (-) so I can apply (-)'s version 
 of fmap

 instance Functor ((-) r) where
     fmap f g = (\x - f (g x))

 to it?

 Michael

 --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote:

 From: Vo Minh Thu not...@gmail.com
 Subject: Re: [Haskell-cafe] On to applicative
 To: michael rice nowg...@yahoo.com
 Cc: haskell-cafe@haskell.org
 Date: Tuesday, August 31, 2010, 1:50 PM

 2010/8/31 michael rice nowg...@yahoo.com
 
  So it's a type constructor, not a type? Could you please provide a simple 
  example of its usage?

 Sure, although I'm sure you've come by some already.

 -- the identity function
 id :: a - a
 -- often, we write it like this:
 -- id x = x
 -- but here we see the relationship between the ananymous function
 syntax and the function type:
 id = \x - x

 In fact, if you write in prefix form, it is quite familiar:
 f :: (-) Int Bool
 e = Either String Float

 Cheers,
 Thu

  Michael
 
  --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote:
 
  From: Vo Minh Thu not...@gmail.com
  Subject: Re: [Haskell-cafe] On to applicative
  To: michael rice nowg...@yahoo.com
  Cc: haskell-cafe@haskell.org
  Date: Tuesday, August 31, 2010, 1:17 PM
 
  2010/8/31 michael rice nowg...@yahoo.com
  
   Learn You a Haskell ...  says that (-) is a type just like Either. 
   Where can I find its type definition?
 
  You can't define it *in* Haskell as user code. It is a built-in infix
  type constructor (Either or Maybe are type constructors too, not just
  types). In fact, if you want to implement a simple, typed functional
  language, you'll find it is the only built-in type constructor you
  have to implement (as the implementor of the language).
 
  Also,
    Show a = a
  is a type too, but you won't find a definition for 'a' or for '='.
  All those things are defined by the language.
 
  Cheers,
  Thu
 


 ___
 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] On to applicative

2010-08-31 Thread Vo Minh Thu
2010/8/31 michael rice nowg...@yahoo.com

 Hi Vo,

 Pardon, I grabbed the wrong lines.

 *Main :t (-) 3 abc

 interactive:1:1: parse error on input `-'

Try

*Main :t undefined :: (-) 3 abc

You can't write
  :t some type
You have to write
  :t some value

 Michael

 --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote:

 From: Vo Minh Thu not...@gmail.com
 Subject: Re: [Haskell-cafe] On to applicative
 To: michael rice nowg...@yahoo.com
 Cc: Ryan Ingram ryani.s...@gmail.com, haskell-cafe@haskell.org
 Date: Tuesday, August 31, 2010, 3:07 PM

 2010/8/31 michael rice nowg...@yahoo.com
 
  Hi, Ryan and all,
 
  Bingo! I guess my question was all right after all.
 
  I tried creating an instance earlier but
 
  *Main :t (-) Int Char
 
  interactive:1:1: parse error on input `-'

   :t Int
 does not make sense but
   :t undefined :: Int
 is ok, just like
    :t undefined :: (-) Int Int

  What got loaded with FmapFunc? I Hoogled it and got back nothing.
 
  Michael
 
  --- On Tue, 8/31/10, Ryan Ingram ryani.s...@gmail.com wrote:
 
  From: Ryan Ingram ryani.s...@gmail.com
  Subject: Re: [Haskell-cafe] On to applicative
  To: michael rice nowg...@yahoo.com
  Cc: Vo Minh Thu not...@gmail.com, haskell-cafe@haskell.org
  Date: Tuesday, August 31, 2010, 2:36 PM
 
  Prelude FmapFunc let s = show :: ((-) Int) String
  Prelude FmapFunc :t s
  s :: Int - String
  Prelude FmapFunc let v = fmap (hello  ++) s
  Prelude FmapFunc :t v
  v :: Int - String
  Prelude FmapFunc v 1
  hello 1
 
    -- ryan
 
  On Tue, Aug 31, 2010 at 11:28 AM, michael rice nowg...@yahoo.com wrote:
 
  I'm not sure if my terminology is correct or even if my question makes 
  sense, but I can create instances of Maybe, List, IO, and Either.
 
  Prelude Data.Either let m = Just 7
  Prelude Data.Either :t m
  m :: Maybe Integer
 
  Prelude Data.Either let l = 2:[]
  Prelude Data.Either :t l
  l :: [Integer]
 
  Prelude Data.Either let g = getLine
  Prelude Data.Either :t g
  g :: IO String
 
  Prelude Data.Either let e = Right abc
  Prelude Data.Either :t e
  e :: Either a [Char]
 
  All these instances are functors, each with its own version of fmap that 
  can be applied to it.
 
  How can I similarly create an instance of (-) so I can apply (-)'s 
  version of fmap
 
  instance Functor ((-) r) where
      fmap f g = (\x - f (g x))
 
  to it?
 
  Michael
 
  --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote:
 
  From: Vo Minh Thu not...@gmail.com
  Subject: Re: [Haskell-cafe] On to applicative
  To: michael rice nowg...@yahoo.com
  Cc: haskell-cafe@haskell.org
  Date: Tuesday, August 31, 2010, 1:50 PM
 
  2010/8/31 michael rice nowg...@yahoo.com
  
   So it's a type constructor, not a type? Could you please provide a simple 
   example of its usage?
 
  Sure, although I'm sure you've come by some already.
 
  -- the identity function
  id :: a - a
  -- often, we write it like this:
  -- id x = x
  -- but here we see the relationship between the ananymous function
  syntax and the function type:
  id = \x - x
 
  In fact, if you write in prefix form, it is quite familiar:
  f :: (-) Int Bool
  e = Either String Float
 
  Cheers,
  Thu
 
   Michael
  
   --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote:
  
   From: Vo Minh Thu not...@gmail.com
   Subject: Re: [Haskell-cafe] On to applicative
   To: michael rice nowg...@yahoo.com
   Cc: haskell-cafe@haskell.org
   Date: Tuesday, August 31, 2010, 1:17 PM
  
   2010/8/31 michael rice nowg...@yahoo.com
   
Learn You a Haskell ...  says that (-) is a type just like Either. 
Where can I find its type definition?
  
   You can't define it *in* Haskell as user code. It is a built-in infix
   type constructor (Either or Maybe are type constructors too, not just
   types). In fact, if you want to implement a simple, typed functional
   language, you'll find it is the only built-in type constructor you
   have to implement (as the implementor of the language).
  
   Also,
     Show a = a
   is a type too, but you won't find a definition for 'a' or for '='.
   All those things are defined by the language.
  
   Cheers,
   Thu
  
 
 
  ___
  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] On to applicative

2010-08-31 Thread Alexander Solla


On Aug 31, 2010, at 12:03 PM, michael rice wrote:


I tried creating an instance earlier but

*Main :t (-) Int Char

interactive:1:1: parse error on input `-'


Try:

Prelude :info (-)
data (-) a b-- Defined in GHC.Prim

If you want type-information about values, use :t.  If you want  
information about types (and the type-level language), use :info.  
This includes stuff like class definitions and instances in scope.   
For example, if I include Control.Monad:


Prelude Control.Monad.Instances :info (-)
data (-) a b-- Defined in GHC.Prim
instance Monad ((-) r) -- Defined in Control.Monad.Instances
instance Functor ((-) r) -- Defined in Control.Monad.Instances

:info is pretty cool:

Prelude Control.Monad.Instances :info Monad
class Monad m where
  (=) :: m a - (a - m b) - m b
  () :: m a - m b - m b
  return :: a - m a
  fail :: String - m a
-- Defined in GHC.Base
instance Monad ((-) r) -- Defined in Control.Monad.Instances
instance Monad Maybe -- Defined in Data.Maybe
instance Monad [] -- Defined in GHC.Base
instance Monad IO -- Defined in GHC.Base

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


Re: [Haskell-cafe] ANNOUNCE: iteratee-compress 0.1

2010-08-31 Thread Jason Dagit
On Tue, Aug 31, 2010 at 6:51 AM, Maciej Piechotka uzytkown...@gmail.com wrote:
 Iteratee-compress provides compressing and decompressing enumerators.
 Currently only gzip is provided but at least bzip is planned.

 Additionally more fine-control over stream (i.e. flushing) is planned.

 
 Library currently depends on zlib haskell library only for sharing
 parameters data. However no zlib function is called (the needed
 functions are not exported) and the symbols it uses from necessity are
 deprecated. Would it be better to copy the parameters from zlib and drop
 the dependency?

I'd prefer to see you add zlib support and keep the dependency :)

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


[Haskell-cafe] Fourth (and Fifth) GhentFPG Meeting: Date and Call for Talks

2010-08-31 Thread Jeroen Janssen
(apologies if you receive multiple copies)

Dear all,

We would like to announce that the fourth meeting of the Ghent Functional 
Programming Group will be held on Thursday, October 7th at 19h. The location 
will again be the Technicum building of Ghent University 
(Sint-Pietersnieuwstraat 41, 9000 Gent).
Anyone is free to give a talk, so if you feel like giving one, just contact 
jejan...@gmail.com. The final program will be announced in a few weeks.

Finally, we would also like to remind you that GhentFPG is organizing BelHac, a 
Haskell hackathon on 5-7 November 2010. More details can be found at 
http://www.haskell.org/haskellwiki/Ghent_Functional_Programming_Group/BelHac
The fifth GhentFPG meeting will take place at this hackathon, so if you plan on 
going, and feel like giving a talk at this fifth meeting, just contact me. We 
would be more than happy to have some international speakers at our meeting!

Hope to see you then,
The GhentFPG Organizing 
Committee.___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] On to applicative

2010-08-31 Thread michael rice
You most certainly meant

Prelude Data.Either :t undefined :: (-) Int String
undefined :: (-) Int String :: Int - String

though it is confusing. Constructors usually take values, but here the values 
(-) takes are types.

Michael


--- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote:

From: Vo Minh Thu not...@gmail.com
Subject: Re: [Haskell-cafe] On to applicative
To: michael rice nowg...@yahoo.com
Cc: Ryan Ingram ryani.s...@gmail.com, haskell-cafe@haskell.org
Date: Tuesday, August 31, 2010, 3:23 PM

2010/8/31 michael rice nowg...@yahoo.com

 Hi Vo,

 Pardon, I grabbed the wrong lines.

 *Main :t (-) 3 abc

 interactive:1:1: parse error on input `-'

Try

*Main :t undefined :: (-) 3 abc

You can't write
  :t some type
You have to write
  :t some value

 Michael

 --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote:

 From: Vo Minh Thu not...@gmail.com
 Subject: Re: [Haskell-cafe] On to applicative
 To: michael rice nowg...@yahoo.com
 Cc: Ryan Ingram ryani.s...@gmail.com, haskell-cafe@haskell.org
 Date: Tuesday, August 31, 2010, 3:07 PM

 2010/8/31 michael rice nowg...@yahoo.com
 
  Hi, Ryan and all,
 
  Bingo! I guess my question was all right after all.
 
  I tried creating an instance earlier but
 
  *Main :t (-) Int Char
 
  interactive:1:1: parse error on input `-'

   :t Int
 does not make sense but
   :t undefined :: Int
 is ok, just like
    :t undefined :: (-) Int Int

  What got loaded with FmapFunc? I Hoogled it and got back nothing.
 
  Michael
 
  --- On Tue, 8/31/10, Ryan Ingram ryani.s...@gmail.com wrote:
 
  From: Ryan Ingram ryani.s...@gmail.com
  Subject: Re: [Haskell-cafe] On to applicative
  To: michael rice nowg...@yahoo.com
  Cc: Vo Minh Thu not...@gmail.com, haskell-cafe@haskell.org
  Date: Tuesday, August 31, 2010, 2:36 PM
 
  Prelude FmapFunc let s = show :: ((-) Int) String
  Prelude FmapFunc :t s
  s :: Int - String
  Prelude FmapFunc let v = fmap (hello  ++) s
  Prelude FmapFunc :t v
  v :: Int - String
  Prelude FmapFunc v 1
  hello 1
 
    -- ryan
 
  On Tue, Aug 31, 2010 at 11:28 AM, michael rice nowg...@yahoo.com wrote:
 
  I'm not sure if my terminology is correct or even if my question makes 
  sense, but I can create instances of Maybe, List, IO, and Either.
 
  Prelude Data.Either let m = Just 7
  Prelude Data.Either :t m
  m :: Maybe Integer
 
  Prelude Data.Either let l = 2:[]
  Prelude Data.Either :t l
  l :: [Integer]
 
  Prelude Data.Either let g = getLine
  Prelude Data.Either :t g
  g :: IO String
 
  Prelude Data.Either let e = Right abc
  Prelude Data.Either :t e
  e :: Either a [Char]
 
  All these instances are functors, each with its own version of fmap that 
  can be applied to it.
 
  How can I similarly create an instance of (-) so I can apply (-)'s 
  version of fmap
 
  instance Functor ((-) r) where
      fmap f g = (\x - f (g x))
 
  to it?
 
  Michael
 
  --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote:
 
  From: Vo Minh Thu not...@gmail.com
  Subject: Re: [Haskell-cafe] On to applicative
  To: michael rice nowg...@yahoo.com
  Cc: haskell-cafe@haskell.org
  Date: Tuesday, August 31, 2010, 1:50 PM
 
  2010/8/31 michael rice nowg...@yahoo.com
  
   So it's a type constructor, not a type? Could you please provide a simple 
   example of its usage?
 
  Sure, although I'm sure you've come by some already.
 
  -- the identity function
  id :: a - a
  -- often, we write it like this:
  -- id x = x
  -- but here we see the relationship between the ananymous function
  syntax and the function type:
  id = \x - x
 
  In fact, if you write in prefix form, it is quite familiar:
  f :: (-) Int Bool
  e = Either String Float
 
  Cheers,
  Thu
 
   Michael
  
   --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote:
  
   From: Vo Minh Thu not...@gmail.com
   Subject: Re: [Haskell-cafe] On to applicative
   To: michael rice nowg...@yahoo.com
   Cc: haskell-cafe@haskell.org
   Date: Tuesday, August 31, 2010, 1:17 PM
  
   2010/8/31 michael rice nowg...@yahoo.com
   
Learn You a Haskell ...  says that (-) is a type just like Either. 
Where can I find its type definition?
  
   You can't define it *in* Haskell as user code. It is a built-in infix
   type constructor (Either or Maybe are type constructors too, not just
   types). In fact, if you want to implement a simple, typed functional
   language, you'll find it is the only built-in type constructor you
   have to implement (as the implementor of the language).
  
   Also,
     Show a = a
   is a type too, but you won't find a definition for 'a' or for '='.
   All those things are defined by the language.
  
   Cheers,
   Thu
  
 
 
  ___
  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] On to applicative

2010-08-31 Thread Vo Minh Thu
2010/8/31 michael rice nowg...@yahoo.com

 You most certainly meant

 Prelude Data.Either :t undefined :: (-) Int String
 undefined :: (-) Int String :: Int - String

 though it is confusing. Constructors usually take values, but here the values 
 (-) takes are types.

Either and (-) are *type* constructors.
Just is a (value) constructor.

This makes sense:

Just 7 is a value, so Just surely constructs a value. Nothing doesn't
take an argument but is called a constructor too.
Maybe Int is a type, so Maybe surely constructs a type.

 Michael


 --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote:

 From: Vo Minh Thu not...@gmail.com
 Subject: Re: [Haskell-cafe] On to applicative
 To: michael rice nowg...@yahoo.com
 Cc: Ryan Ingram ryani.s...@gmail.com, haskell-cafe@haskell.org
 Date: Tuesday, August 31, 2010, 3:23 PM

 2010/8/31 michael rice nowg...@yahoo.com
 
  Hi Vo,
 
  Pardon, I grabbed the wrong lines.
 
  *Main :t (-) 3 abc
 
  interactive:1:1: parse error on input `-'

 Try

 *Main :t undefined :: (-) 3 abc

 You can't write
   :t some type
 You have to write
   :t some value

  Michael
 
  --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote:
 
  From: Vo Minh Thu not...@gmail.com
  Subject: Re: [Haskell-cafe] On to applicative
  To: michael rice nowg...@yahoo.com
  Cc: Ryan Ingram ryani.s...@gmail.com, haskell-cafe@haskell.org
  Date: Tuesday, August 31, 2010, 3:07 PM
 
  2010/8/31 michael rice nowg...@yahoo.com
  
   Hi, Ryan and all,
  
   Bingo! I guess my question was all right after all.
  
   I tried creating an instance earlier but
  
   *Main :t (-) Int Char
  
   interactive:1:1: parse error on input `-'
 
    :t Int
  does not make sense but
    :t undefined :: Int
  is ok, just like
     :t undefined :: (-) Int Int
 
   What got loaded with FmapFunc? I Hoogled it and got back nothing.
  
   Michael
  
   --- On Tue, 8/31/10, Ryan Ingram ryani.s...@gmail.com wrote:
  
   From: Ryan Ingram ryani.s...@gmail.com
   Subject: Re: [Haskell-cafe] On to applicative
   To: michael rice nowg...@yahoo.com
   Cc: Vo Minh Thu not...@gmail.com, haskell-cafe@haskell.org
   Date: Tuesday, August 31, 2010, 2:36 PM
  
   Prelude FmapFunc let s = show :: ((-) Int) String
   Prelude FmapFunc :t s
   s :: Int - String
   Prelude FmapFunc let v = fmap (hello  ++) s
   Prelude FmapFunc :t v
   v :: Int - String
   Prelude FmapFunc v 1
   hello 1
  
     -- ryan
  
   On Tue, Aug 31, 2010 at 11:28 AM, michael rice nowg...@yahoo.com wrote:
  
   I'm not sure if my terminology is correct or even if my question makes 
   sense, but I can create instances of Maybe, List, IO, and Either.
  
   Prelude Data.Either let m = Just 7
   Prelude Data.Either :t m
   m :: Maybe Integer
  
   Prelude Data.Either let l = 2:[]
   Prelude Data.Either :t l
   l :: [Integer]
  
   Prelude Data.Either let g = getLine
   Prelude Data.Either :t g
   g :: IO String
  
   Prelude Data.Either let e = Right abc
   Prelude Data.Either :t e
   e :: Either a [Char]
  
   All these instances are functors, each with its own version of fmap that 
   can be applied to it.
  
   How can I similarly create an instance of (-) so I can apply (-)'s 
   version of fmap
  
   instance Functor ((-) r) where
       fmap f g = (\x - f (g x))
  
   to it?
  
   Michael
  
   --- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote:
  
   From: Vo Minh Thu not...@gmail.com
   Subject: Re: [Haskell-cafe] On to applicative
   To: michael rice nowg...@yahoo.com
   Cc: haskell-cafe@haskell.org
   Date: Tuesday, August 31, 2010, 1:50 PM
  
   2010/8/31 michael rice nowg...@yahoo.com
   
So it's a type constructor, not a type? Could you please provide a 
simple example of its usage?
  
   Sure, although I'm sure you've come by some already.
  
   -- the identity function
   id :: a - a
   -- often, we write it like this:
   -- id x = x
   -- but here we see the relationship between the ananymous function
   syntax and the function type:
   id = \x - x
  
   In fact, if you write in prefix form, it is quite familiar:
   f :: (-) Int Bool
   e = Either String Float
  
   Cheers,
   Thu
  
Michael
   
--- On Tue, 8/31/10, Vo Minh Thu not...@gmail.com wrote:
   
From: Vo Minh Thu not...@gmail.com
Subject: Re: [Haskell-cafe] On to applicative
To: michael rice nowg...@yahoo.com
Cc: haskell-cafe@haskell.org
Date: Tuesday, August 31, 2010, 1:17 PM
   
2010/8/31 michael rice nowg...@yahoo.com

 Learn You a Haskell ...  says that (-) is a type just like Either. 
 Where can I find its type definition?
   
You can't define it *in* Haskell as user code. It is a built-in infix
type constructor (Either or Maybe are type constructors too, not just
types). In fact, if you want to implement a simple, typed functional
language, you'll find it is the only built-in type constructor you
have to implement (as the implementor of the language).
   
Also,
  Show a = a
is a type too, but you won't 

Re: [Haskell-cafe] On to applicative

2010-08-31 Thread Ryan Ingram
FmapFunc is just a test module I created with

instance Functor ((-) r) where ...

  -- ryan

On Tue, Aug 31, 2010 at 12:03 PM, michael rice nowg...@yahoo.com wrote:

 Hi, Ryan and all,

 Bingo! I guess my question was all right after all.

 I tried creating an instance earlier but

 *Main :t (-) Int Char

 interactive:1:1: parse error on input `-'

 What got loaded with FmapFunc? I Hoogled it and got back nothing.

 Michael

 --- On *Tue, 8/31/10, Ryan Ingram ryani.s...@gmail.com* wrote:


 From: Ryan Ingram ryani.s...@gmail.com

 Subject: Re: [Haskell-cafe] On to applicative
 To: michael rice nowg...@yahoo.com
 Cc: Vo Minh Thu not...@gmail.com, haskell-cafe@haskell.org
 Date: Tuesday, August 31, 2010, 2:36 PM


 Prelude FmapFunc let s = show :: ((-) Int) String
 Prelude FmapFunc :t s
 s :: Int - String
 Prelude FmapFunc let v = fmap (hello  ++) s
 Prelude FmapFunc :t v
 v :: Int - String
 Prelude FmapFunc v 1
 hello 1

   -- ryan

 On Tue, Aug 31, 2010 at 11:28 AM, michael rice 
 nowg...@yahoo.comhttp://mc/compose?to=nowg...@yahoo.com
  wrote:

 I'm not sure if my terminology is correct or even if my question makes
 sense, but I can create instances of Maybe, List, IO, and Either.

 Prelude Data.Either let m = Just 7
 Prelude Data.Either :t m
 m :: Maybe Integer

 Prelude Data.Either let l = 2:[]
 Prelude Data.Either :t l
 l :: [Integer]

 Prelude Data.Either let g = getLine
 Prelude Data.Either :t g
 g :: IO String

 Prelude Data.Either let e = Right abc
 Prelude Data.Either :t e
 e :: Either a [Char]

 All these instances are functors, each with its own version of fmap that
 can be applied to it.

 How can I similarly create an instance of (-) so I can apply (-)'s
 version of fmap

 instance Functor ((-) r) where
 fmap f g = (\x - f (g x))

 to it?


 Michael

 --- On *Tue, 8/31/10, Vo Minh Thu 
 not...@gmail.comhttp://mc/compose?to=not...@gmail.com
 * wrote:


 From: Vo Minh Thu not...@gmail.comhttp://mc/compose?to=not...@gmail.com
 
 Subject: Re: [Haskell-cafe] On to applicative
 To: michael rice nowg...@yahoo.comhttp://mc/compose?to=nowg...@yahoo.com
 
 Cc: haskell-cafe@haskell.orghttp://mc/compose?to=haskell-c...@haskell.org
 Date: Tuesday, August 31, 2010, 1:50 PM


 2010/8/31 michael rice 
 nowg...@yahoo.comhttp://mc/compose?to=nowg...@yahoo.com
 
 
  So it's a type constructor, not a type? Could you please provide a simple
 example of its usage?

 Sure, although I'm sure you've come by some already.

 -- the identity function
 id :: a - a
 -- often, we write it like this:
 -- id x = x
 -- but here we see the relationship between the ananymous function
 syntax and the function type:
 id = \x - x

 In fact, if you write in prefix form, it is quite familiar:
 f :: (-) Int Bool
 e = Either String Float

 Cheers,
 Thu

  Michael
 
  --- On Tue, 8/31/10, Vo Minh Thu 
  not...@gmail.comhttp://mc/compose?to=not...@gmail.com
 wrote:
 
  From: Vo Minh Thu not...@gmail.comhttp://mc/compose?to=not...@gmail.com
 
  Subject: Re: [Haskell-cafe] On to applicative
  To: michael rice 
  nowg...@yahoo.comhttp://mc/compose?to=nowg...@yahoo.com
 
  Cc: haskell-cafe@haskell.orghttp://mc/compose?to=haskell-c...@haskell.org
  Date: Tuesday, August 31, 2010, 1:17 PM
 
  2010/8/31 michael rice 
  nowg...@yahoo.comhttp://mc/compose?to=nowg...@yahoo.com
 
  
   Learn You a Haskell ...  says that (-) is a type just like Either.
 Where can I find its type definition?
 
  You can't define it *in* Haskell as user code. It is a built-in infix
  type constructor (Either or Maybe are type constructors too, not just
  types). In fact, if you want to implement a simple, typed functional
  language, you'll find it is the only built-in type constructor you
  have to implement (as the implementor of the language).
 
  Also,
Show a = a
  is a type too, but you won't find a definition for 'a' or for '='.
  All those things are defined by the language.
 
  Cheers,
  Thu
 



 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org http://mc/compose?to=haskell-c...@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] On to applicative

2010-08-31 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 8/31/10 13:27 , michael rice wrote:
 So it's a type constructor, not a type? Could you please provide a simple
 example of its usage?

Assuming you don't mean the trivial use in defining functions, see
Control.Monad.Instances:

 instance Functor ((-) r) where
 fmap = (.)
 
 instance Monad ((-) r) where
 return = const
 f = k = \ r - k (f r) r

(The above is the primitive reader functor/monad, see Control.Monad.Reader
for more information.)

- -- 
brandon s. allbery [linux,solaris,freebsd,perl]  allb...@kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon university  KF8NH
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkx9Z4EACgkQIn7hlCsL25WgrwCgvFQlObavv1fNOaKDjB/qbk8t
8+IAoLUrenXFzZFfJoYYvSy00uPctnaE
=ljiY
-END PGP SIGNATURE-
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Projects that could use student contributions?

2010-08-31 Thread Brent Yorgey
Hi all,

This fall I'll be teaching a half-credit introduction to Haskell to
some undergrads.  As a final project I am thinking of giving them the
option of (instead of developing some program/project of their own)
contributing to an existing open-source Haskell project.  Of course,
this requires the existence of projects they could contribute to.  I'm
sure they exist, but need your help to figure out what they are.  So,
do you maintain, or know of, any projects with the following
characteristics?

  * might conceivably be interesting to undergraduate CS majors

  * simple enough that someone could make some non-trivial
contributions in the space of 3 or 4 weeks 

  * could use some help!

This is a little non-traditional, so we'll see how it goes!

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


Re: [Haskell-cafe] Projects that could use student contributions?

2010-08-31 Thread Jason Dagit
On Tue, Aug 31, 2010 at 1:52 PM, Brent Yorgey byor...@seas.upenn.edu wrote:
 Hi all,

 This fall I'll be teaching a half-credit introduction to Haskell to
 some undergrads.  As a final project I am thinking of giving them the
 option of (instead of developing some program/project of their own)
 contributing to an existing open-source Haskell project.  Of course,
 this requires the existence of projects they could contribute to.  I'm
 sure they exist, but need your help to figure out what they are.  So,
 do you maintain, or know of, any projects with the following
 characteristics?

  * might conceivably be interesting to undergraduate CS majors

  * simple enough that someone could make some non-trivial
    contributions in the space of 3 or 4 weeks

As interim maintainer of Takusen, I'll vouch for it and say that it
would be open and welcoming to such students.  Unfortunately, I'm not
sure if it qualifies as simple.  It uses a lot of FFI and functional
dependencies.  Otherwise, I think it would be simple enough.  Perhaps
with a bit of negotiation we could find suitable tasks.

One thing that was proposed for Takusen is to build compatibility
layers for other Haskell database libraries, such as HDBC.  This may
actually be a decent project for a student and would possibly free
them from the FFI and FDs bits of takusen.  The takusen project page
is here:
http://projects.haskell.org/takusen/

Another idea someone had for takusen was to make a type safe query
builder.  Right now Takusen itself only requires that the query can
be converted to string.  So in principle, we could add data types /
combinators for building SQL expressions and then have a QueryBuilder
- String function.

Have you spoken to any other instructors that have used open source
contributions as part of a course?  I know that at Oregon State
University, Dr. Budd has been teaching a class about open source (and
how to get started) for several years.  I'm sure he'd love to give you
advice and he's very friendly.  Here is a webpage with contact info:
http://eecs.oregonstate.edu/research/members/budd/index.html

For the students that do want to contribute to open source, you might
encourage them to read Karl Fogel's, Producing Open Source Software:
http://producingoss.com/en/index.html


  * could use some help!

At one point I was putting together a series of example OpenGL
programs in Haskell.  It's bitrotted these days and I'm not sure it
needs updated to work with newer versions of HOpenGL.  Interested
students could polish it up and add more examples to it.  I was
translating examples from other languages, but creative students could
invent their own examples.

And, as I'm sure Don Stewart will point out, there is the Haskell
reddit list of projects, although possibly too ambitious for 3-4
weeks:
http://www.reddit.com/r/haskell_proposals/top/?t=year

The Date/Time api might be a good one from that list while running
haskell code under google's native client is probably a bit too much
to ask for :)

I hope that helps,
Jason
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Projects that could use student contributions?

2010-08-31 Thread Alexander Solla


On Aug 31, 2010, at 1:52 PM, Brent Yorgey wrote:


This fall I'll be teaching a half-credit introduction to Haskell to
some undergrads.  As a final project I am thinking of giving them the
option of (instead of developing some program/project of their own)
contributing to an existing open-source Haskell project.  Of course,
this requires the existence of projects they could contribute to.  I'm
sure they exist, but need your help to figure out what they are.  So,
do you maintain, or know of, any projects with the following
characteristics?


Maybe the Haskell-related Google Summer of Code proposals would be  
useful to you?


http://hackage.haskell.org/trac/summer-of-code/___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] On to applicative

2010-08-31 Thread michael rice
Thanks, Brandon, but Ryan gave me what I was looking for.

Michael

--- On Tue, 8/31/10, Brandon S Allbery KF8NH allb...@ece.cmu.edu wrote:

From: Brandon S Allbery KF8NH allb...@ece.cmu.edu
Subject: Re: [Haskell-cafe] On to applicative
To: haskell-cafe@haskell.org
Date: Tuesday, August 31, 2010, 4:35 PM

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 8/31/10 13:27 , michael rice wrote:
 So it's a type constructor, not a type? Could you please provide a simple
 example of its usage?

Assuming you don't mean the trivial use in defining functions, see
Control.Monad.Instances:

 instance Functor ((-) r) where
         fmap = (.)
 
 instance Monad ((-) r) where
         return = const
         f = k = \ r - k (f r) r

(The above is the primitive reader functor/monad, see Control.Monad.Reader
for more information.)

- -- 
brandon s. allbery     [linux,solaris,freebsd,perl]      allb...@kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon university      KF8NH
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkx9Z4EACgkQIn7hlCsL25WgrwCgvFQlObavv1fNOaKDjB/qbk8t
8+IAoLUrenXFzZFfJoYYvSy00uPctnaE
=ljiY
-END PGP SIGNATURE-
___
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] :Trace has no history

2010-08-31 Thread Steve Severance
How do I tell? Does this mean that if the exception is occurring in a
haskell library I can't get to it? I am trying to run down a
Prelude.read: No Parse error and I need to see the value that it is
failing to parse on.

Thanks.

Steve

On Tue, Aug 31, 2010 at 11:05 AM, Pepe Iborra pepeibo...@gmail.com wrote:
 Hi Steve

 The debugger only traces calls in interpreted code. Perhaps the call
 to myMethod is being made from object code?

 Admittedly, the ghci debugger can take some effort to learn to use
 properly. Make sure that you give a look to the ghc user guide if you
 haven't done so yet.


 Best,
 pepe

 On Tuesday, August 31, 2010, Steve sseve...@gmail.com wrote:
 I am trying to debug a problem in GHCI. I invoke my method with trace
 but when it breaks on exception i can't get this history. Output is
 below. Thanks.


 relude Symbols :set -fbreak-on-exception
 Prelude Symbols :trace myMethod
 Loading package HUnit-1.2.2.1 ... linking ... done.
 Loading package syb-0.1.0.2 ... linking ... done.
 Loading package base-3.0.3.2 ... linking ... done.
 Loading package old-locale-1.0.0.2 ... linking ... done.
 Loading package time-1.1.4 ... linking ... done.
 Loading package random-1.0.0.2 ... linking ... done.
 Loading package QuickCheck-1.2.0.0 ... linking ... done.
 Loading package Decimal-0.1.0 ... linking ... done.
 Loading package array-0.3.0.0 ... linking ... done.
 Loading package Diff-0.1.2 ... linking ... done.
 Loading package bytestring-0.9.1.5 ... linking ... done.
 Loading package containers-0.3.0.0 ... linking ... done.
 Loading package mtl-1.1.0.2 ... linking ... done.
 Loading package old-time-1.0.0.3 ... linking ... done.
 Loading package convertible-1.0.9 ... linking ... done.
 Loading package utf8-string-0.3.4 ... linking ... done.
 Loading package HDBC-2.2.6 ... linking ... done.
 Loading package HDBC-mysql-0.6.3 ... linking ... done.
 Loading package parsec-2.1.0.1 ... linking ... done.
 Loading package network-2.2.1.7 ... linking ... done.
 Loading package HTTP-4000.0.9 ... linking ... done.
 Loading package binary-0.5.0.2 ... linking ... done.
 Loading package digest-0.0.0.8 ... linking ... done.
 Loading package filepath-1.1.0.3 ... linking ... done.
 Loading package unix-2.4.0.0 ... linking ... done.
 Loading package directory-1.0.1.0 ... linking ... done.
 Loading package pretty-1.0.1.1 ... linking ... done.
 Loading package zlib-0.5.2.0 ... linking ... done.
 Loading package zip-archive-0.1.1.6 ... linking ... done.
 Loading package Core-0.0.1 ... linking ... done.
 Beginning Update
 Stopped at exception thrown
 _exception ::
  e = GHC.Exception.SomeException (GHC.Exception.D:Exception _

 (GHC.Show.D:Show ...) )
                                  (GHC.IO.Exception.IOError Nothing
 GHC.IO.Exception.UserError )
 [exception thrown] Prelude Symbols :history
 Empty history. Perhaps you forgot to use :trace?
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


 --
 -- José Iborra        http://www.dsic.upv.es/~jiborra
 -- UPV Valencia       Telf. (+34) 96 387 00 00 (ext) 83529
 -- Camino de Vera s/n. 46022 Valencia (Spain)




-- 

Steve Severance
c. 240.472.9645
e. st...@medwizard.net

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


Re: [Haskell-cafe] Quick Question for QuickCheck2

2010-08-31 Thread Ivan Lazar Miljenovic
Do you have ~/.cabal/bin or $HOME/.cabal/bin ?  The latter is
preferable as some issues arise with the former...

On 1 September 2010 03:29, Lyndon Maydwell maydw...@gmail.com wrote:
 Yep :)

 Is there a batch of information that might be useful? I can send any
 relevant files, aliases, versions, etc at once to help if you like.

 On Wed, Sep 1, 2010 at 12:35 AM, Sebastian Höhn
 sebastian.ho...@iig.uni-freiburg.de wrote:

 Do you have ~/.cabal/bin/ in your PATH?

 - Sebastian

 Am 31.08.2010 um 15:57 schrieb Lyndon Maydwell:

 Yep. Definitely the same user.

 On Tue, Aug 31, 2010 at 7:35 PM, Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com wrote:
 On 31 August 2010 20:38, Lyndon Maydwell maydw...@gmail.com wrote:
 ghc-pkg check doesn't list any broken dependencies.

 You sure this is with the same user?  ghci is unlikely to complain
 about broken libraries if ghc-pkg check doesn't...

 --
 Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com
 IvanMiljenovic.wordpress.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 mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] questions about Arrows

2010-08-31 Thread Ben
Hello --

Three related questions, going from most specific to most general :

1 ) Consider the stream processing arrow which computes a running sum,
with two implementations : first using generic ArrowCircuits (rSum);
second using Automaton (rSum2) :

module Foo where

import Control.Arrow
import Control.Arrow.Operations
import Control.Arrow.Transformer
import Control.Arrow.Transformer.All

rSum :: ArrowCircuit a = a Int Int
rSum = proc x - do
  rec out - delay 0 - out + x
  returnA - out

rSum2 = Automaton (f 0)
  where f s n = let s' = s + n
in (s', Automaton (f s'))

runAuto _ [] = []
runAuto (Automaton f) (x:xs) =
  let (y, a) = f x
  in y : runAuto a xs

take 10 $ runAuto rSum [1..]
[0,1,3,6,10,15,21,28,36,45]

take 10 $ runAuto rSum2 [1..]
[1,3,6,10,15,21,28,36,45,55]

Note that the circuit version starts with the initial value zero.

Is there a way to write rSum2 in the general ArrowCircuit form, or
using ArrowLoop?

2) Are the ArrowLoop instances for (-), Kleisli Identity, and
Kleisli ((-) r) all morally equivalent?  (e.g., up to tagging and untagging?)

3) One can define fix in terms of trace and trace in terms of fix.

trace f x = fst $ fix (\(m, z) - f (x, z))
fix f = trace (\(x, y) - (f y, f y)) undefined

Does this mean we can translate arbitrary recursive functions into
ArrowLoop equivalents?

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


[Haskell-cafe] ANNOUNCE: text 0.8.0.0, fast Unicode text support

2010-08-31 Thread Bryan O'Sullivan
New in this release:

   - Substantial performance improvements.
   - Bug fixes, and better quality assurance via automated QuickCheck and
   HPC tests and coverage.
   - An even nicer API than before.

The text library provides an efficient packed, immutable Unicode text type
(both strict and lazy), with a powerful loop fusion optimization framework.

The 'Text' type represents Unicode character strings, in a time
and space-efficient manner. This package provides text
processing capabilities that are optimized for performance critical use,
both in terms of large data quantities and high speed.

The text package provides character-encoding, type-safe case conversion via
whole-string case conversion functions. It also provides a range of
functions for converting Text values to and from ByteStrings, using several
standard encodings (see the text-icu package for a much larger variety of
encoding functions). Efficient locale-sensitive support for text I/O is also
supported.

http://www.serpentine.com/blog/2010/09/01/major-version-of-the-haskell-text-library-0-8-0-0/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Missing documentation in Haskell Platform on Windows

2010-08-31 Thread Arnaud Bailly
Hello,
I installed (succesfully) HAskell Platform 2010.2 on windows and have a
small but annoying issue: Some links in HTML documentation lead to broken
links. I did not investigate all the links, but I have seen that all doc
under Control.Monad.XXX is missing. What am I doing wrong ?

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


Re: [Haskell-cafe] Missing documentation in Haskell Platform on Windows

2010-08-31 Thread Ivan Lazar Miljenovic
On 1 September 2010 14:25, Arnaud Bailly arnaud.oq...@gmail.com wrote:
 Hello,
 I installed (succesfully) HAskell Platform 2010.2 on windows and have a
 small but annoying issue: Some links in HTML documentation lead to broken
 links. I did not investigate all the links, but I have seen that all doc
 under Control.Monad.XXX is missing. What am I doing wrong ?

Is this in the documentation for GHC?  Sometimes Haddock links to
libraries used when building GHC but aren't shipped with GHC; I'm not
sure how to deal with this.

(Note: this isn't a Windows-specific problem; it also occurs on Gentoo
Linux for example.)


 Arnaud

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





-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Quick Question for QuickCheck2

2010-08-31 Thread Lyndon Maydwell
$HOME/.cabal/bin

On Wed, Sep 1, 2010 at 10:55 AM, Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com wrote:
 Do you have ~/.cabal/bin or $HOME/.cabal/bin ?  The latter is
 preferable as some issues arise with the former...

 On 1 September 2010 03:29, Lyndon Maydwell maydw...@gmail.com wrote:
 Yep :)

 Is there a batch of information that might be useful? I can send any
 relevant files, aliases, versions, etc at once to help if you like.

 On Wed, Sep 1, 2010 at 12:35 AM, Sebastian Höhn
 sebastian.ho...@iig.uni-freiburg.de wrote:

 Do you have ~/.cabal/bin/ in your PATH?

 - Sebastian

 Am 31.08.2010 um 15:57 schrieb Lyndon Maydwell:

 Yep. Definitely the same user.

 On Tue, Aug 31, 2010 at 7:35 PM, Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com wrote:
 On 31 August 2010 20:38, Lyndon Maydwell maydw...@gmail.com wrote:
 ghc-pkg check doesn't list any broken dependencies.

 You sure this is with the same user?  ghci is unlikely to complain
 about broken libraries if ghc-pkg check doesn't...

 --
 Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com
 IvanMiljenovic.wordpress.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 mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




 --
 Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com
 IvanMiljenovic.wordpress.com

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


Re: [Haskell-cafe] ANNOUNCE: text 0.8.0.0, fast Unicode text support

2010-08-31 Thread John Millikin
Is there a summary of the API changes available? I see a new module,
but Precis is choking on Data.Text and Data.Text.Lazy, so I'm not sure
what existing signatures have been modified.

 Don't forget, you can always improve the text library yourself. I love to 
 receive
 patches, requests for improvement, and bug reports.

Are there any areas in particular you'd like help with, for either
library? I'm happy to assist any effort which will help reduce use of
String.

[aside] does anybody know how to get a list of what packages
somebody's uploaded to Hackage? I think I've updated all mine for the
new text version dependency, but I'm worried I forgot some.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe