As I said in my last post, I was sick of Blogger's way of indenting my Haskell code. I was on the verge to move to wordpress.com, which provides seamless support for the excellent syntaxhighlighter. Too bad, syntaxhighlighter doesn't provide Haskell support out-of-the-box.
Hence, I decided to write one myself. Go get it! Then, follow these instructions to get it to work with Blogger.
Here's an example of what it can do:
{-dfhc: by jAS 000807-}
module Import (importOne) where
import IO
import PackedString(PackedString,packString,unpackPS)
import Flags
import OsOnly(fixImportNames,isPrelude)
import Extra
import Syntax(Module,ImpDecl,Type,Decls,Decl,FixId,InfixClass(..),Simple,
Context,Constr)
import Lex(Lex)
import TokenId(TokenId(..),tPrelude,rpsPrelude,extractV)
import ParseCore(Parser(..),ParseBad(..),ParseError(..),ParseGood(..),
ParseResult(..),parseit)
import ParseI
import Lexical(PosToken(..),PosTokenPre(..),LexState(..),lexical)
import State
import Error
import IExtract
import ImportState(ImportState,putModid2IS)
import IntState(dummyIntState)
import PPSyntax(ppModule,ppDecl,ppDecls,ppImpDecls,ppInterface,ppFun,ppClassCodes)
#if !defined(__HASKELL98__)
#define ioError fail
#endif
openImport:: Flags -> PackedString -> IO (String,String,String)
openImport flags mrps =
catch
(do
(fstr,finput) <- readFirst filenames
if sImport flags
then hPutStr stderr
("Importing module "++mstr++" from "++fstr++".\n")
else return ()
return (mstr,fstr,finput))
(\err -> ioError (userError (can'tOpenStr mstr filenames err)))
where
isUnix = sUnix flags
preludes = sPreludes flags
includes = sIncludes flags ++ preludes
mstr = (reverse . unpackPS) mrps
filenames =
fixImportNames isUnix mstr
(if isPrelude mstr then preludes else includes)
readFirst:: [String] -> IO (String,String)
readFirst [] = hPutStr stderr "Fail no filenames, probably no -I or -P" >> exit
readFirst [x] = do
finput <- readFile x
return (x,finput)
Of course, you can help improve it! While waiting for me to setup a page for this (which could take foerever), patches and comments are very welcomed!
5 comments:
Really an awesome post. I wondered by reading this blog post. Thanks a lot for posting this unique post which you have shared with us. Keep on posting like this exclusive post with us.
Dotnet Training in Chennai
wow great,nowadays this type of blog id more important and informative technology,it was more impressive to read ,which helps to design more in effective ways
Salesforce Training in Chennai
Here i had read the content you had posted. It is much interesting so please keep update like this.
Java Training in Chennai
It is really very excellent,I find all articles was amazing.Awesome way to get exert tips from everyone,not only i like that post all peoples like that post.Because of all given information was wonderful and it's very helpful for me.
ccna training in chennai thiruvanmiyur
Nice it seems to be good post... It will get readers engagement on the article since readers engagement plays an vital role in every blog.. i am expecting more updated posts from your hands.
Fitness SMS
Fitness Text
Salon SMS
Salon Text
Investor Relation SMS
Investor Relation Text
Mobile Marketing Services
mobile marketing companies
Sms API
Post a Comment