1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 07:55:12 +03:00

🔥 Data.Functor.Classes.Pretty.Orphans.

This commit is contained in:
Rob Rix 2017-08-22 14:27:56 -04:00
parent 9a5f78a6c0
commit e44f43e689
7 changed files with 5 additions and 28 deletions

View File

@ -21,7 +21,6 @@ library
, Data.Error
, Data.Functor.Both
, Data.Functor.Classes.Eq.Generic
, Data.Functor.Classes.Pretty.Orphans
, Data.Functor.Classes.Show.Generic
, Data.Functor.Listable
, Data.Mergeable

View File

@ -1,22 +0,0 @@
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Data.Functor.Classes.Pretty.Orphans
( module Pretty
) where
import Data.ByteString
import Data.Functor.Classes.Pretty as Pretty
import Data.Text.Encoding
import GHC.Stack
instance Pretty ByteString where
pretty = pretty . decodeUtf8With (\ _ -> ('\xfffd' <$))
instance Pretty SrcLoc where
pretty SrcLoc{..}
| srcLocStartLine == srcLocEndLine
, srcLocStartCol == srcLocEndCol
= pretty srcLocFile <> colon <> pretty srcLocStartLine <> colon <> pretty srcLocStartCol
| srcLocStartLine == srcLocEndLine
= pretty srcLocFile <> colon <> pretty srcLocStartLine <> colon <> pretty srcLocStartCol <> pretty '-' <> pretty srcLocEndCol
| otherwise
= pretty srcLocFile <> colon <> pretty srcLocStartLine <> colon <> pretty srcLocStartCol <> pretty '-' <> pretty srcLocEndLine <> colon <> pretty srcLocEndCol

View File

@ -4,7 +4,7 @@ module Data.Syntax.Declaration where
import Algorithm
import Data.Align.Generic
import Data.Functor.Classes.Eq.Generic
import Data.Functor.Classes.Pretty.Orphans
import Data.Functor.Classes.Pretty
import Data.Functor.Classes.Show.Generic
import GHC.Generics

View File

@ -4,7 +4,7 @@ module Data.Syntax.Expression where
import Algorithm
import Data.Align.Generic
import Data.Functor.Classes.Eq.Generic
import Data.Functor.Classes.Pretty.Orphans
import Data.Functor.Classes.Pretty
import Data.Functor.Classes.Show.Generic
import GHC.Generics

View File

@ -4,7 +4,7 @@ module Data.Syntax.Statement where
import Algorithm
import Data.Align.Generic
import Data.Functor.Classes.Eq.Generic
import Data.Functor.Classes.Pretty.Orphans
import Data.Functor.Classes.Pretty
import Data.Functor.Classes.Show.Generic
import GHC.Generics

View File

@ -4,7 +4,7 @@ module Data.Syntax.Type where
import Algorithm
import Data.Align.Generic
import Data.Functor.Classes.Eq.Generic
import Data.Functor.Classes.Pretty.Orphans
import Data.Functor.Classes.Pretty
import Data.Functor.Classes.Show.Generic
import GHC.Generics

View File

@ -10,7 +10,7 @@ import Algorithm
import Data.Align.Generic
import Data.Functor (void)
import Data.Functor.Classes.Eq.Generic
import Data.Functor.Classes.Pretty.Orphans
import Data.Functor.Classes.Pretty
import Data.Functor.Classes.Show.Generic
import Data.List.NonEmpty (NonEmpty(..))
import Data.Maybe (fromMaybe)