mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-11 02:25:39 +03:00
ignore layout tokens during type parsing
This commit is contained in:
parent
78c3cddef0
commit
632fc73cf9
@ -148,7 +148,7 @@ possiblyAnnotated p = f <$> p <*> optional ann''
|
||||
f t Nothing = t
|
||||
|
||||
ann'' :: Var v => Parser (Type v)
|
||||
ann'' = token (char ':') *> TypeParser.type_
|
||||
ann'' = withoutLayout $ token (char ':') *> TypeParser.type_
|
||||
|
||||
--let server = _; blah = _ in _
|
||||
let_ :: Var v => Parser (Term v) -> Parser (Term v)
|
||||
|
@ -3,12 +3,12 @@
|
||||
module Unison.TypeParser where
|
||||
|
||||
|
||||
import Control.Applicative ((<|>), some)
|
||||
import Control.Applicative ((<|>), some, many)
|
||||
import Data.Char (isUpper, isLower, isAlpha)
|
||||
import Data.Foldable (asum)
|
||||
import Data.Functor
|
||||
import Data.List (foldl1')
|
||||
import Unison.Parser
|
||||
import Unison.Parser hiding (ignored, token)
|
||||
import Unison.Type (Type)
|
||||
import Unison.Var (Var)
|
||||
import qualified Data.Text as Text
|
||||
@ -17,6 +17,13 @@ import qualified Unison.Type as Type
|
||||
type_ :: Var v => Parser (Type v)
|
||||
type_ = forall type1 <|> type1
|
||||
|
||||
-- we ignore indentation markers { and }, but not semicolon
|
||||
ignored :: Parser ()
|
||||
ignored = void $ many (whitespace1 <|> haskellLineComment <|> (void $ one (\c -> c == '{' || c == '}')))
|
||||
|
||||
token :: Parser a -> Parser a
|
||||
token p = (p <* ignored)
|
||||
|
||||
typeLeaf :: Var v => Parser (Type v)
|
||||
typeLeaf =
|
||||
asum [ literal
|
||||
|
@ -7,8 +7,8 @@ then f1 f2 x = f2 (f1 x)
|
||||
Remote.transfer : Node -> Remote Unit
|
||||
Remote.transfer node = Remote.at node unit
|
||||
|
||||
-- Apply a function to a `Remote`
|
||||
Remote.map : ∀ a b . (a -> b) -> Remote a -> Remote b
|
||||
Remote.map :
|
||||
∀ a b . (a -> b) -> Remote a -> Remote b
|
||||
Remote.map f =
|
||||
Remote.bind (f `then` Remote.pure)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user