[Haskell] Type Question
what is the type of 'shf' in > foo :: (a -> String) -> a -> () > foo shw x = > let > shf o = shw o > > in return () for it certainly is not 'shf :: a -> String', as this explicit signature will not type check ? Virus checked by G DATA AntiVirusKit Version: AVK 12.0.37 from 06.12.2002 Virus news: www.antiviruslab.com ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
[Haskell] type question revisited
I answered my own question only to raise another - what I wanted to do is this > foo :: (a -> String) -> [a] -> [String] > foo shw x = > let > shf :: ( forall a . a ) -> String > shf o = shw o > > in map shf x the type of shf is a rank 2 type - but how do you map it ? as the above gives thise error in hugs: Use of shf requires at least 1 argument Virus checked by G DATA AntiVirusKit Version: AVK 12.0.37 from 06.12.2002 Virus news: www.antiviruslab.com ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
Re: [Haskell] type question revisited
Your first attempt didn't typecheck simply because > in return () means that the return value of the function is monadic, but you did not declare as such. In your second version, the type of shf is *not* a rank-2 type; it's exactly the same type as shw. This can be expressed (with ghc extensions) as > foo :: (a -> String) -> [a] -> [String] > foo (shw :: t) x = > let shf :: t > shf o = shw o > in map shf x or equivalently > foo :: (a -> String) -> [a] -> [String] > foo (shw :: t -> String) x = > let shf :: t -> String > shf o = shw o > in map shf x The essential aspect is that the 'a' from the type signature is *not* in scope for the let-bound type signature; you have to bring the appropriate variable 't' in by using an in-line type signature for 'shw'. Abe On 6/3/05, mv <[EMAIL PROTECTED]> wrote: > I answered my own question only to raise another - what I wanted to do is > this > > > > foo :: (a -> String) -> [a] -> [String] > > foo shw x = > > let > > shf :: ( forall a . a ) -> String > > shf o = shw o > > > > in map shf x > > the type of shf is a rank 2 type - but how do you map it ? as the above > gives > thise error in hugs: > > Use of shf requires at least 1 argument > > > > > > Virus checked by G DATA AntiVirusKit > Version: AVK 12.0.37 from 06.12.2002 > Virus news: www.antiviruslab.com > > ___ > 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
[Haskell] ICLP 2005: Call for Posters
Final Call for poster submissions 21st. INTERNATIONAL CONFERENCE ON LOGIC PROGRAMMING (ICLP'05) Oct 2-5, 2005 Sitges (Barcelona), Spain http://www.iiia.csic.es/iclp2005/ * Conference scope. Poster contributions are sought in all areas of logic programming including: Theory (semantic foundations, formalisms, non-monotonic reasoning, knowledge representation, inductive logic programming) Language issues (constraints, concurrency, objects, coordination, higher order, types, modes, programming techniques) Implementation (compilation, memory management, virtual machines, parallelism) Environments (program analysis, program transformation, validation and verification, debugging) Applications (deductive databases, software engineering, natural language, web tools, internet agents, artificial intelligence, molecular biology) * The ICLP Posters provide an excellent forum for authors to present their work in an informal and interactive setting. Posters are ideal for presenting speculative, late-breaking results or for giving an introduction to interesting, innovative work. Posters provide authors with a unique opportunity to make their work highly visible during the conference and get feedback from the community on the ongoing work. Poster submissions focusing on the following are specifically encouraged: Tools, applications, current work not yet ready for publication, PhD thesis summaries (submitted recently or to be submitted in the next 6 months), research project overviews. Posters must be submitted electronically through the conference paper submission web pages. A poster should contain an extended abstract of up to two pages. Each accepted poster will have up to 2 pages in the conference proceedings, and a 10 minute slot for presentation during the conference. Posters will also be displayed during the poster session. * Submission deadline (firm): June 20, 2005 Notification: July 05, 2005 ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
[Haskell] Template Haskell Question: Spliced expr. of type TypeQ
Hi, maybe someone can help me with this: I was wandering if I could do something similar to Depended Types using Template-Haskell. The documentation of GHC (6.2.2 and 6.4) says that a splice may occur in place of a type, but I get a parse error when I try that. So here is what I did: made a Module Templates: module Templates where expr = [| 1337*7331 |] decl = [d| hello = putStr "Hello\n"|] ty= [t| Int |] and made test file: import Templates $(decl) -- works well (tested with ghci) e = $(expr) -- works also well i :: ($tyr) -- gives a parse error i = 1 I would be really happy if someone knows how to make the last example must be written, or if that works at all. (If not, maybe the Documentation should get updated) and thanks you for reading this posting, anyway. -- Eike ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell