Verified Commit c89a2e35 authored by Camil Staps's avatar Camil Staps 🚀

Cleanup for !313

parent 869a14e5
Pipeline #40620 passed with stage
in 1 minute and 57 seconds
......@@ -3,10 +3,10 @@
/// Ported from the Haskell frontend by Tim Steenvoorden
definition module Data.Integer
import StdOverloaded
from Data.GenDefault import generic gDefault
from Data.GenLexOrd import generic gLexOrd, :: LexOrd
from Data.GenEq import generic gEq
import StdOverloaded
from Data.GenLexOrd import generic gLexOrd, :: LexOrd
:: Integer = {integer_s ::!Int, integer_a ::!.{#Int}};
......@@ -47,6 +47,6 @@ instance toInteger String
integer_a_to_double :: !Int !{#Int} -> Real
*/
derive gDefault Integer
derive gEq Integer
derive gLexOrd Integer
derive gDefault Integer
......@@ -1132,9 +1132,11 @@ rest_all_zeros i a
*/
gDefault{|Integer|} = {integer_s=0, integer_a={}}
gEq{|Integer|} x y = x == y
gLexOrd{|Integer|} x y
| x == y = 'Data.GenLexOrd'.EQ
| x < y = 'Data.GenLexOrd'.LT
= 'Data.GenLexOrd'.GT
gDefault{|Integer|} = {integer_s=0, integer_a={}}
| x == y = 'Data.GenLexOrd'.EQ
| x < y = 'Data.GenLexOrd'.LT
| otherwise = 'Data.GenLexOrd'.GT
definition module Data.Integer.GenJSON
from Data.Maybe import :: Maybe
from Text.GenJSON import generic JSONEncode, generic JSONDecode, :: JSONNode
from StdMaybe import :: Maybe
from Data.Integer import :: Integer
from Text.GenJSON import generic JSONEncode, generic JSONDecode, :: JSONNode
derive JSONEncode Integer
derive JSONDecode Integer
......@@ -3,8 +3,9 @@ implementation module Data.Integer.GenJSON
import StdEnv
import Data.Integer, Text.GenJSON
JSONEncode{|Integer|} _ i = [JSONInt i.integer_s, JSONArray [JSONInt c\\c<-:i.integer_a]]
JSONDecode{|Integer|} _ l=:[JSONInt s,JSONArray a:rest]
| not (all (\x->x=:(JSONInt _)) a) = (Nothing, l)
= (Just {integer_s=s, integer_a={c\\JSONInt c<-a}}, rest)
JSONEncode{|Integer|} _ i = [JSONInt i.integer_s, JSONArray [JSONInt c \\ c <-: i.integer_a]]
JSONDecode{|Integer|} _ l=:[JSONInt s, JSONArray a:rest]
| not (all (\x -> x=:(JSONInt _)) a)
= (Nothing, l)
= (Just {integer_s=s, integer_a={c \\ JSONInt c <- a}}, rest)
JSONDecode{|Integer|} _ l = (Nothing, l)
......@@ -114,9 +114,9 @@ import qualified Data.IntSet
import qualified Data.IntSet.Base
import qualified Data.Int
import qualified Data.Integer
import qualified Data.Integer.GenJSON
import qualified Data.Integer.Add
import qualified Data.Integer.Div
import qualified Data.Integer.GenJSON
import qualified Data.Integer.Mul
import qualified Data.Integer.ToInteger
import qualified Data.Integer.ToString
......
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