Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into providers
Browse files Browse the repository at this point in the history
  • Loading branch information
david-christiansen committed Mar 21, 2013
2 parents 918ce77 + c3dcf56 commit 161ef3d
Show file tree
Hide file tree
Showing 34 changed files with 607 additions and 230 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ New in 0.9.8:


User visible changes: User visible changes:


* Added "rewrite ... in ..." construct
* Renamed EFF to EFFECT in Effect package * Renamed EFF to EFFECT in Effect package
* Experimental Java backend * Experimental Java backend
* Tab completion in REPL * Tab completion in REPL
Expand Down
70 changes: 70 additions & 0 deletions contribs/tool-support/sublime-text/Idris/Idris.JSON-tmLanguage
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,70 @@
{ "name": "Idris",
"scopeName": "source.idris",
"fileTypes": ["idr"],
"patterns": [
{ "name": "keyword.control.idris",
"match": "\\b(if|then|else|do|let|in|data|codata|record|dsl|import)\\b"

},
{ "name": "keyword.control.idris",
"match": "\\b(impossible|case|of|total|partial|mutual|infix|infixl|infixr)\\b"

},
{ "name": "keyword.control.idris",
"match": "\\b(where|with|syntax|proof|postulate|using|namespace|class|instance)\\b"

},
{ "name": "keyword.control.idris",
"match": "\\b(public|private|abstract|implicit)\\b"

},
{ "name": "keyword.other.idris",
"match": "\\b(Type|Int|Integer|Float|Char|String|Ptr|Bits8|Bits16|Bits32|Bits64)\\b"
},
{ "name": "constant.numeric.idris",
"match": "\\b(S|O)\\b"
},
{ "match": "\\b([0-9]+|0([xX][0-9a-fA-F]+|[oO][0-7]+))\\b",
"name": "constant.numeric.idris",
"comment": "integers"
},
{
"match": "\\b([0-9]+\\.[0-9]+([eE][+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+)\\b",
"name": "constant.numeric.float.idris",
"comment": "floats"
},
{
"name": "comment.line.idris",
"match": "(--).*$\n?",
"comment": "Line comment"
},
{ "name": "comment.block.idris",
"begin": "\\{-",
"end": "-\\}",
"comment": "Block comment"
},
{
"name": "string.quoted.idris",
"begin": "\"",
"beginCaptures": {
"0": { "name": "punctuation.definition.string.begin.idris"}
},
"end": "\"",
"endCaptures": {
"0": { "name": "punctuation.definition.string.end.idris"}
},
"patterns": [
{ "name": "constant.character.escape.idris",
"match": "\\\\\""
}
]

}


],
"repository": {

},
"uuid": "4dd16092-ffa5-4ba4-8075-e5da9f368a72"
}
126 changes: 126 additions & 0 deletions contribs/tool-support/sublime-text/Idris/Idris.tmLanguage
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>idr</string>
</array>
<key>name</key>
<string>Idris</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\b(if|then|else|do|let|in|data|codata|record|dsl|import)\b</string>
<key>name</key>
<string>keyword.control.idris</string>
</dict>
<dict>
<key>match</key>
<string>\b(impossible|case|of|total|partial|mutual|infix|infixl|infixr)\b</string>
<key>name</key>
<string>keyword.control.idris</string>
</dict>
<dict>
<key>match</key>
<string>\b(where|with|syntax|proof|postulate|using|namespace|class|instance)\b</string>
<key>name</key>
<string>keyword.control.idris</string>
</dict>
<dict>
<key>match</key>
<string>\b(public|private|abstract|implicit)\b</string>
<key>name</key>
<string>keyword.control.idris</string>
</dict>
<dict>
<key>match</key>
<string>\b(Type|Int|Integer|Float|Char|String|Ptr|Bits8|Bits16|Bits32|Bits64)\b</string>
<key>name</key>
<string>keyword.other.idris</string>
</dict>
<dict>
<key>match</key>
<string>\b(S|O)\b</string>
<key>name</key>
<string>constant.numeric.idris</string>
</dict>
<dict>
<key>comment</key>
<string>integers</string>
<key>match</key>
<string>\b([0-9]+|0([xX][0-9a-fA-F]+|[oO][0-7]+))\b</string>
<key>name</key>
<string>constant.numeric.idris</string>
</dict>
<dict>
<key>comment</key>
<string>floats</string>
<key>match</key>
<string>\b([0-9]+\.[0-9]+([eE][+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+)\b</string>
<key>name</key>
<string>constant.numeric.float.idris</string>
</dict>
<dict>
<key>comment</key>
<string>Line comment</string>
<key>match</key>
<string>(--).*$
?</string>
<key>name</key>
<string>comment.line.idris</string>
</dict>
<dict>
<key>begin</key>
<string>\{-</string>
<key>comment</key>
<string>Block comment</string>
<key>end</key>
<string>-\}</string>
<key>name</key>
<string>comment.block.idris</string>
</dict>
<dict>
<key>begin</key>
<string>"</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.idris</string>
</dict>
</dict>
<key>end</key>
<string>"</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.idris</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.idris</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\\"</string>
<key>name</key>
<string>constant.character.escape.idris</string>
</dict>
</array>
</dict>
</array>
<key>repository</key>
<dict>
</dict>
<key>scopeName</key>
<string>source.idris</string>
<key>uuid</key>
<string>4dd16092-ffa5-4ba4-8075-e5da9f368a72</string>
</dict>
</plist>
5 changes: 5 additions & 0 deletions contribs/tool-support/sublime-text/Idris/idris.sublime-build
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cmd": ["idris", "$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.idris"
}
11 changes: 11 additions & 0 deletions contribs/tool-support/sublime-text/README.md
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,11 @@
#### Idris support for Sublime Text 2

To install, copy the Idris directory to Sublime Text's Packages directory.

To build a new Idris.tmLanguage file from the Idris.JSON-tmLanguage file, Sublime Text needs to have the AAAPackageDev package installed.

Syntax Definitions tutorial: https://sublime-text-unofficial-documentation.readthedocs.org/en/latest/extensibility/syntaxdefs.html

Syntax Definitions reference: https://sublime-text-unofficial-documentation.readthedocs.org/en/latest/reference/syntaxdefs.html

Most used scopes: http://manual.macromates.com/en/language_grammars#naming_conventions
12 changes: 11 additions & 1 deletion contribs/tool-support/vim/indent/idris.vim
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
" Based on haskell indentation by motemen <motemen@gmail.com> " Based on haskell indentation by motemen <motemen@gmail.com>
" "
" author: raichoo (raichoo@googlemail.com) " author: raichoo (raichoo@googlemail.com)
" date: Nov 2 2012 " date: Mar 19 2013
" "
" Modify g:idris_indent_if and g:idris_indent_case to " Modify g:idris_indent_if and g:idris_indent_case to
" change indentation for `if'(default 3) and `case'(default 5). " change indentation for `if'(default 3) and `case'(default 5).
Expand Down Expand Up @@ -36,6 +36,12 @@ if !exists('g:idris_indent_let')
let g:idris_indent_let = 4 let g:idris_indent_let = 4
endif endif


if !exists('g:idris_indent_rewrite')
" rewrite prf in expr
" >>>>x
let g:idris_indent_rewrite = 8
endif

if !exists('g:idris_indent_where') if !exists('g:idris_indent_where')
" where f : Nat -> Nat " where f : Nat -> Nat
" >>>>>>f x = x " >>>>>>f x = x
Expand Down Expand Up @@ -71,6 +77,10 @@ function! GetIdrisIndent()
return match(prevline, 'let') + g:idris_indent_let return match(prevline, 'let') + g:idris_indent_let
endif endif


if prevline =~ '\<rewrite\>\s\+.\+\<in\>\s*$'
return match(prevline, 'rewrite') + g:idris_indent_rewrite
endif

if prevline !~ '\<else\>' if prevline !~ '\<else\>'
let s = match(prevline, '\<if\>.*\&.*\zs\<then\>') let s = match(prevline, '\<if\>.*\&.*\zs\<then\>')
if s > 0 if s > 0
Expand Down
6 changes: 3 additions & 3 deletions contribs/tool-support/vim/syntax/idris.vim
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
" highlighter to support idris. " highlighter to support idris.
" "
" author: raichoo (raichoo@googlemail.com) " author: raichoo (raichoo@googlemail.com)
" date: Mar 12 2013 " date: Mar 20 2013


syn match idrisModule "\<\(module\|namespace\)\>" syn match idrisModule "\<\(module\|namespace\)\>"
syn match idrisImport "\<import\>" syn match idrisImport "\<import\>"
syn match idrisStructure "\<\(class\|\(co\)\?data\|instance\|where\|record\|dsl\)\>" syn match idrisStructure "\<\(class\|\(co\)\?data\|instance\|where\|record\|dsl\)\>"
syn match idrisVisibility "\<\(public\|abstract\|private\)\>" syn match idrisVisibility "\<\(public\|abstract\|private\)\>"
syn match idrisBlock "\<\(parameters\|mutual\|postulate\|using\)\>" syn match idrisBlock "\<\(parameters\|mutual\|postulate\|using\)\>"
syn match idrisAnnotation "\<\(total\|partial\|auto\|impossible\|static\|implicit\)\>" syn match idrisAnnotation "\<\(total\|partial\|auto\|impossible\|static\|implicit\)\>"
syn match idrisStatement "\<\(do\|case\|of\|let\|in\|with\)\>" syn match idrisStatement "\<\(do\|case\|of\|rewrite\|let\|in\|with\)\>"
syn match idrisSyntax "\(pattern \+\|term \+\)\?syntax" syn match idrisSyntax "\(pattern \+\|term \+\)\?syntax"
syn match idrisConditional "\<\(if\|then\|else\)\>" syn match idrisConditional "\<\(if\|then\|else\)\>"
syn match idrisTactic contained "\<\(intros\?\|rewrite\|exact\|refine\|trivial\|let\|focus\|try\|compute\|solve\|attack\|reflect\)\>" syn match idrisTactic contained "\<\(intros\?\|rewrite\|exact\|refine\|trivial\|let\|focus\|try\|compute\|solve\|attack\|reflect\)\>"
Expand All @@ -28,7 +28,7 @@ syn match idrisLink "%\(lib\|link\|include\)"
syn match idrisDirective "%\(access\|default\|assert_total\)" syn match idrisDirective "%\(access\|default\|assert_total\)"
syn match idrisDSL "\(lambda\|variable\|\index_first\|index_next\)" syn match idrisDSL "\(lambda\|variable\|\index_first\|index_next\)"
syn region idrisString start=+"+ skip=+\\\\\|\\"+ end=+"+ syn region idrisString start=+"+ skip=+\\\\\|\\"+ end=+"+
syn region idrisBlockComment start="{-" end="-}" syn region idrisBlockComment start="{-" end="-}" contains=idrisBlockComment
syn region idrisProofBlock start="\(default\s\+\)\?\(proof\|tactics\) *{" end="}" contains=idrisTactic syn region idrisProofBlock start="\(default\s\+\)\?\(proof\|tactics\) *{" end="}" contains=idrisTactic


syn match idrisBadLeadingWhiteSpace "^\s*\t\+" syn match idrisBadLeadingWhiteSpace "^\s*\t\+"
Expand Down
3 changes: 3 additions & 0 deletions effects/Effect/Exception.idr
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ instance Show a => Handler (Exception a) IO where
instance Handler (Exception a) (IOExcept a) where instance Handler (Exception a) (IOExcept a) where
handle _ (Raise e) k = ioM (return (Left e)) handle _ (Raise e) k = ioM (return (Left e))


instance Handler (Exception a) (Either a) where
handle _ (Raise e) k = Left e

EXCEPTION : Type -> EFFECT EXCEPTION : Type -> EFFECT
EXCEPTION t = MkEff () (Exception t) EXCEPTION t = MkEff () (Exception t)


Expand Down
9 changes: 5 additions & 4 deletions effects/Effect/StdIO.idr
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ instance Handler StdIO (IOExcept a) where


data IOStream a = MkStream (List String -> (a, List String)) data IOStream a = MkStream (List String -> (a, List String))


injStream : a -> IOStream a
injStream v = MkStream (\x => (v, []))

instance Handler StdIO IOStream where instance Handler StdIO IOStream where
handle () (PutStr s) k handle () (PutStr s) k
= MkStream (\x => case k () () of = MkStream (\x => case k () () of
Expand Down Expand Up @@ -55,5 +52,9 @@ mkStrFn : Env IOStream xs ->
List String -> (a, List String) List String -> (a, List String)
mkStrFn {a} env p input = case mkStrFn' of mkStrFn {a} env p input = case mkStrFn' of
MkStream f => f input MkStream f => f input
where mkStrFn' : IOStream a where injStream : a -> IOStream a
injStream v = MkStream (\x => (v, []))
mkStrFn' : IOStream a
mkStrFn' = runWith injStream env p mkStrFn' = runWith injStream env p


6 changes: 4 additions & 2 deletions effects/Effects.idr
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ data EffM : (m : Type -> Type) ->
List EFFECT -> List EFFECT -> Type -> Type where List EFFECT -> List EFFECT -> Type -> Type where
value : a -> EffM m xs xs a value : a -> EffM m xs xs a
ebind : EffM m xs xs' a -> (a -> EffM m xs' xs'' b) -> EffM m xs xs'' b ebind : EffM m xs xs' a -> (a -> EffM m xs' xs'' b) -> EffM m xs xs'' b
effect : {a, b: _} -> {e : Effect} -> effect : (prf : EffElem e a xs) ->
(prf : EffElem e a xs) ->
(eff : e a b t) -> (eff : e a b t) ->
EffM m xs (updateResTy xs prf eff) t EffM m xs (updateResTy xs prf eff) t
lift : (prf : SubList ys xs) -> lift : (prf : SubList ys xs) ->
Expand Down Expand Up @@ -189,6 +188,9 @@ runEnv env prog = eff env prog (\env, r => pure (env, r))
runPure : Env id xs -> EffM id xs xs' a -> a runPure : Env id xs -> EffM id xs xs' a -> a
runPure env prog = eff env prog (\env, r => r) runPure env prog = eff env prog (\env, r => r)


runPureEnv : Env id xs -> EffM id xs xs' a -> (Env id xs', a)
runPureEnv env prog = eff env prog (\env, r => (env, r))

runWith : (a -> m a) -> Env m xs -> EffM m xs xs' a -> m a runWith : (a -> m a) -> Env m xs -> EffM m xs xs' a -> m a
runWith inj env prog = eff env prog (\env, r => inj r) runWith inj env prog = eff env prog (\env, r => inj r)


Expand Down
1 change: 1 addition & 0 deletions java/executable_pom_template.xml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<artifactId>idris</artifactId> <artifactId>idris</artifactId>
<version>$RTS-VERSION$</version> <version>$RTS-VERSION$</version>
</dependency> </dependency>
$DEPENDENCIES$
</dependencies> </dependencies>




Expand Down
Loading

0 comments on commit 161ef3d

Please sign in to comment.