Skip to content

Instantly share code, notes, and snippets.

@FrigoEU
Last active December 11, 2016 09:28
Show Gist options
  • Select an option

  • Save FrigoEU/b2ea85258d3245f5fdca1883640ceb70 to your computer and use it in GitHub Desktop.

Select an option

Save FrigoEU/b2ea85258d3245f5fdca1883640ceb70 to your computer and use it in GitHub Desktop.
Fail Instance with TypeString/TypeConcat
module Main where
import Prelude
import Control.Monad.Eff.Console (log)
class Serialize a where
serialize :: a -> String
instance cannotSerializeFunctions
:: Fail ("Cannot serialize the function: " <> TypeString (a -> b) <> ". Functions can't be serialized.")
=> Serialize (a -> b) where
serialize _ = "unreachable"
infixl 6 type TypeConcat as <>
main = do
log (serialize ((+) 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment