Skip to content

Commit

Permalink
Prevent IsString instance
Browse files Browse the repository at this point in the history
  • Loading branch information
tchoutri committed Sep 5, 2021
1 parent 10dbbc2 commit 43c4868
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Database/PostgreSQL/Entity/Internal/Unsafe.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE UndecidableInstances #-}
{-|
Module : Database.PostgreSQL.Entity.Internal.Unsafe
Copyright : © Clément Delafargue, 2018
Expand All @@ -24,7 +26,9 @@ module Database.PostgreSQL.Entity.Internal.Unsafe
Field (..)
) where

import Data.String
import Data.Text (Text)
import GHC.TypeLits

-- | A wrapper for table fields.
--
Expand All @@ -33,3 +37,7 @@ data Field
= Field Text (Maybe Text)
deriving stock (Eq, Show)

instance TypeError ('Text "🚫 You cannot pass a Field name as a string." ':$$:
'Text "Please use the `field` quasi-quoter instead.")
=> IsString Field where
fromString = error "You cannot pass a field as a string. Please use the `field` quasi-quoter instead."

0 comments on commit 43c4868

Please sign in to comment.