Commit c30de057 authored by Andrew Gibiansky's avatar Andrew Gibiansky

allowing two type signatures together

parent 9b95c5e3
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
"cell_type": "code", "cell_type": "code",
"collapsed": false, "collapsed": false,
"input": [ "input": [
":ext Impli\n", ":ext NoImplicitPrelude\n",
"4 + 4" "4 + 4"
], ],
"language": "python", "language": "python",
...@@ -45,14 +45,18 @@ ...@@ -45,14 +45,18 @@
}, },
"outputs": [ "outputs": [
{ {
"html": [
"<span class='err-msg'>Not in scope: `+'<br/>Perhaps you meant `IHaskellPrelude.+' (imported from Prelude)</span>"
],
"metadata": {}, "metadata": {},
"output_type": "display_data", "output_type": "display_data",
"text": [ "text": [
"8" "Not in scope: `+'\n",
"Perhaps you meant `IHaskellPrelude.+' (imported from Prelude)"
] ]
} }
], ],
"prompt_number": 2 "prompt_number": 3
}, },
{ {
"cell_type": "code", "cell_type": "code",
...@@ -96,7 +100,9 @@ ...@@ -96,7 +100,9 @@
"parser" "parser"
], ],
"language": "python", "language": "python",
"metadata": {}, "metadata": {
"hidden": false
},
"outputs": [ "outputs": [
{ {
"javascript": [ "javascript": [
......
...@@ -218,6 +218,14 @@ joinFunctions (Located line (TypeSignature sig) : Located dl (Declaration decl) ...@@ -218,6 +218,14 @@ joinFunctions (Located line (TypeSignature sig) : Located dl (Declaration decl)
Located line (Declaration $ sig ++ "\n" ++ joinedDecl):remaining Located line (Declaration $ sig ++ "\n" ++ joinedDecl):remaining
where Located _ (Declaration joinedDecl):remaining = joinFunctions $ Located dl (Declaration decl) : rest where Located _ (Declaration joinedDecl):remaining = joinFunctions $ Located dl (Declaration decl) : rest
-- Also allow two type signatures. This is necessary for operator
-- declarations in which you have a fixity declaration.
joinFunctions (Located line (TypeSignature sig) :
Located _ (TypeSignature sig') :
Located dl (Declaration decl) : rest) =
Located line (Declaration $ intercalate "\n" [sig, sig', joinedDecl]):remaining
where Located _ (Declaration joinedDecl):remaining = joinFunctions $ Located dl (Declaration decl) : rest
joinFunctions (x:xs) = x : joinFunctions xs joinFunctions (x:xs) = x : joinFunctions xs
joinFunctions [] = [] joinFunctions [] = []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment