Skip to content

Bump version to 0.12 #126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions server/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,17 @@ server bundled externs initEnv port = do
search = fst . TS.typeSearch (Just []) initEnv (P.emptyCheckState initEnv)
results = nubBy ((==) `on` fst) $ do
elab <- elabs
let strictMatches = search (replaceTypeVariablesAndDesugar (\nm s -> P.Skolem nm s (P.SkolemScope 0) Nothing) elab)
flexMatches = search (replaceTypeVariablesAndDesugar (const P.TUnknown) elab)
let strictMatches = search (replaceTypeVariablesAndDesugar (\nm s -> P.Skolem P.NullSourceAnn nm s (P.SkolemScope 0)) elab)
flexMatches = search (replaceTypeVariablesAndDesugar (const (P.TUnknown P.NullSourceAnn)) elab)
take 50 (strictMatches ++ flexMatches)
Scotty.json $ A.object [ "results" .= [ P.showQualified id k
| (k, _) <- take 50 results
]
]

lookupAllConstructors :: P.Environment -> P.Type -> [P.Type]
lookupAllConstructors :: P.Environment -> P.SourceType -> [P.SourceType]
lookupAllConstructors env = P.everywhereOnTypesM $ \case
P.TypeConstructor (P.Qualified Nothing tyCon) -> P.TypeConstructor <$> lookupConstructor env tyCon
P.TypeConstructor ann (P.Qualified Nothing tyCon) -> P.TypeConstructor ann <$> lookupConstructor env tyCon
other -> pure other
where
lookupConstructor :: P.Environment -> P.ProperName 'P.TypeName -> [P.Qualified (P.ProperName 'P.TypeName)]
Expand All @@ -132,11 +132,11 @@ lookupAllConstructors env = P.everywhereOnTypesM $ \case
-- | (Consistently) replace unqualified type constructors and type variables with unknowns.
--
-- Also remove the @ParensInType@ Constructor (we need to deal with type operators later at some point).
replaceTypeVariablesAndDesugar :: (Text -> Int -> P.Type) -> P.Type -> P.Type
replaceTypeVariablesAndDesugar :: (Text -> Int -> P.SourceType) -> P.SourceType -> P.SourceType
replaceTypeVariablesAndDesugar f ty = State.evalState (P.everywhereOnTypesM go ty) (0, M.empty) where
go = \case
P.ParensInType ty -> pure ty
P.TypeVar s -> do
P.ParensInType _ ty -> pure ty
P.TypeVar _ s -> do
(next, m) <- State.get
case M.lookup s m of
Nothing -> do
Expand All @@ -146,7 +146,7 @@ replaceTypeVariablesAndDesugar f ty = State.evalState (P.everywhereOnTypesM go t
Just ty -> pure ty
other -> pure other

tryParseType :: Text -> Maybe P.Type
tryParseType :: Text -> Maybe P.SourceType
tryParseType = hush (P.lex "") >=> hush (P.runTokenParser "" (P.parsePolyType <* Parsec.eof))
where
hush f = either (const Nothing) Just . f
Expand Down
4 changes: 2 additions & 2 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
resolver: lts-8.5
resolver: lts-12.0
flags: {}
packages:
- '.'
extra-deps:
- purescript-0.11.7
- purescript-0.12.3
- pipes-http-1.0.5
12 changes: 4 additions & 8 deletions staging/core/psc-package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "core",
"set": "psc-0.11.7",
"set": "psc-0.12.2",
"source": "https://github.com/purescript/package-sets.git",
"depends": [
"arrays",
Expand All @@ -10,28 +10,25 @@
"contravariant",
"control",
"distributive",
"eff",
"effect",
"either",
"enums",
"exceptions",
"exists",
"foldable-traversable",
"foreign",
"foreign-object",
"free",
"functions",
"functors",
"generics",
"generics-rep",
"globals",
"graphs",
"identity",
"inject",
"integers",
"lazy",
"maps",
"math",
"maybe",
"monoid",
"ordered-collections",
"prelude",
"profunctor",
"proxy",
Expand All @@ -40,7 +37,6 @@
"record",
"refs",
"semirings",
"sets",
"st",
"strings",
"tailrec",
Expand Down
25 changes: 9 additions & 16 deletions staging/core/src/TryPureScript.purs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module TryPureScript
( Inline
, Doc
, DOM
, text
, p
, link
Expand All @@ -19,29 +18,23 @@ module TryPureScript
) where

import Prelude
import Control.Monad.Eff (kind Effect, Eff)
import Data.Foldable (class Foldable, foldMap)
import Data.String (joinWith)
import Data.Monoid (class Monoid)
import Effect (Effect)

foreign import data DOM :: Effect

foreign import setInnerHTML
:: forall eff
. String
-> Eff (dom :: DOM | eff) Unit
foreign import setInnerHTML :: String -> Effect Unit

foreign import encode :: String -> String

foreign import withConsoleImpl
:: forall eff a
. Eff eff a
-> Eff eff (Array String)
:: forall a
. Effect a
-> Effect (Array String)

withConsole
:: forall eff a
. Eff eff a
-> Eff eff Doc
:: forall a
. Effect a
-> Effect Doc
withConsole f = map toDoc (withConsoleImpl f) where
toDoc = Doc <<< tag' "pre" <<< tag' "code" <<< joinWith "\n"

Expand Down Expand Up @@ -73,7 +66,7 @@ newtype Doc = Doc String
unDoc :: Doc -> String
unDoc (Doc html) = html

render :: forall eff. Doc -> Eff (dom :: DOM | eff) Unit
render :: Doc -> Effect Unit
render (Doc html) = setInnerHTML html

derive newtype instance semigroupDoc :: Semigroup Doc
Expand Down
6 changes: 3 additions & 3 deletions trypurescript.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: trypurescript
version: 0.11.7
version: 0.12.3
cabal-version: >=1.8
build-type: Simple
license: BSD3
Expand All @@ -20,11 +20,11 @@ executable trypurescript
filepath -any,
Glob -any,
scotty -any,
purescript ==0.11.7,
purescript ==0.12.3,
containers -any,
http-types >= 0.8.5,
transformers ==0.5.*,
mtl ==2.2.1,
mtl ==2.2.2,
parsec,
text -any,
time -any
Expand Down