Re: [Haskell-cafe] Type checking of partial programs
So a number of people responded with various ways this is already possible. Of course GHC can already do this... it's type inference. The part I'm interested in working on is exposing the functionality in GHC's API to make this as easy as possible. -Abram ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Type checking of partial programs
On Thu, 20 Mar 2008, Roberto Zunino wrote: ac wrote: foo :: [Foo] - placeholder 1 foo xs = map placeholder 2 xs What are the possible type signatures for placeholder 1 and the possible expressions for placeholder 2? A nice GHCi trick I learned from #haskell: :t let foo xs = map ?placeholder2 xs in foo forall a b. (?placeholder2::a - b) = [a] - [b] Also, the djinn tool might provide some actual expression for placeholder 2. http://www.haskell.org/haskellwiki/Determining_the_type_of_an_expression ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Type checking of partial programs
Is anybody interested in working on this? This is a project I've been interested in for some time, but recognize I probably need some guidance before I go off and start hacking on it. As dcoutts pointed out on #haskell-soc, this may be of particular interest to people working on yi and HaRe. Other interesting and related projects include parsing partial programs to insert placeholders in appropriate places. An example of a partial program could be: foo :: [Foo] - placeholder 1 foo xs = map placeholder 2 xs What are the possible type signatures for placeholder 1 and the possible expressions for placeholder 2? I would like to stir up a discussion about this, and eventually write some useful code. -Abram ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Type checking of partial programs
ac wrote: foo :: [Foo] - placeholder 1 foo xs = map placeholder 2 xs What are the possible type signatures for placeholder 1 and the possible expressions for placeholder 2? A nice GHCi trick I learned from #haskell: :t let foo xs = map ?placeholder2 xs in foo forall a b. (?placeholder2::a - b) = [a] - [b] Also, the djinn tool might provide some actual expression for placeholder 2. Zun. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Type checking of partial programs
zunino: ac wrote: foo :: [Foo] - placeholder 1 foo xs = map placeholder 2 xs What are the possible type signatures for placeholder 1 and the possible expressions for placeholder 2? A nice GHCi trick I learned from #haskell: :t let foo xs = map ?placeholder2 xs in foo forall a b. (?placeholder2::a - b) = [a] - [b] Also, the djinn tool might provide some actual expression for placeholder 2. Zun. Yes, it turns out implicit parameters provide a great mechanism for doing type checker queries :) -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Type checking of partial programs
You can transform this into valid Haskell98 in the following way: foo_infer xs _ | const False (xs :: [Foo]) = undefined foo_infer xs placeholder_2 = map ph xs foo xs = foo_infer xs undefined You can then do type inference on foo_infer, giving you foo_infer :: [Foo] - (Foo - a) - [a] which gives you the type of the placeholder: placeholder_2 :: Foo - a and the type of foo (which is dependent on that): foo :: [Foo] - [a] Of course this gets far more difficult when you add extensions that require type signatures so that you can't rely entirely on type inference, such as GADTs and higher rank types. But it's a start! -- ryan On 3/20/08, ac [EMAIL PROTECTED] wrote: Is anybody interested in working on this? This is a project I've been interested in for some time, but recognize I probably need some guidance before I go off and start hacking on it. As dcoutts pointed out on #haskell-soc, this may be of particular interest to people working on yi and HaRe. Other interesting and related projects include parsing partial programs to insert placeholders in appropriate places. An example of a partial program could be: foo :: [Foo] - placeholder 1 foo xs = map placeholder 2 xs What are the possible type signatures for placeholder 1 and the possible expressions for placeholder 2? I would like to stir up a discussion about this, and eventually write some useful code. -Abram ___ 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