-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | QuasiQuoter for Perl6-style multi-line interpolated strings
--   
--   QuasiQuoter for Perl6-style multi-line interpolated strings with "q",
--   "qq" and "qc" support.
@package interpolatedstring-perl6
@version 1.0.0


-- | QuasiQuoter for interpolated strings using Perl 6 syntax.
--   
--   The <a>q</a> form does one thing and does it well: It contains a
--   multi-line string with no interpolation at all:
--   
--   <pre>
--   {-# LANGUAGE QuasiQuotes, ExtendedDefaultRules #-}
--   import Text.InterpolatedString.Perl6 (q)
--   foo :: String -- <a>Text</a>, <a>ByteString</a> etc also works
--   foo = [q|
--   
--   Well here is a
--       multi-line string!
--   
--   |]
--   </pre>
--   
--   Any instance of the <a>IsString</a> class is permitted.
--   
--   The <a>qc</a> form interpolates curly braces: expressions inside {}
--   will be directly interpolated if it's a <a>Char</a>, <a>String</a>,
--   <a>Text</a> or <a>ByteString</a>, or it will have <a>show</a> called
--   if it is not.
--   
--   Escaping of '{' is done with backslash.
--   
--   For interpolating numeric expressions without an explicit type
--   signature, use the ExtendedDefaultRules lanuage pragma, as shown
--   below:
--   
--   <pre>
--   {-# LANGUAGE QuasiQuotes, ExtendedDefaultRules #-}
--   import Text.InterpolatedString.Perl6 (qc)
--   bar :: String
--   bar = [qc| Well {"hello" ++ " there"} {6 * 7} |]
--   </pre>
--   
--   bar will have the value " Well hello there 42 ".
--   
--   If you want control over how <a>show</a> works on your types, define a
--   custom <a>ShowQ</a> instance:
--   
--   For example, this instance allows you to display interpolated lists of
--   strings as a sequence of words, removing those pesky brackets, quotes,
--   and escape sequences.
--   
--   <pre>
--   {-# LANGUAGE FlexibleInstances #-}
--   import Text.InterpolatedString.Perl6 (qc, ShowQ(..))
--   instance ShowQ [String] where
--       showQ = unwords
--   </pre>
--   
--   The <a>qq</a> form adds to the <a>qc</a> form with a simple shorthand:
--   '$foo' means '{foo}', namely interpolating a single variable into the
--   string.
--   
--   <pre>
--   {-# LANGUAGE QuasiQuotes, ExtendedDefaultRules #-}
--   import Text.InterpolatedString.Perl6 (qq)
--   baz :: String
--   baz = [qq| Hello, $who |]
--       where
--       who = "World"
--   </pre>
--   
--   Both <a>qc</a> and <a>qq</a> permit output to any types with both
--   <a>IsString</a> and <a>Monoid</a> instances.
--   
--   <pre>
--   {--}
--   import Text.InterpolatedString.Perl6 (qc)
--   import Data.Text (Text)
--   import Data.ByteString.Char8 (ByteString)
--   qux :: ByteString
--   qux = [qc| This will convert {"Text" :: Text} to {"ByteString" :: ByteString} |]
--   </pre>
--   
--   The ability to define custom <a>ShowQ</a> instances is particularly
--   powerful with cascading instances using <a>qq</a>.
--   
--   Below is a sample snippet from a script that converts Shape objects
--   into AppleScript suitable for drawing in OmniGraffle:
--   
--   <pre>
--   {-# LANGUAGE QuasiQuotes, ExtendedDefaultRules, NamedFieldPuns, RecordWildCards #-}
--   import Text.InterpolatedString.Perl6
--   </pre>
--   
--   <pre>
--   data Shape = Shape
--       { originX         :: Int
--       , originY         :: Int
--       , width           :: Int
--       , height          :: Int
--       , stroke          :: Stroke
--       , text            :: Text
--       }
--   instance ShowQ Shape where
--       showQ Shape{..} = [qq|
--           make new shape at end of graphics with properties
--               \{ $text, $stroke, _size, $_origin }
--       |]
--           where         
--           _size   = [qq|size: {$width, $height}|]
--           _origin = [qq|origin: {$originX, $originY}|]
--   </pre>
--   
--   <pre>
--   data Stroke = StrokeWhite | StrokeNone
--   instance ShowQ Stroke where
--       showQ StrokeNone = "draws stroke:false"
--       showQ StrokeWhite = "stroke color: {1, 1, 1}"
--   </pre>
--   
--   <pre>
--   data Text   = Text
--       { txt   :: String
--       , color :: Color
--       }
--   instance ShowQ Text where
--       showQ Text{..} = [qq|text: \{ text: "$txt", $color, alignment: center } |]
--   </pre>
--   
--   <pre>
--   data Color = Color { red :: Float, green :: Float, blue :: Float }
--   instance ShowQ Color where
--       showQ Color{..} = [qq|color: {$red, $green, $blue}|]
--   </pre>
--   
--   <pre>
--   main :: IO ()
--   main = putStrLn [qq|
--       tell application "OmniGraffle Professional 5"
--           tell canvas of front window
--               { makeShape ... }
--           end tell
--       end tell
--   |]
--   </pre>
module Text.InterpolatedString.Perl6

-- | QuasiQuoter for interpolating '$var' and '{expr}' into a string
--   literal. The pattern portion is undefined.
qq :: QuasiQuoter

-- | QuasiQuoter for interpolating '{expr}' into a string literal. The
--   pattern portion is undefined.
qc :: QuasiQuoter

-- | QuasiQuoter for a non-interpolating string literal. The pattern
--   portion is undefined.
q :: QuasiQuoter

-- | A class for types that use special interpolation rules. Instances of
--   <a>ShowQ</a> that are also instances of <a>IsString</a> should obey
--   the following law:
--   
--   <pre>
--   fromString (showQ s) == s
--   </pre>
--   
--   because this library relies on this fact to optimize away needless
--   string conversions.
class ShowQ a
showQ :: ShowQ a => a -> String
instance GHC.Show.Show Text.InterpolatedString.Perl6.StringPart
instance Text.InterpolatedString.Perl6.ShowQ GHC.Types.Char
instance Text.InterpolatedString.Perl6.ShowQ GHC.Base.String
instance Text.InterpolatedString.Perl6.ShowQ Data.ByteString.Internal.ByteString
instance Text.InterpolatedString.Perl6.ShowQ Data.ByteString.Lazy.Internal.ByteString
instance Text.InterpolatedString.Perl6.ShowQ Data.Text.Internal.Text
instance Text.InterpolatedString.Perl6.ShowQ Data.Text.Internal.Lazy.Text
instance GHC.Show.Show a => Text.InterpolatedString.Perl6.ShowQ a
instance Data.String.IsString s => Text.InterpolatedString.Perl6.QQ s s
instance (Text.InterpolatedString.Perl6.ShowQ a, Data.String.IsString s) => Text.InterpolatedString.Perl6.QQ a s
