RE: parsing types

2011-04-27 Thread Simon Peyton-Jones
: Simon Peyton-Jones; Daniel Peebles; Thomas Schilling | Cc: ghc-users | Subject: Re: parsing types | | Dear Simon, Daniel and Thomas, | | thanks for your help with this! I managed to get what I | want by writing something like so: | | tcExpr :: FilePath -> String -> IO Type | tcEx

Re: parsing types

2011-04-26 Thread Ranjit Jhala
The one in HscMain isn't.] > > Does that help? > > Simon > > | -Original Message- > | From: glasgow-haskell-users-boun...@haskell.org [mailto:glasgow-haskell- > | users-boun...@haskell.org] On Behalf Of Ranjit Jhala > | Sent: 24 April 2011 02:27 &

RE: parsing types

2011-04-26 Thread Simon Peyton-Jones
ig you give. The one in HscMain isn't.] Does that help? Simon | -Original Message- | From: glasgow-haskell-users-boun...@haskell.org [mailto:glasgow-haskell- | users-boun...@haskell.org] On Behalf Of Ranjit Jhala | Sent: 24 April 2011 02:27 | To: Daniel Peebles | Cc: ghc-users

Re: parsing types

2011-04-25 Thread Thomas Schilling
On 24 April 2011 03:26, Ranjit Jhala wrote: > Does anyone have a clue as to how to get a hold on an appropriate > environment? (I would have thought that the HscEnv obtained _after_ > compiling some file "f" would populated with at least the names > needed to compile "f") that is, if I do: > >    

Re: parsing types

2011-04-23 Thread Ranjit Jhala
Hi Daniel -- that was a good lead, with a little digging around, I found hscTcExpr :: GhcMonad m => HscEnv -> String -> m Type which almost gets the job done, if only I could call it with the appropriate HscEnv. The one I get using getSession :: GhcMonad m => m HscEnv appea

Re: parsing types

2011-04-23 Thread Daniel Peebles
I don't have an answer for you, but you might want to look at what :k does in ghci, since that needs to parse a type. On Sat, Apr 23, 2011 at 2:06 PM, Ranjit Jhala wrote: > Hi all, > > can someone give me a hint as to the best way to parse a type from a > string. > Ideally, I'd like a function >

parsing types

2011-04-23 Thread Ranjit Jhala
Hi all, can someone give me a hint as to the best way to parse a type from a string. Ideally, I'd like a function stringType :: String -> Maybe Type or possibly, stringType :: (GhcMonad m) => String -> m (Maybe Type) such that, stringType s == Just t if in the curr