Re: [Haskell] Type Lambdas in Gofer
On Wed, Aug 01, 2007 at 07:57:48AM +0200, Wolfgang Lux wrote: Jim Apple wrote: data Rec f = In (f (Rec f)) type P f a = f (Rec f, a) mapP :: Functor f = (a - b) - P f a - P f b mapP g = fmap (\(x,a) - (x, g a)) instance Functor f = Functor (P f) where fmap = mapP Why did Gofer have this power while Haskell does not? Haskell does have the same power as Gofer, it simply does not allow you to define instances for type synonyms (just in order to prevent overlapping instances, I guess). If you use a newtype instead of a type synonym everything works fine: Quite probably they never bothered to test it. [EMAIL PROTECTED]:/usr/local/src/gofer$ tail -15 standard.prelude openfile f = primFopen f (error (can't open file ++f)) id -- End of Gofer standard prelude: class Functor f where fmap :: (a - b) - f a - f b data Rec f = In (f (Rec f)) type P f a = f (Rec f, a) mapP :: Functor f = (a - b) - P f a - P f b mapP g = fmap (\(x,a) - (x, g a)) instance Functor f = Functor (P f) where fmap = mapP [EMAIL PROTECTED]:/usr/local/src/gofer$ src/gofer Gofer Version 2.30b Copyright (c) Mark P Jones 1991-1995 Reading script file standard.prelude: ERROR standard.prelude (line 874): Not enough arguments for type synonym P FATAL ERROR: Unable to load prelude [EMAIL PROTECTED]:/usr/local/src/gofer$ Stefan signature.asc Description: Digital signature ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
Re: [Haskell] Type Lambdas in Gofer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 - -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Wolfgang, Why did Gofer have this power while Haskell does not? Quite probably they never bothered to test it. More probably ;-) they did test it and just swept it under the carpet in order not to pollute the paper with this detail. From a theoretical point of view, one could argue that it indeed does not matter all that much here. Cheers, Stefan - -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (Darwin) iD8DBQFGsMcQX0lh0JDNIpwRAsGfAJ9q01MGgxY0/xuQSVuEVcIbrdMvmgCffYrS OVgdcXXgDpcneXGxAw+VF4g= =EeQ2 - -END PGP SIGNATURE- -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (Darwin) iD8DBQFGsMcUX0lh0JDNIpwRAicdAKCA66w62+V+yKRpYjV86BbnNSMQpwCcDghZ t+G0sPzvIfdVaSO5pLLwNos= =H1MX -END PGP SIGNATURE- ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
[Haskell] Type Lambdas in Gofer
The code in Bananas in Space: Extending Fold and Unfold to Exponential Types http://citeseer.ist.psu.edu/293490.html mirror: http://www.cs.nott.ac.uk/~gmh/bananas.pdf uses Gofer, and has examples such as data Rec f = In (f (Rec f)) type P f a = f (Rec f, a) mapP :: Functor f = (a - b) - P f a - P f b mapP g = fmap (\(x,a) - (x, g a)) instance Functor f = Functor (P f) where fmap = mapP Why did Gofer have this power while Haskell does not? Jim ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
Re: [Haskell] Type Lambdas in Gofer
Jim Apple wrote: data Rec f = In (f (Rec f)) type P f a = f (Rec f, a) mapP :: Functor f = (a - b) - P f a - P f b mapP g = fmap (\(x,a) - (x, g a)) instance Functor f = Functor (P f) where fmap = mapP Why did Gofer have this power while Haskell does not? Haskell does have the same power as Gofer, it simply does not allow you to define instances for type synonyms (just in order to prevent overlapping instances, I guess). If you use a newtype instead of a type synonym everything works fine: data Rec f = In (f (Rec f)) newtype P f a = P (f (Rec f, a)) unP (P x) = x mapP :: Functor f = (a - b) - P f a - P f b mapP g = P . fmap (\((x,a)) - (x, g a)) . unP instance Functor f = Functor (P f) where fmap = mapP Wolfgang ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
Announcement of AsmGofer (Gofer with state)
AsmGofer is an extension of TkGofer. TkGofer is an extension of Gofer in order to support graphical user interfaces. Gofer is a subset of Haskell. AsmGofer can be viewed as TkGofer with a notion of state. You can declare dynamic functions and redefine them during execution. Here is one example: ... ? f 3 5 (7 reductions, 16 cells) ? fire1 (f 3 := 1) 1 steps (28 reductions, 49 cells) ? f 3 1 (7 reductions, 16 cells) ? A dynamic function behaves like a "normal" function. You can use it in any expression. Updating of dynamic functions is only allowed on the level the "Rule" monad in order not to get into troubles. More information on AsmGofer can be found at: http://www.uni-ulm.de/~s_jschmi/AsmGofer
RE: Announcement of AsmGofer (Gofer with state)
Hi Joachim, | AsmGofer is an extension of TkGofer. TkGofer is an extension of | Gofer in order to support graphical user interfaces. Gofer is a | subset of Haskell. I'd like to urge you to consider making the AsmGofer distribution more publicly available. I was shocked to find that I couldn't just download a copy from your website. Of course, nothing in the conditions of distribution and use that are attached to Gofer requires you to do this. But a more liberal distribution of AsmGofer would make it easier for people to find out about the system, and perhaps to adapt some of the ideas to other systems, particularly Gofer derivatives like Hugs. Perhaps you have some specific reasons to be cautious about making the release more widely available, but it surely can't be something that is required by Siemens; after all, for better or worse, the Gofer license doesn't allow commercial use. (Fortunately, we've learnt a bit about licensing since then, so Hugs doesn't have this problem...) All the best, Mark
Gofer vs. Haskell 1.4 vs.Standard Haskell vs. implementations
When I read papers from the last eight years they refer to Haskell 1.x or Gofer or some specific implementation.(Hugs, GHC, etc.) Does anyone have a useful summary for how these all compare to each other? As a beginner I struggle a bit when I wonder if I will be able to recreate, say, Liang et al.'s "monad transformers" from their 1995 paper directly in Hugs or HBC or ???. Thanks -- Patrick Logan mailto:[EMAIL PROTECTED] Voice 503-533-3365Fax 503-629-8556 Gemstone Systems, Inc http://www.gemstone.com
Question on output redirection in Gofer
Is there a way in Gofer to perform output redirection? For example, in a version of Miranda I used to work with, one could type a command of the form exp file which would send the value of expression to a file (background process). In this case, both the standard output and the standard error output of the process is redirected to 'file' (where 'file' is a pathname). If two (blank separated) pathnames are given after the '', standard output would be redirected to the first file and standard error to the second. Thus: exp outfil errfil I am new to Gofer, and have not yet found a mention of anything that resembles this capability. Such a feature was handy in Miranda for easily and quickly doing things with text files. I am currently using the Gofer Version 2.30a interpreter on a UNIX System V Release 4.0 system. Thank you. Sincerely, Richard E. Adams [EMAIL PROTECTED]
Re: from gofer to haskell
Dear John, sorry there was a mistake in my last mail, and that's the reason, that it ends so apruptly. The class StateTran is class States a = StateTran t a where trans :: t - a - (StatesMap a) -- give the transformation arity :: t - a - Int -- where 0 means: arbitrary This is the class, which is not Haskell. I need the two members, because I want to have generic transformations, but I cannot leave out t (perhaps leave out a). I just don't know. WfR Andreas
from gofer to haskell
Hi, I have some small algorithms implemented in gofer, using also a little class structure. One class uses two parameters, as it is legal in gofer. But not in haskell. The question, how I come out of this. First idea is: choose one parameter, and put the second one into member function restrictions. The problem is here, that the overloading depends now only on one parameter (which would in this case be no problem). Second idea: some kind of tuple class, that does the projections. But I wonder how in this case the context is handled. Any help is welcome, I confess, I am a haskell greeny. Andreas
Please ignore last message [Re: from gofer to haskell]
Folks- Sorry about that last message; I forgot to remove the CC-to-list from the headers. -John
Re: from gofer to haskell
Dear John, never mind, I have found meanwhile a good (?) hierarchy that does the job. Perhaps I was too impatient about the learning curve. All the examples and also the difficulties with step and apply are overcome. Since all looks very clear, I hope that I am on the right track. On weekend, I wanted to try some algorithms at home on the pc. Since the DOS-gofer had too few cells, I thought of turning to HUGS. ( I retrieved it due to your advice). It drove me into the problem with class parameters (see previous mail). But it is a good way to check whether I am Haskell-conform or not. So please, do not look into the old code, which I send you earlier. The class structure is now: class (Eq a,Ix a) = States a where numberofstates :: a-Int -- of course, this does not depend of an a list :: a - [a] class States a = States0 a where neutral :: a - a class States a = StateTran a where trans :: t - a - (StatesMap a) -- give the transformation arity :: t - a - Int -- where 0 means: arbitrary class (Num a,Ix a) = Grid a where dim :: a - Int type CellSpace n t a = (n,t,a) -- neighb.,transf. rule, states -- dimension can be concluded from n The most important point is, that CellSpace is no class !! I was surprised when I realized that this is the way to go, but it works.
Re: from gofer to haskell
Hi Andreas- I'm sorry to have ignored you for so long. I've been trying to get a handout ready for a praktikum this afternoon (the functional programming one, actually) and it's taken me much longer than I thought...up to this weekend actually. I'll take a good long look at your code tomorrow, after a good night's sleep tonight. -John
Ratatosk - a parser generator and scanner generator for Gofer
_/_/_/ _/ _/ _/ _/_/ _/ _/ _/ _/_/ _/_/_/ _/_/_/_/ _/_/_/ _/_/_/ _/ _/_/_/ _/ _/_/_/_/ _/ _/ _/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/_/ _/ _/_/_/ _/ _/_/ _/_/ _/_/ A Parser Generator and Scanner Generator for Gofer Torben Mogensen ([EMAIL PROTECTED]) Announcing Ratatosk version 0.1. Ratatosk started as an exercise to learn to use Gofer, but grew to be a usable system for generating parsers and scanners to use with Gofer programs. The parser generator generates SLR parsers from a context free syntax, and allows semantic "actions" to be used. The generated parsers will backtrack over shift/reduce and reduce/reduce conflicts, so non-SLR languages can be parsed, at the cost of some extra run-time. You will, however, get warnings about any conflicts found while generating a parser. The scanner generator takes a sequence of token declarations using regular expressions and generates a DFA-based scanner suitable for use with the generated parsers. The scanners counts line numbers for error reporting. The parsers generated by Ratatosk will typically be much faster than parsers using parser combinators (20-25 times faster in some examples we have tried). However, they will also be much larger. Another problem is type-checking. The standard allocation of type variables for Gofers type checking is not large enough to type-check parsers generated by Ratatosk for medium to large grammars, so you might have to recompile Gofer with a larger allocation of type variables. The scanners generated by Ratatosk will usually compare reasonably well speed-wise with simple hand-written scanners, and very well with scanners using parser combinators. However, the scanners tend to get big and have the same problem with type variables as the generated parsers. Ratatosk is available by anonymous ftp from ftp.diku.dk in the directory pub/diku/dists, in the file Ratatosk.tar.Z. Unpack this by uncompress Ratatosk.tar.Z | tar xvpf - which creates a directory Ratatosk, containing the system. The package contains a manual, sources for the parser generator and scanner generator and some example files, including files for bootstrapping the system. Any questions and suggestions can be emailed to Torben Mogensen ([EMAIL PROTECTED])
Gofer on the PC
Please could you tell me how to change the heap size for Gofer for the PC, or direct me to someone who would know. Many thanks Paresh Chauhan ([EMAIL PROTECTED])
Re: Gofer on the PC
Hi, I'm the author of Gofer and I use it quite a bit on PCs myself so I am probably well qualified to answer your question: | Please could you tell me how to change the heap size for Gofer for the PC, | or direct me to someone who would know. Except that, in order to answer this question, you need to tell me which version of Gofer you are running and what kind of machine you are running on. In general, you can set the heap size by starting Gofer with the appropriate command line option: e.g. gofer -h35000 for a 35,000 cell heap, gofer -h12000 for a 12,000 cell heap. However, the maximum heap size on a PC is fairly limited. The only way that you can get a bigger heap than the default (assuming that is what you want) is to use a 386 or better with the 32 bit version of Gofer 2.28. The standard PC version of Gofer runs on any kind of PC but isn't able to access more than 640K of memory, even if your PC actually has 16M. All of this is covered in the documentation for Gofer. Do you need pointers as to where you can get copies? Mark
tags support for Haskell/Gofer
Are there any tools available for producing a GNU Emacs readable tags file from a set of Haskell/Gofer scripts? Ideally this would be an optional output file from a compiler, as it knows where the functions are better than any kludgy awk/perl ... etc. script ever could. However, as I don't currently have a compiler installed, I'll take anything I can get (well I draw the line at Perl :-). I realise that with overloading and definitions spread over multiple lines there could be problems for the standard tags commands. If the normal tags commands can't cope, has anybody looked into some form of alternative/extended tags system? ta Stephen J. Bevan[EMAIL PROTECTED] PS the "d" in "kludge" is deliberate, the hacker's dictionary isn't right about everything :-)
Gofer version 2.21
Original-Via: uk.ac.ox.prg; Mon, 25 Nov 91 18:31:48 GMT [My apologies to those who receive this message from more than one source. In future, messages about new versions of Gofer will be sent to those people on the Gofer mailing list, and will not normally be duplicated in other places.] A new version of Gofer is now available. Particular features added to this version are as follows: o a extended user interface, including: - support for project files to simplify the use of programs whose source code is spread across a number of separate files. - command line options to suppress printing of dictionaries, printing of reduction/cell statistics and to force printing of types. - repeat last expression, $$. - :find command to start editor at line containing definition of a named function. - :set command to provide access to command line options from within Gofer. - :cd command to allow you to change directory within Gofer. - :! command to allow you to access external programs from within Gofer. o a small number of bug fixes. o support for c*p and p+k patterns (for experimentation). o support for `literate scripts'. o a few new demonstration programs. o a supplement to the documentation for the previous version describing the new features. DISTRIBUTION FILES: Source code (for both PC and Sun versions), example programs and documentation are included in a single compressed tar archive: -rw-r--r-- 1 root 369267 Nov 21 12:44 gofer-2.21.tar.Z This archive also contains a small file provided by Stuart Clayman which allows Gofer to be used from within gnuemacs. You may also be interested in a LaTeX version of the documentation which has been prepared by Jeroen Fokker: -rw-r--r-- 1 root 107377 Nov 21 12:47 goferdoc.tex.Z Note that this does not include documentation for the features added in the new release. AVAILABILITY: Gofer 2.21 should now be available from a number of different sources. Here are the ones which are known to me: In the UK: ftp : host: src.doc.ic.ac.uk [146.169.3.7] user: anonymous pass: your email address type: binary directory: languages/haskell/gofer niftp : host: uk.ac.ic.doc.src [janet 05102000] user: guest pass: your email address type: binary file: PUBlanguages/haskell/gofer/gofer-2.21.tar.Z PUBlanguages/haskell/gofer/goferdoc.tex.Z or : host: uk.ac.glasgow.dcs user: guest pass: your email address type: binary file: fp/gofer-2.21.tar.Z fp/goferdoc.tex.Z typical command line for niftp: cpf -b 'xyzfilename@host' filename Elsewhere: ftp : host: nebula.cs.yale.edu: user: anonymous pass: your email address type binary directory: ~ftp/pub/glasgow Gofer can also be obtained by anonymous ftam, interactive telnet or email (the last two WITHIN THE UK ONLY) from src.doc.ic.ac.uk. Please contact me for details. Thanks to all involved for making Gofer available in this way. COMMENTS: There is not likely to be a further release of Gofer for some time, but please do not hesitate to contact me if you have any questions, comments or problems with the current version, or suggestions for features to be incorporated in future versions. All the best, Mark