mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-11 10:35:57 +03:00
Remove an even more lawless type class
At least `Parse` was unused.
This commit is contained in:
parent
91dc53d246
commit
8b12645745
@ -2,7 +2,7 @@ module Unison.HashQualified' where
|
||||
|
||||
import Data.Text qualified as Text
|
||||
import Unison.HashQualified qualified as HQ
|
||||
import Unison.Name (Name, Parse)
|
||||
import Unison.Name (Name)
|
||||
import Unison.Name qualified as Name
|
||||
import Unison.NameSegment (NameSegment)
|
||||
import Unison.Prelude
|
||||
@ -113,6 +113,3 @@ instance (Name.Alphabetical n) => Name.Alphabetical (HashQualified n) where
|
||||
compareAlphabetical NameOnly {} HashQualified {} = LT
|
||||
compareAlphabetical HashQualified {} NameOnly {} = GT
|
||||
compareAlphabetical (HashQualified n sh) (HashQualified n2 sh2) = Name.compareAlphabetical n n2 <> compare sh sh2
|
||||
|
||||
instance Parse (HQ.HashQualified n) (HashQualified n) where
|
||||
parse = fromHQ
|
||||
|
@ -1,6 +1,5 @@
|
||||
module Unison.Name
|
||||
( Name,
|
||||
Parse (..),
|
||||
|
||||
-- * Basic construction
|
||||
cons,
|
||||
@ -569,9 +568,3 @@ commonPrefix x@(Name p1 _) y@(Name p2 _)
|
||||
commonPrefix' (a : as) (b : bs)
|
||||
| a == b = a : commonPrefix' as bs
|
||||
commonPrefix' _ _ = []
|
||||
|
||||
class Parse a b where
|
||||
parse :: a -> Maybe b
|
||||
|
||||
instance (Parse a a2, Parse b b2) => Parse (a, b) (a2, b2) where
|
||||
parse (a, b) = (,) <$> parse a <*> parse b
|
||||
|
@ -17,17 +17,13 @@ import Text.Megaparsec (ParsecT)
|
||||
import Text.Megaparsec qualified as P
|
||||
import Text.Megaparsec.Internal qualified as P (withParsecT)
|
||||
import Unison.HashQualified' qualified as HQ'
|
||||
import Unison.Name (Name, Parse)
|
||||
import Unison.Name qualified as Name
|
||||
import Unison.Name (Name)
|
||||
import Unison.Prelude hiding (fromString)
|
||||
import Unison.Syntax.Lexer.Token (Token)
|
||||
import Unison.Syntax.Name qualified as Name (nameP, toText)
|
||||
import Unison.Syntax.NameSegment qualified as NameSegment
|
||||
import Unison.Syntax.ShortHash qualified as ShortHash (shortHashP)
|
||||
|
||||
instance Parse Text (HQ'.HashQualified Name) where
|
||||
parse = parseText
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
-- String conversions
|
||||
|
||||
|
@ -22,8 +22,7 @@ import Text.Megaparsec.Internal qualified as P (withParsecT)
|
||||
import Unison.HashQualified (HashQualified (..))
|
||||
import Unison.HashQualified qualified as HashQualified
|
||||
import Unison.HashQualified' qualified as HQ'
|
||||
import Unison.Name (Name, Parse)
|
||||
import Unison.Name qualified as Name
|
||||
import Unison.Name (Name)
|
||||
import Unison.Prelude hiding (fromString)
|
||||
import Unison.Syntax.HashQualified' qualified as HQ'
|
||||
import Unison.Syntax.Lexer.Token (Token)
|
||||
@ -34,9 +33,6 @@ import Unison.Var (Var)
|
||||
import Unison.Var qualified as Var
|
||||
import Prelude hiding (take)
|
||||
|
||||
instance Parse Text (HashQualified Name) where
|
||||
parse = parseText
|
||||
|
||||
parseText :: Text -> Maybe (HashQualified Name)
|
||||
parseText text =
|
||||
eitherToMaybe (P.runParser parser "" (Text.unpack text))
|
||||
|
Loading…
Reference in New Issue
Block a user