git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix #2362, treat type annotations on top-level expressions as if they were type declarations (#2366)
commit12ec934dd6390d564886b8774e06bd5f937f2aba authorPhil Freeman <paf31@cantab.net> dateSun 9 Oct 2016, 12:40 (10 years ago) parent48b8370
2 files changed+6−1
src/Language/PureScript/TypeChecker/Entailment.hs−1 src/Language/PureScript/TypeChecker/Types.hs+6
src/Language/PureScript/TypeChecker/Entailment.hs−1
@@ -233,7 +233,6 @@ entails shouldGeneralize deferErrors (TypeClassDictionary constraint context hin
233233
234234 canBeGeneralized :: Type -> Bool
235235 canBeGeneralized TUnknown{} = True
236− canBeGeneralized Skolem{} = True
237236 canBeGeneralized _ = False
238237
239238 -- |
src/Language/PureScript/TypeChecker/Types.hs+6
@@ -27,12 +27,14 @@ module Language.PureScript.TypeChecker.Types
2727
2828import Prelude.Compat
2929
30+import Control.Arrow (second)
3031import Control.Monad
3132import Control.Monad.Error.Class (MonadError(..))
3233import Control.Monad.State.Class (MonadState(..), gets)
3334import Control.Monad.Supply.Class (MonadSupply)
3435import Control.Monad.Writer.Class (MonadWriter(..))
3536
37+import Data.Bifunctor (bimap)
3638import Data.Either (lefts, rights)
3739import Data.List (transpose, nub, (\\), partition, delete)
3840import Data.Maybe (fromMaybe)
@@ -199,6 +201,10 @@ typeForBindingGroupElement (ident, val) dict untypedDict = do
199201-- | Check if a value contains a type annotation
200202isTyped :: (Ident, Expr) -> Either (Ident, Expr) (Ident, (Expr, Type, Bool))
201203isTyped (name, TypedValue checkType value ty) = Right (name, (value, ty, checkType))
204+isTyped (name, PositionedValue pos c value) =
205+ bimap (second (PositionedValue pos c))
206+ (second (\(e, t, b) -> (PositionedValue pos c e, t, b)))
207+ (isTyped (name, value))
202208isTyped (name, value) = Left (name, value)
203209
204210-- |