Skip to content

Commit

Permalink
recognize OverloadedStrings
Browse files Browse the repository at this point in the history
  • Loading branch information
mauke committed Jun 25, 2013
1 parent b1d5fcd commit 25dde8d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
19 changes: 13 additions & 6 deletions poly.poly
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ printf("I'm a C++ program (trigraphs %sabled).\n", \
> import Prelude hiding ((:)) -- -- \
> import Data.List (intercalate) -- -- \
> import Language.Haskell.TH -- -- \
> import Data.String -- -- \
> default (S, String, Integer, Int) -- -- \
> data S = S -- -- \
> instance Eq S where _ == _ = False -- -- \
> instance IsString S where fromString = const S -- -- \
> ifThenElse c t e = case c of True -> t; False -> e -- \
> main :: IO () -- -- \
> main = putStr ("I'm a Literate Haskell program" ++ bonus ++ ".\n") -- \
Expand All @@ -77,22 +82,24 @@ printf("I'm a C++ program (trigraphs %sabled).\n", \
> | otherwise = " (" ++ details ++ ")" -- -- \
> details = intercalate ", " [ name | (enabled, name) <- extensions, enabled ] -- -- \
> extensions = -- -- \
> (bangPatterns, "BangPatterns" ) : -- -- \
> (templateHaskell, "TemplateHaskell" ) : -- -- \
> (rebindableSyntax, "RebindableSyntax") : -- -- \
> (magicHash, "MagicHash" ) : -- -- \
> (bangPatterns, "BangPatterns" ) : -- -- \
> (templateHaskell, "TemplateHaskell" ) : -- -- \
> (rebindableSyntax, "RebindableSyntax" ) : -- -- \
> (magicHash, "MagicHash" ) : -- -- \
> (overloadedStrings, "OverloadedStrings") : -- -- \
> [] -- -- \
> (!) = (!!) -- -- \
> bangPatterns = [True] ! 0 -- -- \
> where foo !bar = False -- -- \
> templateHaskell = thc $(return (TupE []) :: ExpQ) -- -- \
> rebindableSyntax = null (do { [()]; [()] }) -- -- \
> where _ >> _ = "" -- -- \
> where _ >> _ = [] :: [()] -- -- \
> magicHash = foo# () -- -- \
> where -- -- \
> foo = "." -- -- \
> foo = ['.'] -- -- \
> "." # _ = False -- -- \
> foo# _ = True -- -- \
> overloadedStrings = "" /= "" -- -- \
> class THC a where -- -- \
> thc :: a -> Bool -- -- \
> instance THC () where -- -- \
Expand Down
15 changes: 8 additions & 7 deletions t/chk.t
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ sh="busybox sh"



plan 22
plan 23
diag "checking $poly ..."

is sh "I'm a sh script." $sh "$poly"
Expand All @@ -78,12 +78,13 @@ is tcl "I'm a tcl script." tclsh "$poly"
is brainfuck "I'm a brainfuck program." $bf "$poly"
tmp="tmp-poly-$$.lhs"
ln -s "$poly" "$tmp"
is haskell "I'm a Literate Haskell program." "$runhaskell" "$tmp"
is haskell-bp "I'm a Literate Haskell program (BangPatterns)." "$runhaskell" -XBangPatterns "$tmp"
is haskell-th "I'm a Literate Haskell program (TemplateHaskell)." "$runhaskell" -XTemplateHaskell "$tmp"
is haskell-rs "I'm a Literate Haskell program (RebindableSyntax)." "$runhaskell" -XRebindableSyntax "$tmp"
is haskell-mh "I'm a Literate Haskell program (MagicHash)." "$runhaskell" -XMagicHash "$tmp"
is haskell-bp-th-rs-mh "I'm a Literate Haskell program (BangPatterns, TemplateHaskell, RebindableSyntax, MagicHash)." "$runhaskell" -XBangPatterns -XTemplateHaskell -XRebindableSyntax -XMagicHash "$tmp"
is haskell "I'm a Literate Haskell program." "$runhaskell" "$tmp"
is haskell-bp "I'm a Literate Haskell program (BangPatterns)." "$runhaskell" -XBangPatterns "$tmp"
is haskell-th "I'm a Literate Haskell program (TemplateHaskell)." "$runhaskell" -XTemplateHaskell "$tmp"
is haskell-rs "I'm a Literate Haskell program (RebindableSyntax)." "$runhaskell" -XRebindableSyntax "$tmp"
is haskell-mh "I'm a Literate Haskell program (MagicHash)." "$runhaskell" -XMagicHash "$tmp"
is haskell-os "I'm a Literate Haskell program (OverloadedStrings)." "$runhaskell" -XOverloadedStrings "$tmp"
is haskell-all "I'm a Literate Haskell program (BangPatterns, TemplateHaskell, RebindableSyntax, MagicHash, OverloadedStrings)." "$runhaskell" -XBangPatterns -XTemplateHaskell -XRebindableSyntax -XMagicHash -XOverloadedStrings "$tmp"
rm "$tmp"
is c "I'm a C program (C89 with // comments, trigraphs disabled)." compile gcc -Wno-trigraphs -Wno-unused -xc "$poly"
is c89 "I'm a C program (C89, trigraphs enabled)." compile gcc -std=c89 -pedantic -W -Wall -Wno-trigraphs -Wno-unused -xc "$poly"
Expand Down

0 comments on commit 25dde8d

Please sign in to comment.