Skip to content

Instantly share code, notes, and snippets.

@mxswd
Created March 24, 2014 10:26
Show Gist options
  • Save mxswd/9737778 to your computer and use it in GitHub Desktop.
Save mxswd/9737778 to your computer and use it in GitHub Desktop.
{-# LANGUAGE OverloadedStrings, FlexibleInstances #-}
import Data.String
import Unsafe.Coerce
import Data.Text
instance IsString a => IsString (a -> String) where
fromString s = \x -> s ++ (unsafeCoerce x)
-- returns "foobar"
cool = "foo" "bar" :: String
-- returns "foo"
wat = ("foo"::Text -> String) "bar" :: String
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment