Re: [Haskell-cafe] category theory as a design tool

2011-06-22 Thread Brett Giles
Hi Arnaud, you may want to look at 
http://mathcs.mta.ca/research/rosebrugh/Easik/

This is a java tool which allows entity design using various cat theory 
constraints such as sum, product and pullbacks. 


Brett Giles
Sent from my iPhone

 Message: 14
 Date: Wed, 22 Jun 2011 14:06:21 -0500
 From: Gregg Reynolds d...@mobileink.com
 Subject: Re: [Haskell-cafe] Category theory as a design tool
 To: Arnaud Bailly arnaud.oq...@gmail.com
 Cc: Haskell Cafe haskell-cafe@haskell.org
 Message-ID: banlktingaplo7ysyggg1duxbw5ik1kl...@mail.gmail.com
 Content-Type: text/plain; charset=utf-8
 
 On Tue, Jun 21, 2011 at 11:30 PM, Arnaud Bailly arnaud.oq...@gmail.com
 wrote:
 (2nd try, took my gloves off...)
 Hello Caf?,
 I have been fascinated by Cat. theory for quite a few years now, as
 most people who get close to it I think.
 
 I am a developer, working mostly in Java for my living and dabbling
 with haskell and scala in my spare time and assuming the frustration
 of having to live in an imperative word. More often than not, I find
 myself trying to use constructs from FP in my code, mostly simple
 closures and typical data types (eg. Maybe, Either...). I have read
 with a lot of interest FPS (http://homepages.mcs.vuw.ac.nz/~tk/fps/)
 which exposes  a number of OO patterns inspired by FP.
 
 Are there works/thesis/books/articles/blogs that try to use Cat.
 theory explicitly as a tool/language for designing software (not as an
 underlying formalisation or semantics)? Is the question even
 meaningful?
 
 You might try: Category Theory for Computing
 Sciencehttp://www.cwru.edu/artsci/math/wells/pub/ctcs.html (Barr
 and Wells)
 
 and Conceptual Mathematics: a first introduction to
 categorieshttp://books.google.com/books/about/Conceptual_mathematics.html?id=o1tHw4W5MZQC
 (Lawvere)
 
 Kinship and Mathematical Categories (by Lawvere) is also interesting.
 
 -Gregg
 
 
 Thanks in advance,
 Arnaud
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 -- next part --
 An HTML attachment was scrubbed...
 URL: 
 http://www.haskell.org/pipermail/haskell-cafe/attachments/20110622/9f65e9e9/attachment-0001.htm
 
 --
 
 Message: 15
 Date: Wed, 22 Jun 2011 21:59:11 +0200
 From: Arnaud Bailly arnaud.oq...@gmail.com
 Subject: Re: [Haskell-cafe] Category theory as a design tool
 To: Gregg Reynolds d...@mobileink.com
 Cc: Haskell Cafe haskell-cafe@haskell.org
 Message-ID: BANLkTikUtRA4=0qhluq6kzm6ijtc4wh...@mail.gmail.com
 Content-Type: text/plain; charset=iso-8859-1
 
 Hello Greg and Alexander,
 Thanks for your replies. Funnily, I happen to own the 3 books you mentionned
 :-) My interest in category theory is a long standing affair...
 
 Note that owning a book, having read (most of) it and knowing a theory (or
 at least its principles and main concepts) is really quite a different thing
 from being able to apply it. Although I am certainly able to understand the
 Yoneda lemma, I am certainly unable to recognize the opportunity of using
 that knowledge to derive some new knowledge about something else. And being
 able to define a topoi is very different from being able to construct one or
 infer one out of a given category. This is an actual limitation of myself of
 course.
 
 Alexander's advice about using diagrams and simple notations is something I
 often try to do and something which most of the times end in writing a bunch
 of functions and data types in Haskell... What I am really looking for is a
 more systematic way of thinking about systems (or system fragments, or
 components) in a categorical way, perhaps starting with a bunch of arrows in
 some abstract category with objects as components and trying to infer new
 objects out of categorical consturctions which are made possible by the
 current diagrams (eg. what would be a pullback in such a category ? What
 would be its meaning ? Does the question itself have a meaning ?).
 
 Maybe this is really foggy and on the verge to fall into abstract
 nonsense...
 
 Best regards,
 arnaud
 

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


[Haskell-cafe] Re: [Gtk2hs-users] Woes on MacOS 10.6 - linking issues -now working, but Glade is missing in v0.11 and v0.10.1 still won't compile

2010-06-12 Thread Brett Giles
Hi everyone,

Thanks for the variety of suggestions - I resolved this by uninstalling the 
Haskell-platform DMG based package and using the one from macports. I then, as 
mentioned elsewhere, manually modified my hsc2hs shell script to ensure the 
correct code was generated.

However, I see that the cabal install for version 11 contains no Glade modules. 
I saw there was a patch posted by Andy Stewart for it a while back, is there 
any ETA for it for the public?

I am, (so sad for me:) a bit hooped as I was going to give a demo of a program 
in a couple of days, but my code depends heavily on Glade and I can't seem to 
get the prior version of Gtk2HS (0.10.1) to compile at all.  (Issues with 
x86_64 vs i386 - but I have tried for three hours to get the magic combination 
of modifications to the ghc script, the hsc2hs script and environment variable 
to no avail).

If anyone has had luck on getting the 10.1 version to build (on a brand new 
install of OSx v10.6.3, macports Haskell Platform meaning GHC is 6.10.4, I'd 
love to hear how you did it.

(I did check out the variety of tickets related to this, especially 
http://hackage.haskell.org/trac/ghc/ticket/3400 and the recent conversations on 
this list between Chris K. and Axel.
 
 
 On Jun 11,2010, at 2:40 AM, Axel Simon wrote:
 
 Hi Brett,
 
 On 11.06.2010, at 04:53, Brett Giles wrote:
 
 Hi Folks
 
 I seem to have Gtk2HS 0.11 installed, but not quite working. Interestingly, 
 I can run a demo, such as the hello/World.hs example, directly in ghci. 
 However, when I try to do a ghc --make on any code containing gtk2hs I get 
 a link error like this:
 
 Undefined symbols:
 _iconv_close, referenced from:
_hs_iconv_close in libHSbase-4.2.0.0.a(iconv.o)
   (maybe you meant: _hs_iconv_close)
 _iconv, referenced from:
_hs_iconv in libHSbase-4.2.0.0.a(iconv.o)
   (maybe you meant: _hs_iconv_open, _hs_iconv , _hs_iconv_close )
 _iconv_open, referenced from:
_hs_iconv_open in libHSbase-4.2.0.0.a(iconv.o)
   (maybe you meant: _hs_iconv_open)
 ld: symbol(s) not found
 
 
 I do have libiconv installed as a universal library via macports. gtk, 
 glade etc., are also universal installed via macports.
 
 
 I downloaded the OSX Haskell Platform package and am running ghc 6.12.1
 
 
 
 The iconv issue is usually that you also have a libiconv that Apple ships. 
 The platform ghc probably links against that while macports (and thus Gtk+) 
 uses its own. I have no idea who's to blame here but I guess you should be 
 trying to change your LD_LIBRARY_PATH or your DYLD_LIBRARY_PATH to /opt/sw 
 since that contains the more complete version.
 
 Cheers,
 Axel

Brett Giles
Grad Student, Formal Methods, Category Theory,
University of Calgary
brett.gi...@ucalgary.ca



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


[Haskell-cafe] Re: [Gtk2hs-users] Woes on MacOS 10.6 - linking issues -now working, but Glade is missing in v0.11 and v0.10.1 still won't compile SOLVED compile of 10.1

2010-06-12 Thread Brett Giles
Finally figured it out - leave the scripts for ghc and hsc2hs alone and do the 
configure for gtk2hs 0.10.11 like this:


./configure --with-hsc2hs='--cc-flag=-m32 --ld-flag=-m32' 


On Jun 12,2010, at 3:53 PM, Brett Giles wrote:

 Hi everyone,
 
 Thanks for the variety of suggestions - I resolved this by uninstalling the 
 Haskell-platform DMG based package and using the one from macports. I then, 
 as mentioned elsewhere, manually modified my hsc2hs shell script to ensure 
 the correct code was generated.
 
 However, I see that the cabal install for version 11 contains no Glade 
 modules. I saw there was a patch posted by Andy Stewart for it a while back, 
 is there any ETA for it for the public?
 
 I am, (so sad for me:) a bit hooped as I was going to give a demo of a 
 program in a couple of days, but my code depends heavily on Glade and I can't 
 seem to get the prior version of Gtk2HS (0.10.1) to compile at all.  (Issues 
 with x86_64 vs i386 - but I have tried for three hours to get the magic 
 combination of modifications to the ghc script, the hsc2hs script and 
 environment variable to no avail).
 
 If anyone has had luck on getting the 10.1 version to build (on a brand new 
 install of OSx v10.6.3, macports Haskell Platform meaning GHC is 6.10.4, I'd 
 love to hear how you did it.
 
 (I did check out the variety of tickets related to this, especially 
 http://hackage.haskell.org/trac/ghc/ticket/3400 and the recent conversations 
 on this list between Chris K. and Axel.
 
 
 On Jun 11,2010, at 2:40 AM, Axel Simon wrote:
 
 Hi Brett,
 
 On 11.06.2010, at 04:53, Brett Giles wrote:
 
 Hi Folks
 
 I seem to have Gtk2HS 0.11 installed, but not quite working. Interestingly, 
 I can run a demo, such as the hello/World.hs example, directly in ghci. 
 However, when I try to do a ghc --make on any code containing gtk2hs I get 
 a link error like this:
 
 Undefined symbols:
 _iconv_close, referenced from:
_hs_iconv_close in libHSbase-4.2.0.0.a(iconv.o)
   (maybe you meant: _hs_iconv_close)
 _iconv, referenced from:
_hs_iconv in libHSbase-4.2.0.0.a(iconv.o)
   (maybe you meant: _hs_iconv_open, _hs_iconv , _hs_iconv_close )
 _iconv_open, referenced from:
_hs_iconv_open in libHSbase-4.2.0.0.a(iconv.o)
   (maybe you meant: _hs_iconv_open)
 ld: symbol(s) not found
 
 
 I do have libiconv installed as a universal library via macports. gtk, 
 glade etc., are also universal installed via macports.
 
 
 I downloaded the OSX Haskell Platform package and am running ghc 6.12.1
 
 
 
 The iconv issue is usually that you also have a libiconv that Apple ships. 
 The platform ghc probably links against that while macports (and thus Gtk+) 
 uses its own. I have no idea who's to blame here but I guess you should be 
 trying to change your LD_LIBRARY_PATH or your DYLD_LIBRARY_PATH to /opt/sw 
 since that contains the more complete version.
 
 Cheers,
 Axel
 
 Brett Giles
 Grad Student, Formal Methods, Category Theory,
 University of Calgary
 brett.gi...@ucalgary.ca
 
 
 
 
 --
 ThinkGeek and WIRED's GeekDad team up for the Ultimate 
 GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
 lucky parental unit.  See the prize list and enter to win: 
 http://p.sf.net/sfu/thinkgeek-promo
 ___
 Gtk2hs-users mailing list
 gtk2hs-us...@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/gtk2hs-users
 
 

Brett Giles
Grad Student, Formal Methods, Category Theory,
University of Calgary
brett.gi...@ucalgary.ca



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


[Haskell] Woes on MacOS 10.6 - linking issues

2010-06-10 Thread Brett Giles
Hi Folks

I seem to have Gtk2HS 0.11 installed, but not quite working. Interestingly, I 
can run a demo, such as the hello/World.hs example, directly in ghci. However, 
when I try to do a ghc --make on any code containing gtk2hs I get a link error 
like this:

Undefined symbols:
  _iconv_close, referenced from:
  _hs_iconv_close in libHSbase-4.2.0.0.a(iconv.o)
 (maybe you meant: _hs_iconv_close)
  _iconv, referenced from:
  _hs_iconv in libHSbase-4.2.0.0.a(iconv.o)
 (maybe you meant: _hs_iconv_open, _hs_iconv , _hs_iconv_close )
  _iconv_open, referenced from:
  _hs_iconv_open in libHSbase-4.2.0.0.a(iconv.o)
 (maybe you meant: _hs_iconv_open)
ld: symbol(s) not found


I do have libiconv installed as a universal library via macports. gtk, glade 
etc., are also universal installed via macports.

I downloaded the OSX Haskell Platform package and am running ghc 6.12.1

Other programs seem to be having some issues as well though,  For instance, a 
command line program seems to compile fine, but when it runs I get the message:

$ emlqpl (--- My successfully compiled program - batch only, no gtk items)
dyld: Library not loaded: /opt/local/lib/libgtk-quartz-2.0.0.dylib
  Referenced from: /usr/local/bin/emlqpl
  Reason: image not found
Trace/BPT trap



Does anyone have any suggestions?

Brett Giles
Grad Student, Formal Methods, Category Theory,
University of Calgary
brett.gi...@ucalgary.ca



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


Re: [Haskell] same type multiply implementing a class

2007-03-16 Thread Brett Giles
Note the live version of this on haskell wiki is at:
http://www.haskell.org/haskellwiki/Wrapper_types

The link below is for the old non-editible version of the haskel wiki.
On Thu, 2007-03-15 at 15:34 -0600, Derek Elkins wrote:
 Wolfgang Jeltsch wrote:
  Am Donnerstag, 15. März 2007 03:23 schrieb Daniel Mahler:
  Is there any way for the same type to implement a typeclass multiple ways.
  
  You can wrap the type using newtype, thus creating a new type which can 
  implement type class methods differently.
 
 This technique is sometimes known as a typeclass wrapper and is related to 
 wrapper types and combines well with phantom types. See 
 http://www.haskell.org/hawiki/WrapperTypes
 ___
 Haskell mailing list
 Haskell@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell

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


Re: [Haskell] HaWiki closing in one month; migrate content to HaskellWiki now!

2006-10-05 Thread Brett Giles
For those of you busy moving the changes over, you may want to check out
the new Haskell wiki guidelines at
http://haskell.org/haskellwiki/HaskellWiki:Guidelines as there are some
differences with the old HaWiki (especially in page naming :)

Also the editing help at http://haskell.org/haskellwiki/Help:Editing
contains a summary of some of the formatting differences between the old
and new wiki's.




 Hi all,

 HaWiki[1] has been deprecated since the beginning of this year[2] when
 the new HaskellWiki[3] was introduced. However, we are now in the
 situation where we have both wikis running in parallel, which
 occasionally causes confusion to users, and means we have outdated
 information lying around on the old wiki.

 We have therefore decided that the old wiki will be taken down at the
 end of this month. If there is any information on it that you think
 should be kept but has not yet been migrated to the new wiki, this is
 the time to act!

 We have made a page for handling the migration, listing all the pages on
 the old wiki:
 http://www.haskell.org/haskellwiki/HaWiki_migration
 If you migrate a page, or find that it has already been migrated, then
 remove it from the list.

 Remember you need to check licences before moving content to the new
 wiki!


 Thanks
 Ian and Shae


 [1] http://www.haskell.org/hawiki/
 [2] http://www.haskell.org/pipermail/haskell/2006-January/017287.html
 [3] http://www.haskell.org/haskellwiki/Haskell



Brett Giles
Grad Student, Formal Methods UofC
http://pages.cpsc.ucalgary.ca/~gilesb
http://haskell.org/haskellwiki/User:BrettGiles


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


Re: [Haskell] Who brought the monad to us?

2005-08-29 Thread Brett Giles
Hi Wolfgang

You may want to consider the papers by E. Moggi on Monadic computation
(1989, 1990) at http://www.disi.unige.it/person/MoggiE/publications.html
and Andrew Gordon's  thesis Functional Programming and
Input/Output (Sorry, I don't have a URL).

Brett Giles
[EMAIL PROTECTED]  http://pages.cpsc.ucalgary.ca/~gilesb

On Mon, 2005-08-29 at 18:20 +0200, Wolfgang Jeltsch wrote:
 Hello,
 
 is it right to say that Philip Wadler was the one who invented monadic I/O or 
 were there others who did so together with Wadler? I need this for my 
 thesis. :-)
 
 Best wishes,
 Wolfgang
 ___
 Haskell mailing list
 Haskell@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell

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


Compiler 5.02 asked me to report a bug.

2002-02-09 Thread Brett Giles

Hi, While using green-card to create an interface for postgres database 
access, I recieved the following when I executed

ghc -c PG.hs -o PG.o -fglasgow-exts -i/usr/local/gc-2.03/lib/ghc  
-package text -package data -package util


ghc-5.02: panic! (the `impossible' happened, GHC version 5.02):
Native code generator can't handle foreign call
{-_ccall-}__casm ``do {PGresult * t;int result;
 t = (PGresult *)%0;
 do {   result = PQnfields( t );
 
 %r = (int)(result);} while(0);} while(0);''

Please report it as a compiler bug to [EMAIL PROTECTED],
or http://sourceforge.net/projects/ghc/.


I am using a newly compiled version of green-card (2.03) on Debian 
testing. This is interfacing to postgres version 7.1.3, standard Debian 
install.

The ghc is the standard Debian testing install asl well.

I have attached the PG.gc ,hs and .hi files, as well as an optional 
include file used for hugs...

Please note, this interface has been working for hugs (albeit with problems)

Please let me know if there is anything I can do to assist in further 
debugging.


Brett Giles
Grad Student in formal methods, University of Calgary, 
http://www.cpsc.ucalgary.ca/~gilesb




module PG where

-- (
--{-type-} PGConn,
--connect, quickConnect, disConnect,
--host, port, user, tty, dbName, options, query,
--{-type-} PGResult, PGResEmpty, PGResOk, PGResCOut, PGResCIn,
--   PGResBad, PGResError, PGResTuples,
--   {-type-} PGTuples,
--nFields, nTuples, fld2Inx, inx2Fld, getVal, getValNamed,
--fields, row, col, colNamed, values
-- )
-- where

import StdDIS

-- encapsulate the foreign objects ( C pointers )
newtype PGConn  = PGC ForeignObj-- a connection
newtype PGTuples= PGT ForeignObj-- result tuples

instance Eq PGTuples where
  _ == _= False

instance Show PGTuples where
  showsPrec _ _ = showString TUPLES

data PGResult = PGResEmpty
  | PGResOk
  | PGResCOut
  | PGResCIn
  | PGResTuples PGTuples
  | PGResBad String
  | PGResError String
 deriving Eq

instance Show PGResult where
  showsPrec _ PGResEmpty= showString PGRES: empty query
  showsPrec _ PGResOk   = showString PGRES: query ok
  showsPrec _ PGResCOut = showString PGRES: copy out started
  showsPrec _ PGResCIn  = showString PGRES: copy in started
  showsPrec _ (PGResBad s)  = showString ( PGRES: ++ s ++  )
  showsPrec _ (PGResError s)= showString ( PGRES: ++ s ++  )
  showsPrec _ (PGResTuples t)   = showString (show t)

-- BEGINNING of GreenCard code -

%#include hskPG.h

%dis pgconn pgc = PGC (declare {PGconn *} pgc in (foreign pgc {PQfinish}))
%dis pgtuples pgt = PGT (declare {PGresult *} pgt in (foreign pgt {freePGRes}))

%fun primCmpTuples  :: PGTuples - PGTuples - Bool
%call   (pgtuples a) (pgtuples b)
%code   res = 1;
%result (bool res)

%fun connect :: String - String - String - String - String - String -
%String - IO PGConn
%call   (string pghost) (string pgport) (string pgoptions) (string pgtty)
%   (string dbName) (string login) (string pwd)
%code   ConnStatusType  status;
%   res = PQsetdbLogin ( pghost, pgport, pgoptions,
% pgtty, dbName, login, pwd );
%   status = PQstatus( res );
%   if ( status == CONNECTION_BAD ) PQfinish( res );
%fail   { status == CONNECTION_BAD } { PQerrorMessage( res ) }
%result (pgconn res)

%fun disConnect :: PGConn - IO ()
%call (pgconn conn)
%code  PQfinish (conn);

%fun quickConnect :: String - String - String - IO PGConn
%call   (string pghost) (string pgport) (string dbName)
%code   ConnStatusType  status;
%   res = PQsetdbLogin ( pghost, pgport, NULL, NULL, dbName, NULL, NULL );
%   status = PQstatus( res );
%   if ( status == CONNECTION_BAD ) PQfinish( res );
%fail   { status == CONNECTION_BAD } { PQerrorMessage( res ) }
%result (pgconn res)

%fun host   :: PGConn - String
%call   (pgconn conn)
%code   res = PQhost( conn ); if ( !res ) res = ;
%result (string res)

%fun port   :: PGConn - String
%call   (pgconn conn)
%code   res = PQport( conn ); if ( !res ) res = ;
%result (string res)

%fun user   :: PGConn - String
%call   (pgconn conn)
%code   res = PQuser( conn ); if ( !res ) res = ;
%result (string res)

%fun dbName :: PGConn - String
%call   (pgconn conn)
%code   res = PQdb( conn ); if ( !res ) res = ;
%result (string res)

%fun tty:: PGConn - String
%call   (pgconn conn)
%code   res = PQtty( conn ); if ( !res ) res = ;
%result (string res)

%fun options:: PGConn - String
%call   (pgconn conn)
%code   res = PQoptions( conn ); if ( !res ) res