Hi,

there is also another difference:

type URL= String

was a top level definition but it has been moved under the previous
instance declaration.

I attach a source fragment and another file with the pretty printed
output containing these three errors.


Regarding the problem of pretty printing while keeping the comments I
imagine that you would like the comments to be associated with the
previous syntactical element (module, top level declaration or
expression) and be rendered in the same relative position in the
pretty printed output.

I agree that it doesn't sound like an easy task.

However, similar systems exists for most languages (I loved my Java
reformatter in Eclipse) and it would be very handy in Haskell as well.


Best,

             titto





2009/10/20 Niklas Broberg <[email protected]>:
>>>> instance Dir Directory where
>>>>  localDir (Local f) = return f
>>>>
>>>>  typeURL= String
>>>
>>> Sorry, I don't see the difference between these two. Did you write the
>>> correct one twice by mistake?
>>
>> In case Pasqualino doesn't see your mail real soon...
>> Maybe the difference is the missing space between "type" and "URL".
>
> Ah, of course, I see it now, thanks!
>
> Cheers,
>
> /Niklas
>



-- 
Pasqualino "Titto" Assini, Ph.D.
http://quicquid.org/
class Dir d where
  localDir :: d -> IO FilePath

data Package = Cabal Directory 
               | SourceTree Directory
                 deriving (Read,Show,Typeable,Data)


-- A (possibly remote) directory that can be mapped to a local one.
data Directory = Local FilePath
               | Darcs {url::URL,darcsVersion::DarcsVersion,subDirectory::FilePath} deriving (Read,Show,Typeable,Data)

data DarcsVersion = Patch String | Tag String deriving (Read,Show,Typeable,Data)

instance Dir Directory where
  localDir (Local f) = return f

  localDir (Darcs {url=url,darcsVersion=Patch patch,subDirectory=subDir}) = do 
    tmp <- createTempDir 0 "haskelld"
    darcsOut <- runDarcsCommand tmp "get" ["--lazy","--to-match","hash "++ patch,url,"fs"]
    print darcsOut
    let (ExitSuccess,"",out) = darcsOut 
    print out
    return $ tmp </> "fs" </> subDir

type URL = String
class Dir dwhere{
  localDir :: d -> IO FilePath

data Package = Cabal Directory
               | SourceTree Directory
                 deriving (Read,Show,Typeable,Data)


-- A (possibly remote) directory that can be mapped to a local one.
data Directory = Local FilePath
               | Darcs {url::URL,darcsVersion::DarcsVersion,subDirectory::FilePath} deriving (Read,Show,Typeable,Data)

data DarcsVersion = Patch String | Tag String deriving (Read,Show,Typeable,Data)

instance Dir Directory where
  localDir (Local f) = return f

  localDir (Darcs {url=url,darcsVersion=Patch patch,subDirectory=subDir}) = do
    tmp <- createTempDir 0 "haskelld"
    darcsOut <- runDarcsCommand tmp "get" ["--lazy","--to-match","hash "++ patch,url,"fs"]
    print darcsOut
    let (ExitSuccess,"",out) = darcsOut
    print out
    return $ tmp </> "fs" </> subDir

  typeURL= String
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to