Skip to content

Commit

Permalink
Merge branch 'trunk' of github.com:unisonweb/unison into topic/nohist…
Browse files Browse the repository at this point in the history
…oricsearch
  • Loading branch information
runarorama committed Aug 12, 2020
2 parents d9fc1df + e0eee69 commit ed62137
Show file tree
Hide file tree
Showing 85 changed files with 378 additions and 581 deletions.
Empty file removed .gitmodules
Empty file.
37 changes: 37 additions & 0 deletions hie.yaml
@@ -0,0 +1,37 @@
cradle:
multi:
- path: "./"
config:
cradle:
stack:
- path: "./parser-typechecker/src"
component: "unison-parser-typechecker:lib"
- path: "./parser-typechecker/unison"
component: "unison-parser-typechecker:exe:unison"
- path: "./parser-typechecker/prettyprintdemo"
component: "unison-parser-typechecker:exe:prettyprintdemo"
- path: "./parser-typechecker/tests"
component: "unison-parser-typechecker:exe:tests"
- path: "./parser-typechecker/transcripts"
component: "unison-parser-typechecker:exe:transcripts"

- path: "./unison-core/src"
component: "unison-core:lib"

- path: "./yaks/easytest/src"
component: "easytest:lib"
- path: "./yaks/easytest/tests"
component: "easytest:exe:runtests"

# Attempt to skip ./unison-src/parser-tests/GenerateErrors.hs
# which doesn't have a corresponding cabal file.
#
# This is the skipping strategy suggested by:
# https://github.com/mpickering/hie-bios/tree/7f298424e30e0453dc21062ffa543998a2145ab6#ignoring-directories
# but it isn't working for some reason.
#
# Until it does you can expect to see "1 file failed" in the ghcide output.
- path: "./unison-src"
config:
cradle:
none:
2 changes: 0 additions & 2 deletions parser-typechecker/src/Unison/Builtin.hs
@@ -1,8 +1,6 @@
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}

module Unison.Builtin
(codeLookup
Expand Down
6 changes: 3 additions & 3 deletions parser-typechecker/src/Unison/Builtin/Decls.hs
Expand Up @@ -217,10 +217,10 @@ unTupleType t = case t of
Type.Ref' UnitRef -> Just []
_ -> Nothing

unTuplePattern :: Pattern.PatternP loc -> Maybe [Pattern.PatternP loc]
unTuplePattern :: Pattern.Pattern loc -> Maybe [Pattern.Pattern loc]
unTuplePattern p = case p of
Pattern.ConstructorP _ PairRef 0 [fst, snd] -> (fst : ) <$> unTuplePattern snd
Pattern.ConstructorP _ UnitRef 0 [] -> Just []
Pattern.Constructor _ PairRef 0 [fst, snd] -> (fst : ) <$> unTuplePattern snd
Pattern.Constructor _ UnitRef 0 [] -> Just []
_ -> Nothing

unUnitRef,unPairRef,unOptionalRef:: Reference -> Bool
Expand Down
1 change: 0 additions & 1 deletion parser-typechecker/src/Unison/Codebase/Branch.hs
@@ -1,4 +1,3 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE PatternSynonyms #-}
Expand Down
@@ -1,7 +1,6 @@
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE LambdaCase #-}

module Unison.Codebase.Branch.Dependencies where

Expand Down
2 changes: 0 additions & 2 deletions parser-typechecker/src/Unison/Codebase/Causal.hs
@@ -1,6 +1,4 @@
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Unison.Codebase.Causal where

import Unison.Prelude
Expand Down
@@ -1,5 +1,4 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}

module Unison.Codebase.Editor.AuthorInfo where

Expand Down
16 changes: 1 addition & 15 deletions parser-typechecker/src/Unison/Codebase/Editor/HandleInput.hs
@@ -1,15 +1,10 @@
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ApplicativeDo #-}
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DoAndIfThenElse #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE BangPatterns #-}
Expand Down Expand Up @@ -633,12 +628,7 @@ loop = do
let matchingTypes = toList (getHQ'Types hq)
case (matchingTerms, matchingTypes) of
([], []) -> respond (NameNotFound hq)
-- delete one term
([r], []) -> goMany (Set.singleton r) Set.empty
-- delete one type
([], [r]) -> goMany Set.empty (Set.singleton r)
(Set.fromList -> tms, Set.fromList -> tys) ->
ifConfirmed (goMany tms tys) (nameConflicted hq tms tys)
(Set.fromList -> tms, Set.fromList -> tys) -> goMany tms tys
where
resolvedPath = resolveSplit' (HQ'.toName <$> hq)
goMany tms tys = do
Expand Down Expand Up @@ -1858,10 +1848,6 @@ doDisplay outputLoc names r = do
loadDecl _ = pure Nothing
rendered <- DisplayValues.displayTerm ppe loadTerm loadTypeOfTerm evalTerm loadDecl tm
respond $ DisplayRendered loc rendered
-- We set latestFile to be programmatically generated, if we
-- are viewing these definitions to a file - this will skip the
-- next update for that file (which will happen immediately)
latestFile .= ((, True) <$> loc)

getLinks :: (Var v, Monad m)
=> Input
Expand Down
@@ -1,4 +1,4 @@
{-# Language DeriveFunctor, DeriveFoldable, DeriveTraversable #-}
{-# Language DeriveFoldable, DeriveTraversable #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE RecordWildCards #-}
Expand Down
1 change: 0 additions & 1 deletion parser-typechecker/src/Unison/Codebase/FileCodebase.hs
@@ -1,7 +1,6 @@
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE ViewPatterns #-}

module Unison.Codebase.FileCodebase
Expand Down
@@ -1,7 +1,6 @@
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE ViewPatterns #-}

Expand All @@ -10,6 +9,7 @@ module Unison.Codebase.FileCodebase.Common
, SyncToDir
, SimpleLens
, codebaseExists
, codebasePath
, hashExists
-- dirs (parent of all the files)
, branchHeadDir
Expand Down
Expand Up @@ -2,12 +2,9 @@
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE BlockArguments #-}


module Unison.Codebase.FileCodebase.SlimCopyRegenerateIndex (syncToDirectory) where
Expand Down
1 change: 0 additions & 1 deletion parser-typechecker/src/Unison/Codebase/Runtime.hs
@@ -1,5 +1,4 @@
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE PatternSynonyms #-}

module Unison.Codebase.Runtime where
Expand Down
1 change: 0 additions & 1 deletion parser-typechecker/src/Unison/Codebase/Serialization.hs
@@ -1,4 +1,3 @@
{-# LANGUAGE DoAndIfThenElse #-}
{-# LANGUAGE RankNTypes #-}

module Unison.Codebase.Serialization where
Expand Down
61 changes: 30 additions & 31 deletions parser-typechecker/src/Unison/Codebase/Serialization/V1.hs
@@ -1,6 +1,5 @@
{-# LANGUAGE Strict #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FlexibleContexts, RankNTypes #-}
{-# LANGUAGE RankNTypes #-}

module Unison.Codebase.Serialization.V1 where

Expand All @@ -10,7 +9,7 @@ import Prelude hiding (getChar, putChar)

-- import qualified Data.Text as Text
import qualified Unison.Pattern as Pattern
import Unison.PatternP ( Pattern
import Unison.Pattern ( Pattern
, SeqOp
)
import Data.Bits ( Bits )
Expand Down Expand Up @@ -405,37 +404,37 @@ getSymbol = Symbol <$> getLength <*> (Var.User <$> getText)

putPattern :: MonadPut m => (a -> m ()) -> Pattern a -> m ()
putPattern putA p = case p of
Pattern.UnboundP a -> putWord8 0 *> putA a
Pattern.VarP a -> putWord8 1 *> putA a
Pattern.BooleanP a b -> putWord8 2 *> putA a *> putBoolean b
Pattern.IntP a n -> putWord8 3 *> putA a *> putInt n
Pattern.NatP a n -> putWord8 4 *> putA a *> putNat n
Pattern.FloatP a n -> putWord8 5 *> putA a *> putFloat n
Pattern.ConstructorP a r cid ps ->
Pattern.Unbound a -> putWord8 0 *> putA a
Pattern.Var a -> putWord8 1 *> putA a
Pattern.Boolean a b -> putWord8 2 *> putA a *> putBoolean b
Pattern.Int a n -> putWord8 3 *> putA a *> putInt n
Pattern.Nat a n -> putWord8 4 *> putA a *> putNat n
Pattern.Float a n -> putWord8 5 *> putA a *> putFloat n
Pattern.Constructor a r cid ps ->
putWord8 6
*> putA a
*> putReference r
*> putLength cid
*> putFoldable (putPattern putA) ps
Pattern.AsP a p -> putWord8 7 *> putA a *> putPattern putA p
Pattern.EffectPureP a p -> putWord8 8 *> putA a *> putPattern putA p
Pattern.EffectBindP a r cid args k ->
Pattern.As a p -> putWord8 7 *> putA a *> putPattern putA p
Pattern.EffectPure a p -> putWord8 8 *> putA a *> putPattern putA p
Pattern.EffectBind a r cid args k ->
putWord8 9
*> putA a
*> putReference r
*> putLength cid
*> putFoldable (putPattern putA) args
*> putPattern putA k
Pattern.SequenceLiteralP a ps ->
Pattern.SequenceLiteral a ps ->
putWord8 10 *> putA a *> putFoldable (putPattern putA) ps
Pattern.SequenceOpP a l op r ->
Pattern.SequenceOp a l op r ->
putWord8 11
*> putA a
*> putPattern putA l
*> putSeqOp op
*> putPattern putA r
Pattern.TextP a t -> putWord8 12 *> putA a *> putText t
Pattern.CharP a c -> putWord8 13 *> putA a *> putChar c
Pattern.Text a t -> putWord8 12 *> putA a *> putText t
Pattern.Char a c -> putWord8 13 *> putA a *> putChar c

putSeqOp :: MonadPut m => SeqOp -> m ()
putSeqOp Pattern.Cons = putWord8 0
Expand All @@ -451,32 +450,32 @@ getSeqOp = getWord8 >>= \case

getPattern :: MonadGet m => m a -> m (Pattern a)
getPattern getA = getWord8 >>= \tag -> case tag of
0 -> Pattern.UnboundP <$> getA
1 -> Pattern.VarP <$> getA
2 -> Pattern.BooleanP <$> getA <*> getBoolean
3 -> Pattern.IntP <$> getA <*> getInt
4 -> Pattern.NatP <$> getA <*> getNat
5 -> Pattern.FloatP <$> getA <*> getFloat
6 -> Pattern.ConstructorP <$> getA <*> getReference <*> getLength <*> getList
0 -> Pattern.Unbound <$> getA
1 -> Pattern.Var <$> getA
2 -> Pattern.Boolean <$> getA <*> getBoolean
3 -> Pattern.Int <$> getA <*> getInt
4 -> Pattern.Nat <$> getA <*> getNat
5 -> Pattern.Float <$> getA <*> getFloat
6 -> Pattern.Constructor <$> getA <*> getReference <*> getLength <*> getList
(getPattern getA)
7 -> Pattern.AsP <$> getA <*> getPattern getA
8 -> Pattern.EffectPureP <$> getA <*> getPattern getA
7 -> Pattern.As <$> getA <*> getPattern getA
8 -> Pattern.EffectPure <$> getA <*> getPattern getA
9 ->
Pattern.EffectBindP
Pattern.EffectBind
<$> getA
<*> getReference
<*> getLength
<*> getList (getPattern getA)
<*> getPattern getA
10 -> Pattern.SequenceLiteralP <$> getA <*> getList (getPattern getA)
10 -> Pattern.SequenceLiteral <$> getA <*> getList (getPattern getA)
11 ->
Pattern.SequenceOpP
Pattern.SequenceOp
<$> getA
<*> getPattern getA
<*> getSeqOp
<*> getPattern getA
12 -> Pattern.TextP <$> getA <*> getText
13 -> Pattern.CharP <$> getA <*> getChar
12 -> Pattern.Text <$> getA <*> getText
13 -> Pattern.Char <$> getA <*> getChar
_ -> unknownTag "Pattern" tag

putTerm :: (MonadPut m, Ord v)
Expand Down
1 change: 0 additions & 1 deletion parser-typechecker/src/Unison/Codebase/Watch.hs
@@ -1,5 +1,4 @@
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE DoAndIfThenElse #-}
{-# LANGUAGE OverloadedStrings #-}

module Unison.Codebase.Watch where
Expand Down
6 changes: 3 additions & 3 deletions parser-typechecker/src/Unison/Codecs.hs
@@ -1,4 +1,4 @@
{-# LANGUAGE PatternSynonyms, FlexibleContexts #-}
{-# LANGUAGE PatternSynonyms #-}

module Unison.Codecs where

Expand Down Expand Up @@ -28,8 +28,8 @@ import Unison.UnisonFile (UnisonFile, pattern UnisonFile)
import qualified Unison.UnisonFile as UF
import Unison.Var (Var)
import qualified Unison.Var as Var
import Unison.PatternP (Pattern)
import qualified Unison.PatternP as Pattern
import Unison.Pattern (Pattern)
import qualified Unison.Pattern as Pattern

type Pos = Word64

Expand Down
3 changes: 0 additions & 3 deletions parser-typechecker/src/Unison/CommandLine.hs
@@ -1,8 +1,5 @@
{-# LANGUAGE DoAndIfThenElse #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE ViewPatterns #-}


Expand Down
1 change: 0 additions & 1 deletion parser-typechecker/src/Unison/CommandLine/DisplayValues.hs
@@ -1,4 +1,3 @@
{-# LANGUAGE ScopedTypeVariables #-}
{-# Language PatternSynonyms #-}
{-# Language OverloadedStrings #-}

Expand Down
3 changes: 0 additions & 3 deletions parser-typechecker/src/Unison/CommandLine/InputPattern.hs
@@ -1,9 +1,6 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE DoAndIfThenElse #-}


module Unison.CommandLine.InputPattern where
Expand Down
2 changes: 0 additions & 2 deletions parser-typechecker/src/Unison/CommandLine/InputPatterns.hs
@@ -1,7 +1,5 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE ViewPatterns #-}

module Unison.CommandLine.InputPatterns where
Expand Down
3 changes: 0 additions & 3 deletions parser-typechecker/src/Unison/CommandLine/Main.hs
@@ -1,8 +1,5 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE ViewPatterns #-}

module Unison.CommandLine.Main where
Expand Down
2 changes: 0 additions & 2 deletions parser-typechecker/src/Unison/CommandLine/OutputMessages.hs
@@ -1,11 +1,9 @@
{-# OPTIONS_GHC -fno-warn-partial-type-signatures #-}

{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE ViewPatterns #-}


Expand Down
3 changes: 0 additions & 3 deletions parser-typechecker/src/Unison/DeclPrinter.hs
@@ -1,7 +1,4 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE ScopedTypeVariables #-}

module Unison.DeclPrinter where

Expand Down
4 changes: 0 additions & 4 deletions parser-typechecker/src/Unison/FileParser.hs
@@ -1,8 +1,4 @@
{-# Language DoAndIfThenElse #-}
{-# Language DeriveFunctor #-}
{-# Language DeriveTraversable #-}
{-# Language ScopedTypeVariables #-}
{-# Language TupleSections #-}
{-# Language OverloadedStrings #-}

module Unison.FileParser where
Expand Down
1 change: 0 additions & 1 deletion parser-typechecker/src/Unison/FileParsers.hs
@@ -1,6 +1,5 @@
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE UnicodeSyntax #-}

module Unison.FileParsers where
Expand Down

0 comments on commit ed62137

Please sign in to comment.