diff --git "a/data/idris/data.json" "b/data/idris/data.json" new file mode 100644--- /dev/null +++ "b/data/idris/data.json" @@ -0,0 +1,100 @@ +{"size":1628,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"-- ----------------------------------------------------------------- [ XML.idr ]\n-- Module : XML.idr\n-- Copyright : (c) Jan de Muijnck-Hughes\n-- License : see LICENSE\n-- --------------------------------------------------------------------- [ EOH ]\nmodule Readability.Process.XML\n\nimport Prelude.Strings\n\nimport Effects\nimport Effect.State\n\nimport XML.DOM\nimport XML.XPath\n\nimport Readability.WordTypes\nimport Readability.Stats\nimport Readability.Metrics\n\nimport Readability.Process.Effs\nimport public Readability.Process.Common\n\n||| Extract the sentences from a text node.\ngetSentences : Document a -> List String\ngetSentences (Text t) = Strings.split (isEOS) t\n where\n isEOS : Char -> Bool\n isEOS e = List.elem e ['.', ':', '!', '\"', '\\'']\n\nprocessPara : List String -> Eff () ReadEffs\nprocessPara Nil = pure ()\nprocessPara (s::ss) = do\n processSentence $ words s\n updateReadState (\\x => record {sentances = (sentances x) + 1} x)\n processPara ss\n\nprocessParas : List $ Document NODE -> Eff () ReadEffs\nprocessParas Nil = pure ()\nprocessParas (Node p::ps) = do\n processPara (getSentences p)\n processParas ps\n\n\nexport\ncalcReadabilityE : Document DOCUMENT\n -> Eff (Maybe ReadResult) ReadEffs\ncalcReadabilityE doc =\n case query \"\/\/*\/text()\" doc of\n Left err => pure Nothing\n Right ps => do\n processParas ps\n res <- getReadState\n pure $ Just (calcScores res)\n\nexport\ncalcReadability : Document DOCUMENT -> Maybe ReadResult\ncalcReadability doc = runPure $ calcReadabilityE doc\n\n-- --------------------------------------------------------------------- [ EOF ]\n","avg_line_length":27.1333333333,"max_line_length":80,"alphanum_fraction":0.5976658477} +{"size":1415,"ext":"idr","lang":"Idris","max_stars_count":2.0,"content":"-- ------------------------------------------------------------- [ Example.idr ]\n\nmodule Data.ML.Example\n\nimport public Data.ML.Categorical\n\n%access public export\n\n\n-- --------------------------------------------- [ Categorical Feature Example ]\n\nnamespace Categorical\n\n exampleData : List String\n exampleData = [ \"male\", \"female\", \"male\", \"male\"\n , \"female\", \"male\", \"female\", \"female\"\n ]\n\n\n ||| ```idris example\n ||| catToNum Categorical.exampleData\n ||| ```\n example : List (List Integer)\n example = catToNum Categorical.exampleData\n\n\n-- --------------------------------------------------------- [ Titanic Example ]\n\nnamespace Titanic\n\n exampleData : List String\n exampleData = [ \"C65\", \"\", \"E36\", \"C54\", \"B57 B59 B63 B66\" ]\n\n\n -- TODO: record CabinFeature where\n\n ||| ```idris example\n ||| Titanic.example\n ||| ```\n example : List (Char, Integer, Nat)\n example = go . words <$> Titanic.exampleData\n where\n go : List String -> (Char, Integer, Nat)\n go [] = ('X', -1, 0)\n go (cabin :: cabins) with (strM cabin)\n go (\"\" :: cabins) | StrNil = ('X', -1, 0)\n go (strCons c num :: cabins) | (StrCons c num) =\n ( c\n , cast num\n , S (length cabins)\n )\n\n-- --------------------------------------------------------------------- [ EOF ]\n","avg_line_length":26.2037037037,"max_line_length":80,"alphanum_fraction":0.4381625442} +{"size":1089,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"-- --------------------------------------------------------------- [ Error.idr ]\n-- Module : Error.idr\n-- Copyright : (c) Jan de Muijnck-Hughes\n-- License : see LICENSE\n-- --------------------------------------------------------------------- [ EOH ]\nmodule Freyja.Error\n\nimport XML.XPath\n\n%access public export\n\ndata FreyjaError : Type where\n ExtractionError : XPathError -> FreyjaError\n GeneralError : String -> FreyjaError\n TextConvError : String -> FreyjaError\n MalformedDocError : String -> String -> FreyjaError\n\nShow FreyjaError where\n show (ExtractionError msg) = unwords [\"Extraction Error\", show msg]\n show (TextConvError msg) = unwords [\"Text Conversion Error\", show msg]\n show (GeneralError msg) = msg\n show (MalformedDocError qstr msg) =\n unlines [ \"Malformed Document Error.\"\n , \" The query:\"\n , unwords [\"\\t\", show qstr]\n , \"was expected to work,\"\n , msg]\n\nExtract : Type -> Type\nExtract a = Either FreyjaError a\n\n-- --------------------------------------------------------------------- [ EOF ]\n","avg_line_length":33.0,"max_line_length":80,"alphanum_fraction":0.5224977043} +{"size":9760,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"module Data.Strings\n\nimport Data.List\nimport Data.List1\n\nexport\nsingleton : Char -> String\nsingleton c = strCons c \"\"\n\npartial\nfoldr1 : (a -> a -> a) -> List a -> a\nfoldr1 _ [x] = x\nfoldr1 f (x::xs) = f x (foldr1 f xs)\n\npartial\nfoldl1 : (a -> a -> a) -> List a -> a\nfoldl1 f (x::xs) = foldl f x xs\n\n-- This works quickly because when string-concat builds the result, it allocates\n-- enough room in advance so there's only one allocation, rather than lots!\n%extern prim__fastAppend : List String -> String\n\nexport\nfastConcat : List String -> String\nfastConcat = prim__fastAppend\n\n-- This is a deprecated alias for fastConcat for backwards compatibility\n-- (unfortunately, we don't have %deprecated yet).\nexport\nfastAppend : List String -> String\nfastAppend = fastConcat\n\n||| Splits a character list into a list of whitespace separated character lists.\n|||\n||| ```idris example\n||| words' (unpack \" A B C D E \")\n||| ```\nwords' : List Char -> List (List Char)\nwords' s = case dropWhile isSpace s of\n [] => []\n s' => let (w, s'') = break isSpace s'\n in w :: words' s''\n\n||| Splits a string into a list of whitespace separated strings.\n|||\n||| ```idris example\n||| words \" A B C D E \"\n||| ```\nexport\nwords : String -> List String\nwords s = map pack (words' (unpack s))\n\n||| Joins the character lists by spaces into a single character list.\n|||\n||| ```idris example\n||| unwords' [['A'], ['B', 'C'], ['D'], ['E']]\n||| ```\nunwords' : List (List Char) -> List Char\nunwords' [] = []\nunwords' ws = assert_total (foldr1 addSpace ws) where\n addSpace : List Char -> List Char -> List Char\n addSpace w s = w ++ (' ' :: s)\n\n||| Joins the strings by spaces into a single string.\n|||\n||| ```idris example\n||| unwords [\"A\", \"BC\", \"D\", \"E\"]\n||| ```\nexport\nunwords : List String -> String\nunwords = pack . unwords' . map unpack\n\n||| Splits a character list into a list of newline separated character lists.\n|||\n||| ```idris example\n||| lines' (unpack \"\\rA BC\\nD\\r\\nE\\n\")\n||| ```\nlines' : List Char -> List (List Char)\nlines' [] = []\nlines' s = case break isNL s of\n (l, s') => l :: case s' of\n [] => []\n _ :: s'' => lines' (assert_smaller s s'')\n\n||| Splits a string into a list of newline separated strings.\n|||\n||| ```idris example\n||| lines \"\\rA BC\\nD\\r\\nE\\n\"\n||| ```\nexport\nlines : String -> List String\nlines s = map pack (lines' (unpack s))\n\n||| Joins the character lists by newlines into a single character list.\n|||\n||| ```idris example\n||| unlines' [['l','i','n','e'], ['l','i','n','e','2'], ['l','n','3'], ['D']]\n||| ```\nunlines' : List (List Char) -> List Char\nunlines' [] = []\nunlines' (l::ls) = l ++ '\\n' :: unlines' ls\n\n||| Joins the strings by newlines into a single string.\n|||\n||| ```idris example\n||| unlines [\"line\", \"line2\", \"ln3\", \"D\"]\n||| ```\nexport\nunlines : List String -> String\nunlines = pack . unlines' . map unpack\n\nexport\nltrim : String -> String\nltrim xs = pack (ltrimChars (unpack xs))\n where\n ltrimChars : List Char -> List Char\n ltrimChars [] = []\n ltrimChars (x :: xs) = if isSpace x then ltrimChars xs else (x :: xs)\n\nexport\ntrim : String -> String\ntrim = ltrim . reverse . ltrim . reverse\n\n||| Splits the string into a part before the predicate\n||| returns False and the rest of the string.\n|||\n||| ```idris example\n||| span (\/= 'C') \"ABCD\"\n||| ```\n||| ```idris example\n||| span (\/= 'C') \"EFGH\"\n||| ```\nexport\nspan : (Char -> Bool) -> String -> (String, String)\nspan p xs\n = case span p (unpack xs) of\n (x, y) => (pack x, pack y)\n\n||| Splits the string into a part before the predicate\n||| returns True and the rest of the string.\n|||\n||| ```idris example\n||| break (== 'C') \"ABCD\"\n||| ```\n||| ```idris example\n||| break (== 'C') \"EFGH\"\n||| ```\npublic export\nbreak : (Char -> Bool) -> String -> (String, String)\nbreak p = span (not . p)\n\n\n||| Splits the string into parts with the predicate\n||| indicating separator characters.\n|||\n||| ```idris example\n||| split (== '.') \".AB.C..D\"\n||| ```\npublic export\nsplit : (Char -> Bool) -> String -> List1 String\nsplit p xs = map pack (split p (unpack xs))\n\nexport\nstringToNatOrZ : String -> Nat\nstringToNatOrZ = fromInteger . prim__cast_StringInteger\n\nexport\ntoUpper : String -> String\ntoUpper str = pack (map toUpper (unpack str))\n\nexport\ntoLower : String -> String\ntoLower str = pack (map toLower (unpack str))\n\nexport partial\nstrIndex : String -> Int -> Char\nstrIndex = prim__strIndex\n\nexport partial\nstrLength : String -> Int\nstrLength = prim__strLength\n\nexport partial\nstrSubstr : Int -> Int -> String -> String\nstrSubstr = prim__strSubstr\n\nexport partial\nstrTail : String -> String\nstrTail = prim__strTail\n\nexport\nisPrefixOf : String -> String -> Bool\nisPrefixOf a b = isPrefixOf (unpack a) (unpack b)\n\nexport\nisSuffixOf : String -> String -> Bool\nisSuffixOf a b = isSuffixOf (unpack a) (unpack b)\n\nexport\nisInfixOf : String -> String -> Bool\nisInfixOf a b = isInfixOf (unpack a) (unpack b)\n\npublic export\ndata StrM : String -> Type where\n StrNil : StrM \"\"\n StrCons : (x : Char) -> (xs : String) -> StrM (strCons x xs)\n\npublic export -- primitives, so assert_total and believe_me needed\nstrM : (x : String) -> StrM x\nstrM \"\" = StrNil\nstrM x\n = assert_total $ believe_me $\n StrCons (prim__strHead x) (prim__strTail x)\n\nparseNumWithoutSign : List Char -> Integer -> Maybe Integer\nparseNumWithoutSign [] acc = Just acc\nparseNumWithoutSign (c :: cs) acc =\n if (c >= '0' && c <= '9')\n then parseNumWithoutSign cs ((acc * 10) + (cast ((ord c) - (ord '0'))))\n else Nothing\n\n||| Convert a positive number string to a Num.\n|||\n||| ```idris example\n||| parsePositive \"123\"\n||| ```\n||| ```idris example\n||| parsePositive {a=Int} \" +123\"\n||| ```\npublic export\nparsePositive : Num a => String -> Maybe a\nparsePositive s = parsePosTrimmed (trim s)\n where\n parsePosTrimmed : String -> Maybe a\n parsePosTrimmed s with (strM s)\n parsePosTrimmed \"\" | StrNil = Nothing\n parsePosTrimmed (strCons '+' xs) | (StrCons '+' xs) =\n map fromInteger (parseNumWithoutSign (unpack xs) 0)\n parsePosTrimmed (strCons x xs) | (StrCons x xs) =\n if (x >= '0' && x <= '9')\n then map fromInteger (parseNumWithoutSign (unpack xs) (cast (ord x - ord '0')))\n else Nothing\n\n||| Convert a number string to a Num.\n|||\n||| ```idris example\n||| parseInteger \" 123\"\n||| ```\n||| ```idris example\n||| parseInteger {a=Int} \" -123\"\n||| ```\npublic export\nparseInteger : (Num a, Neg a) => String -> Maybe a\nparseInteger s = parseIntTrimmed (trim s)\n where\n parseIntTrimmed : String -> Maybe a\n parseIntTrimmed s with (strM s)\n parseIntTrimmed \"\" | StrNil = Nothing\n parseIntTrimmed (strCons x xs) | (StrCons x xs) =\n if (x == '-')\n then map (\\y => negate (fromInteger y)) (parseNumWithoutSign (unpack xs) 0)\n else if (x == '+')\n then map fromInteger (parseNumWithoutSign (unpack xs) (cast {from=Int} 0))\n else if (x >= '0' && x <= '9')\n then map fromInteger (parseNumWithoutSign (unpack xs) (cast (ord x - ord '0')))\n else Nothing\n\n\n||| Convert a number string to a Double.\n|||\n||| ```idris example\n||| parseDouble \"+123.123e-2\"\n||| ```\n||| ```idris example\n||| parseDouble {a=Int} \" -123.123E+2\"\n||| ```\n||| ```idris example\n||| parseDouble {a=Int} \" +123.123\"\n||| ```\nexport -- it's a bit too slow at compile time\nparseDouble : String -> Maybe Double\nparseDouble = mkDouble . wfe . trim\n where\n intPow : Integer -> Integer -> Double\n intPow base exp = assert_total $ if exp > 0 then (num base exp) else 1 \/ (num base exp)\n where\n num : Integer -> Integer -> Double\n num base 0 = 1\n num base e = if e < 0\n then cast base * num base (e + 1)\n else cast base * num base (e - 1)\n\n natpow : Double -> Nat -> Double\n natpow x Z = 1\n natpow x (S n) = x * (natpow x n)\n\n mkDouble : Maybe (Double, Double, Integer) -> Maybe Double\n mkDouble (Just (w, f, e)) = let ex = intPow 10 e in\n Just $ (w * ex + f * ex)\n mkDouble Nothing = Nothing\n\n wfe : String -> Maybe (Double, Double, Integer)\n wfe cs = case split (== '.') cs of\n (wholeAndExp :: []) =>\n case split (\\c => c == 'e' || c == 'E') wholeAndExp of\n (whole::exp::[]) =>\n do\n w <- cast {from=Integer} <$> parseInteger whole\n e <- parseInteger exp\n pure (w, 0, e)\n (whole::[]) =>\n do\n w <- cast {from=Integer} <$> parseInteger whole\n pure (w, 0, 0)\n _ => Nothing\n (whole::fracAndExp::[]) =>\n case split (\\c => c == 'e' || c == 'E') fracAndExp of\n (\"\"::exp::[]) => Nothing\n (frac::exp::[]) =>\n do\n w <- cast {from=Integer} <$> parseInteger whole\n f <- (\/ (natpow 10 (length frac))) <$>\n (cast <$> parseNumWithoutSign (unpack frac) 0)\n e <- parseInteger exp\n pure (w, if w < 0 then (-f) else f, e)\n (frac::[]) =>\n do\n w <- cast {from=Integer} <$> parseInteger whole\n f <- (\/ (natpow 10 (length frac))) <$>\n (cast <$> parseNumWithoutSign (unpack frac) 0)\n pure (w, if w < 0 then (-f) else f, 0)\n _ => Nothing\n _ => Nothing\n","avg_line_length":29.2215568862,"max_line_length":91,"alphanum_fraction":0.5585040984} +{"size":3730,"ext":"idr","lang":"Idris","max_stars_count":128.0,"content":"||| Note: The difference to a 'strict' Writer implementation is\n||| that accumulation of values does not happen in the\n||| Applicative and Monad instances but when invoking `Writer`-specific\n||| functions like `writer` or `listen`.\nmodule Control.Monad.Writer.CPS\n\nimport Control.Monad.Identity\nimport Control.Monad.Trans\n\n%default total\n\n||| A writer monad parameterized by:\n|||\n||| @w the output to accumulate.\n|||\n||| @m The inner monad.\n|||\n||| The `pure` function produces the output `neutral`, while `>>=`\n||| combines the outputs of the subcomputations using `<+>`.\npublic export\nrecord WriterT (w : Type) (m : Type -> Type) (a : Type) where\n constructor MkWriterT\n unWriterT : w -> m (a, w)\n\n||| Construct an writer computation from a (result,output) computation.\n||| (The inverse of `runWriterT`.)\npublic export %inline\nwriterT : Semigroup w => Functor m => m (a, w) -> WriterT w m a\nwriterT f = MkWriterT $ \\w => (\\(a,w') => (a,w <+> w')) <$> f\n\n||| Unwrap a writer computation.\n||| (The inverse of 'writerT'.)\npublic export %inline\nrunWriterT : Monoid w => WriterT w m a -> m (a,w)\nrunWriterT m = unWriterT m neutral\n\n||| Extract the output from a writer computation.\npublic export %inline\nexecWriterT : Monoid w => Functor m => WriterT w m a -> m w\nexecWriterT = map snd . runWriterT\n\n||| Map both the return value and output of a computation using\n||| the given function.\npublic export %inline\nmapWriterT : (Functor n, Monoid w, Semigroup w')\n => (m (a, w) -> n (b, w')) -> WriterT w m a -> WriterT w' n b\nmapWriterT f m = MkWriterT $ \\w =>\n (\\(a,w') => (a,w <+> w')) <$> f (runWriterT m)\n\n--------------------------------------------------------------------------------\n-- Writer Functions\n--------------------------------------------------------------------------------\n\n||| The `return` function produces the output `neutral`, while `>>=`\n||| combines the outputs of the subcomputations using `<+>`.\npublic export\nWriter : Type -> Type -> Type\nWriter w = WriterT w Identity\n\n||| Unwrap a writer computation as a (result, output) pair.\npublic export %inline\nrunWriter : Monoid w => Writer w a -> (a, w)\nrunWriter = runIdentity . runWriterT\n\n||| Extract the output from a writer computation.\npublic export %inline\nexecWriter : Monoid w => Writer w a -> w\nexecWriter = runIdentity . execWriterT\n\n||| Map both the return value and output of a computation using\n||| the given function.\npublic export %inline\nmapWriter : (Monoid w, Semigroup w')\n => ((a, w) -> (b, w')) -> Writer w a -> Writer w' b\nmapWriter f = mapWriterT $ \\(Id p) => Id (f p)\n\n--------------------------------------------------------------------------------\n-- Implementations\n--------------------------------------------------------------------------------\n\npublic export %inline\nFunctor m => Functor (WriterT w m) where\n map f m = MkWriterT $ \\w => (\\(a,w') => (f a,w')) <$> unWriterT m w\n\npublic export %inline\nMonad m => Applicative (WriterT w m) where\n pure a = MkWriterT $ \\w => pure (a,w)\n MkWriterT mf <*> MkWriterT mx =\n MkWriterT $ \\w => do (f,w1) <- mf w\n (a,w2) <- mx w1\n pure (f a,w2)\n\npublic export %inline\n(Monad m, Alternative m) => Alternative (WriterT w m) where\n empty = MkWriterT $ \\_ => empty\n MkWriterT m <|> mn = MkWriterT $ \\w => m w <|> unWriterT mn w\n\npublic export %inline\nMonad m => Monad (WriterT w m) where\n m >>= k = MkWriterT $ \\w => do (a,w1) <- unWriterT m w\n unWriterT (k a) w1\n\npublic export %inline\nMonadTrans (WriterT w) where\n lift m = MkWriterT $ \\w => map (\\a => (a,w)) m\n\npublic export %inline\nHasIO m => HasIO (WriterT w m) where\n liftIO = lift . liftIO\n","avg_line_length":33.9090909091,"max_line_length":80,"alphanum_fraction":0.5790884718} +{"size":2606,"ext":"idr","lang":"Idris","max_stars_count":11.0,"content":"module Rhone.Canvas.Shape\n\nimport Control.MonadRec\nimport Data.Iterable\nimport JS\nimport Rhone.Canvas.Angle\nimport Web.Html\n\n%default total\n\n--------------------------------------------------------------------------------\n-- Types\n--------------------------------------------------------------------------------\n\nnamespace PathType\n public export\n data PathType = Fill | Stroke\n\npublic export\ndata Segment : Type where\n Move : (x,y : Double) -> Segment\n Line : (x,y : Double) -> Segment\n Arc : (x,y,radius : Double)\n -> (start,stop : Angle)\n -> (counterclockwise : Bool)\n -> Segment\n ArcTo : (x1,y1,x2,y2,radius : Double) -> Segment\n\nnamespace RectType\n public export\n data RectType = Fill | Stroke | Clear\n\npublic export\ndata Shape : Type where\n Rect : (x,y,w,h : Double) -> RectType -> Shape\n Path : List Segment -> PathType -> Shape\n Shapes : List Shape -> Shape\n\nexport\ncircle : (x,y,radius : Double) -> PathType -> Shape\ncircle x y r = Path [Arc x y r (rad 0) (rad $ 2 * pi) False]\n\nexport\npolyLine : List (Double,Double) -> Shape\npolyLine [] = Path [] Stroke\npolyLine ((x,y) :: t) = Path (Move x y :: map (uncurry Line) t) Stroke\n\nexport\nSemigroup Shape where\n x <+> Shapes [] = x\n Shapes [] <+> y = y\n Shapes xs <+> Shapes ys = Shapes $ xs ++ ys\n x <+> Shapes ys = Shapes $ x :: ys\n x <+> y = Shapes [x,y]\n\nexport\nMonoid Shape where\n neutral = Shapes []\n\n--------------------------------------------------------------------------------\n-- IO\n--------------------------------------------------------------------------------\n\napplySegment : CanvasRenderingContext2D -> Segment -> JSIO ()\napplySegment ctxt (Move x y) = moveTo ctxt x y\napplySegment ctxt (Line x y) = lineTo ctxt x y\napplySegment ctxt (Arc x y r start stop ccw) = do\n arc ctxt x y r (toRadians start) (toRadians stop) (Def ccw)\napplySegment ctxt (ArcTo x1 y1 x2 y2 radius) =\n arcTo ctxt x1 y1 x2 y2 radius\n\nmutual\n export\n applyAll : CanvasRenderingContext2D -> List Shape -> JSIO ()\n applyAll ctxt = assert_total $ forM_ (apply ctxt)\n\n export\n apply : CanvasRenderingContext2D -> Shape -> JSIO ()\n apply ctxt (Rect x y w h Fill) = fillRect ctxt x y w h\n apply ctxt (Rect x y w h Stroke) = strokeRect ctxt x y w h\n apply ctxt (Rect x y w h Clear) = clearRect ctxt x y w h\n apply ctxt (Path ss st) = do\n beginPath ctxt\n forM_ (applySegment ctxt) ss\n case st of\n Fill => fill ctxt Undef\n Stroke => stroke ctxt\n apply ctxt (Shapes xs) = applyAll ctxt xs\n","avg_line_length":29.2808988764,"max_line_length":80,"alphanum_fraction":0.5479662318} +{"size":1224,"ext":"idr","lang":"Idris","max_stars_count":4.0,"content":"module Test.Bits8\n\nimport Data.Prim.Bits8\nimport Data.SOP\nimport Hedgehog\nimport Test.RingLaws\n\nallBits8 : Gen Bits8\nallBits8 = bits8 (linear 0 0xffff)\n\ngt0 : Gen Bits8\ngt0 = bits8 (linear 1 MaxBits8)\n\ngt1 : Gen Bits8\ngt1 = bits8 (linear 2 MaxBits8)\n\nprop_ltMax : Property\nprop_ltMax = property $ do\n b8 <- forAll allBits8\n (b8 <= MaxBits8) === True\n\nprop_ltMin : Property\nprop_ltMin = property $ do\n b8 <- forAll allBits8\n (b8 >= MinBits8) === True\n\nprop_comp : Property\nprop_comp = property $ do\n [m,n] <- forAll $ np [allBits8, allBits8]\n toOrdering (comp m n) === compare m n\n\nprop_mod : Property\nprop_mod = property $ do\n [n,d] <- forAll $ np [allBits8, gt0]\n compare (n `mod` d) d === LT\n\nprop_div : Property\nprop_div = property $ do\n [n,d] <- forAll $ np [gt0, gt1]\n compare (n `div` d) n === LT\n\nprop_divMod : Property\nprop_divMod = property $ do\n [n,d] <- forAll $ np [allBits8, gt0]\n let x = n `div` d\n r = n `mod` d\n n === x * d + r\n\nexport\nprops : Group\nprops = MkGroup \"Bits8\" $\n [ (\"prop_ltMax\", prop_ltMax)\n , (\"prop_ltMin\", prop_ltMin)\n , (\"prop_comp\", prop_comp)\n , (\"prop_mod\", prop_mod)\n , (\"prop_div\", prop_div)\n , (\"prop_divMod\", prop_divMod)\n ] ++ ringProps allBits8\n","avg_line_length":20.7457627119,"max_line_length":43,"alphanum_fraction":0.6446078431} +{"size":147,"ext":"idr","lang":"Idris","max_stars_count":3.0,"content":"import public Invincy.Core\nimport public Invincy.Parsing\nimport public Invincy.Printing\nimport public Invincy.Invertible\nimport public Invincy.Gen\n","avg_line_length":24.5,"max_line_length":32,"alphanum_fraction":0.8639455782} +{"size":7741,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"-- --------------------------------------------------------- [ Combinators.idr ]\n-- Module : Lightyear.Combinators\n-- Description : Generic Combinators\n--\n-- This code is distributed under the BSD 2-clause license.\n-- See the file LICENSE in the root directory for its full text.\n-- --------------------------------------------------------------------- [ EOH ]\nmodule Lightyear.Combinators\n\nimport Data.Vect\n\nimport Lightyear.Core\n\n-- %access export\n\n-- --------------------------------------------------------------- [ Operators ]\ninfixr 3 :::\nprivate\n(:::) : a -> List a -> List a\n(:::) x xs = x :: xs\n\ninfixr 3 ::.\nprivate\n(::.) : a -> Vect n a -> Vect (S n) a\n(::.) x xs = x :: xs\n\n-- -------------------------------------------------- [ Any Token and No Token ]\n\n||| Parse a single arbitrary token. Returns the parsed token.\n|||\n||| This parser will fail if and only if the input stream is empty.\nexport\nanyToken : (Monad m, Stream tok str) => ParserT str m tok\nanyToken = satisfy (const True) \"any token\"\n\n||| Parse the end of input.\n|||\n||| This parser will succeed if and only if the input stream is empty.\nexport\neof : (Monad m, Stream tok str) => ParserT str m ()\neof = requireFailure anyToken \"end of input\"\n\n-- ---------------------------------------------------- [ Multiple Expressions ]\n\n||| Run some parser as many times as possible, collecting a list of\n||| successes.\nexport\nmany : Monad m => ParserT str m a -> ParserT str m (List a)\nmany p = (pure (:::) <*> p <*>| many p) <|> pure []\n\n||| Run the specified parser precisely `n` times, returning a vector\n||| of successes.\nexport\nntimes : Monad m => (n : Nat)\n -> ParserT str m a\n -> ParserT str m (Vect n a)\nntimes Z p = pure Vect.Nil\nntimes (S n) p = [| p ::. ntimes n p |]\n\n||| Like `many`, but the parser must succeed at least once\nexport\nsome : Monad m => ParserT str m a -> ParserT str m (List a)\nsome p = [| p ::: many p |]\n\n-- --------------------------------------------------- [ Separated Expressions ]\n\n||| Parse repeated instances of at least one `p`, separated by `s`,\n||| returning a list of successes.\n|||\n||| @ p the parser for items\n||| @ s the parser for separators\nexport\nsepBy1 : Monad m => (p : ParserT str m a)\n -> (s : ParserT str m b)\n -> ParserT str m (List a)\nsepBy1 p s = [| p ::: many (s *> p) |]\n\n||| Parse zero or more `p`s, separated by `s`s, returning a list of\n||| successes.\n|||\n||| @ p the parser for items\n||| @ s the parser for separators\nexport\nsepBy : Monad m => (p : ParserT str m a)\n -> (s : ParserT str m b)\n -> ParserT str m (List a)\nsepBy p s = (p `sepBy1` s) <|> pure []\n\n||| Parse precisely `n` `p`s, separated by `s`s, returning a vect of\n||| successes.\n|||\n||| @ n how many to parse\n||| @ p the parser for items\n||| @ s the parser for separators\nexport\nsepByN : Monad m => (n : Nat)\n -> (p : ParserT str m a)\n -> (s : ParserT str m b)\n -> ParserT str m (Vect n a)\nsepByN Z p s = pure Vect.Nil\nsepByN (S n) p s = [| p ::. ntimes n (s *> p) |]\n\n||| Parse one or more `p`s, separated by `op`s. Return a value that is\n||| the left associative application of the functions returned by `op`.\n|||\n||| @ p the parser\n||| @ op the parser for operators\nexport\nchainl1 : Monad m => (p : ParserT str m a)\n -> (op: ParserT str m (a -> a -> a))\n -> ParserT str m a\nchainl1 p op = p >>= rest\n where rest : a -> ParserT str m a\n rest a1 = (do f <- op\n a2 <- p\n rest (f a1 a2)) <|> pure a1\n\n||| Parse zero or more `p`s, separated by `op`s. Return a value that is\n||| the left associative application of the functions returned by `op`.\n||| Return `a` when there are zero occurences of `p`.\n|||\n||| @ p the parser\n||| @ op the parser for operators\nexport\nchainl : Monad m => (p : ParserT str m a)\n -> (op : ParserT str m (a -> a -> a))\n -> a\n -> ParserT str m a\nchainl p op a = (p `chainl1` op) <|> pure a\n\n||| Parse one or more `p`s, separated by `op`s. Return a value that is\n||| the right associative application of the functions returned by `op`.\n|||\n||| @ p the parser\n||| @ op the parser for operators\nexport\nchainr1 : Monad m => (p : ParserT str m a)\n -> (op: ParserT str m (a -> a -> a))\n -> ParserT str m a\nchainr1 p op = p >>= rest\n where rest : a -> ParserT str m a\n rest a1 = (do f <- op\n a2 <- p >>= rest\n rest (f a1 a2)) <|> pure a1\n\n||| Parse zero or more `p`s, separated by `op`s. Return a value that is\n||| the right associative application of the functions returned by `op`.\n||| Return `a` when there are zero occurences of `p`.\n|||\n||| @ p the parser\n||| @ op the parser for operators\nexport\nchainr : Monad m => (p : ParserT str m a)\n -> (op : ParserT str m (a -> a -> a))\n -> a\n -> ParserT str m a\nchainr p op a = (p `chainr1` op) <|> pure a\n\n||| Alternate between matches of `p` and `s`, starting with `p`,\n||| returning a list of successes from both.\nexport\nalternating : Monad m => (p : ParserT str m a)\n -> (s : ParserT str m a)\n -> ParserT str m (List a)\nalternating p s = (pure (:::) <*> p <*>| alternating s p) <|> pure []\n\n||| Throw away the result from a parser\nexport\nskip : Monad m => ParserT str m a -> ParserT str m ()\nskip = map (const ())\n\n||| Attempt to parse `p`. If it succeeds, then return the value. If it\n||| fails, continue parsing.\nexport\nopt : Monad m => (p : ParserT str m a) -> ParserT str m (Maybe a)\nopt p = map Just p <|> pure Nothing\n\n||| Parse open, then p, then close. Returns the result of `p`.\n|||\n||| @open The opening parser.\n||| @close The closing parser.\n||| @p The parser for the middle part.\nexport\nbetween : Monad m => (open' : ParserT str m a)\n -> (close : ParserT str m c)\n -> (p : ParserT str m b)\n -> ParserT str m b\nbetween open' close p = open' *> p <* close\n\n-- The following names are inspired by the cut operator from Prolog\n\n-- ---------------------------------------------------- [ Monad-like Operators ]\n\ninfixr 5 >!=\n||| Committing bind\nexport\n(>!=) : Monad m => ParserT str m a\n -> (a -> ParserT str m b)\n -> ParserT str m b\nx >!= f = x >>= commitTo . f\n\ninfixr 5 >!\n||| Committing sequencing\nexport\n(>!) : Monad m => ParserT str m a\n -> ParserT str m b\n -> ParserT str m b\nx >! y = x >>= \\_ => commitTo y\n\n-- ---------------------------------------------- [ Applicative-like Operators ]\n\ninfixl 2 <*!>\n||| Committing application\nexport\n(<*!>) : Monad m => ParserT str m (a -> b)\n -> ParserT str m a\n -> ParserT str m b\nf <*!> x = f <*> commitTo x\n\ninfixl 2 <*!\nexport\n(<*!) : Monad m => ParserT str m a\n -> ParserT str m b\n -> ParserT str m a\nx <*! y = x <* commitTo y\n\ninfixl 2 *!>\nexport\n(*!>) : Monad m => ParserT str m a\n -> ParserT str m b\n -> ParserT str m b\nx *!> y = x *> commitTo y\n\n-- ---------------------------------------------------------- [ Lazy Operators ]\n\ninfixl 2 <*|\nexport\n(<*|) : Monad m => ParserT str m a\n -> Lazy (ParserT str m b)\n -> ParserT str m a\nx <*| y = pure const <*> x <*>| y\n\ninfixl 2 *>|\nexport\n(*>|) : Monad m => ParserT str m a\n -> Lazy (ParserT str m b)\n -> ParserT str m b\nx *>| y = pure (const id) <*> x <*>| y\n-- ---------------------------------------------------------------------- [ EF ]\n","avg_line_length":30.964,"max_line_length":80,"alphanum_fraction":0.5088489859} +{"size":19139,"ext":"lidr","lang":"Idris","max_stars_count":null,"content":"> module Sigma.Properties\n\n> import Data.Fin\n> import Data.Vect\n> import Control.Isomorphism\n\n> import Decidable.Predicates\n> import Finite.Predicates\n> import Finite.Operations\n> import Finite.Properties\n> import Unique.Predicates\n> import Sigma.Sigma\n> import Sigma.Operations\n> import Pairs.Operations\n> import Vect.Operations\n> import Vect.Properties\n> import Fin.Operations\n> -- import Isomorphism.Operations\n> import Isomorphism.Properties\n> import Basic.Operations\n> import Basic.Properties\n\n> %default total\n> %access public export\n> %auto_implicits on\n\n\nEquality of projections:\n\n> ||| Equality of first projections\n> getWitnessPreservesEq : {A : Type} ->\n> {P : A -> Type} ->\n> {s1 : Sigma A P} ->\n> {s2 : Sigma A P} ->\n> (s1 = s2) -> (getWitness s1 = getWitness s2)\n> getWitnessPreservesEq {s1 = MkSigma a p} {s2 = MkSigma a p} Refl = Refl\n> %freeze getWitnessPreservesEq\n\n\n> ||| Equality of second projections\n> getProofPreservesEq : {A : Type} ->\n> {P : A -> Type} ->\n> {s1 : Sigma A P} ->\n> {s2 : Sigma A P} ->\n> (s1 = s2) -> (getProof s1 = getProof s2)\n> getProofPreservesEq {s1 = MkSigma a p} {s2 = MkSigma a p} Refl = Refl\n> %freeze getProofPreservesEq\n\n\nEquality of Sigma types:\n\n> ||| Introduction\n> sigmaEqLemma2 : {A : Type} ->\n> {P : A -> Type} ->\n> {s1: Sigma A P} ->\n> {s2: Sigma A P} ->\n> (getWitness s1 = getWitness s2) ->\n> (getProof s1 = getProof s2) ->\n> s1 = s2\n> sigmaEqLemma2 {A} {P} {s1 = MkSigma a p} {s2 = MkSigma a p} Refl Refl = Refl\n> %freeze sigmaEqLemma2\n\n\n> ||| Elimination and formation\n> sigmaEqLemma0 : {A : Type} ->\n> {P : A -> Type} ->\n> (s: Sigma A P) ->\n> s = MkSigma (getWitness s) (getProof s)\n> sigmaEqLemma0 (MkSigma a p) = Refl\n> %freeze sigmaEqLemma0\n\n\n> ||| Equality for singleton predicates\n> sigmaEqLemma1 : {A : Type} ->\n> {P : A -> Type} ->\n> (s1 : Sigma A P) ->\n> (s2 : Sigma A P) ->\n> getWitness s1 = getWitness s2 ->\n> Unique0 (P (getWitness s1)) ->\n> s1 = s2\n> -- sigmaEqLemma1 (a ** p) (a ** q) Refl uP = cong (uP p q)\n> sigmaEqLemma1 (MkSigma a p) (MkSigma a' q) prf uP with (prf)\n> sigmaEqLemma1 (MkSigma a p) (MkSigma a q) prf uP | (Refl) = cong (uP p q)\n> %freeze sigmaEqLemma1\n\n\nDecidability of Sigma equality:\n\n> ||| Decidability of equality 1\n> sigmaDecEqLemma1 : {A : Type} ->\n> {P : A -> Type} ->\n> (DecEq0 A) ->\n> (DecEq1 P) ->\n> (s1 : Sigma A P) ->\n> (s2 : Sigma A P) ->\n> Dec (s1 = s2)\n> sigmaDecEqLemma1 da d1p (MkSigma a1 pa1) (MkSigma a2 pa2) with (da a1 a2)\n> sigmaDecEqLemma1 da d1p (MkSigma a1 pa1) (MkSigma a1 pa2) | (Yes Refl) with ((d1p a1) pa1 pa2)\n> sigmaDecEqLemma1 da d1p (MkSigma a1 pa1) (MkSigma a1 pa1) | (Yes Refl) | (Yes Refl) = Yes Refl\n> sigmaDecEqLemma1 da d1p (MkSigma a1 pa1) (MkSigma a1 pa2) | (Yes Refl) | (No contra) = No (\\ eq => contra (getProofPreservesEq eq))\n> sigmaDecEqLemma1 da d1p (MkSigma a1 pa1) (MkSigma a2 pa2) | (No contra) = No (\\ eq => contra (getWitnessPreservesEq eq))\n> %freeze sigmaDecEqLemma1\n\n\n> ||| Decidability of equality 2\n> sigmaDecEqLemma2 : {A : Type} ->\n> {P : A -> Type} ->\n> (DecEq A) ->\n> (Unique1 P) ->\n> (s1 : Sigma A P) ->\n> (s2 : Sigma A P) ->\n> Dec (s1 = s2)\n> sigmaDecEqLemma2 da p1P s1 s2 with (decEq (getWitness s1) (getWitness s2))\n> | (Yes prf) = Yes (sigmaEqLemma1 s1 s2 prf (p1P (getWitness s1)))\n> | (No contra) = No (\\ eq => contra (getWitnessPreservesEq eq))\n> %freeze sigmaDecEqLemma2\n\nWe want to show that |toVect| is complete\n\n< toVectSigmaComplete : {A : Type} ->\n< {P : A -> Type} ->\n< (fA : Finite A) ->\n< (d1P : Dec1 P) ->\n< (Unique1 {t0 = A} P) ->\n< (s : Sigma A P) ->\n< Elem s (getProof (toVectSigma fA d1P))\n\nWe start by deriving two auxiliary results. The first one is\n\n> |||\n> toVectSigmaLemma : {A : Type} ->\n> {P : A -> Type} ->\n> (fA : Finite A) ->\n> (d1P : Dec1 P) ->\n> (a : A) ->\n> (p : P a) ->\n> Elem a (map Pairs.Operations.Sigma.getWitness (getProof (toVectSigma fA d1P)))\n> toVectSigmaLemma {A} {P} fA d1P a p =\n> filterTagSigmaLemma d1P a (toVect fA) (toVectComplete fA a) p\n> %freeze toVectSigmaLemma\n\nThe proof is computed by applying |VectProperties.filterTagSigmaLemma|:\n\n< filterTagSigmaLemma : {A : Type} -> {P : A -> Type} ->\n< (d1P : Dec1 P) ->\n< (a : A) ->\n< (as : Vect n A) ->\n< (Elem a as) ->\n< (p : P a) ->\n< Elem a (map getWitness (getProof (filterTagSigma d1P as)))\n\nto |d1P|, |a|, to the vector-based representation of |A| associated to\n|fA| provided by |FiniteOperations.toVect fA| and to a proof that |a| is\nan element of |FiniteOperations.toVect fA|. The latter follows from\ncompleteness of |toVect|, see |FiniteProperties.toVectComplete|. In this\nform, |toVectLemma| does not type check.\n\nThe second result is\n\n> |||\n> sigmaUniqueLemma1 : {A : Type} ->\n> {P : A -> Type} ->\n> (Unique1 P) ->\n> (a : A) ->\n> (p : P a) ->\n> (ss : Vect n (Sigma A P)) ->\n> (Elem a (map Sigma.getWitness ss)) ->\n> Elem (MkSigma a p) ss\n> sigmaUniqueLemma1 u1P a p Nil prf = absurd prf\n> sigmaUniqueLemma1 u1P a p ((MkSigma a q) :: ss) (Here {x = a}) with (u1P a p q)\n> sigmaUniqueLemma1 u1P a p ((MkSigma a p) :: ss) (Here {x = a}) | Refl =\n> Here {x = (MkSigma a p)} {xs = ss}\n> sigmaUniqueLemma1 u1P a1 p1 ((MkSigma a2 p2) :: ss) (There prf) =\n> There (sigmaUniqueLemma1 u1P a1 p1 ss prf)\n> %freeze sigmaUniqueLemma1\n\nWith |toVectLemma| and |sigmaUniqueLemma1|, it is easy to show that\n|toVect| is complete:\n\n> |||\n> toVectSigmaComplete : {A : Type} ->\n> {P : A -> Type} ->\n> (fA : Finite A) ->\n> (d1P : Dec1 P) ->\n> (u1P : Unique1 P) ->\n> (s : Sigma A P) ->\n> Elem s (getProof (toVectSigma fA d1P))\n> toVectSigmaComplete fA d1P u1P (MkSigma a p) = s1 where\n> s0 : Elem a (map Sigma.getWitness (getProof (toVectSigma fA d1P)))\n> s0 = toVectSigmaLemma fA d1P a p\n> s1 : Elem (MkSigma a p) (getProof (toVectSigma fA d1P))\n> s1 = sigmaUniqueLemma1 u1P a p (getProof (toVectSigma fA d1P)) s0\n> %freeze toVectSigmaComplete\n\n> {-\n> toVectSigmaInjective1 : {A : Type} ->\n> {P : A -> Type} ->\n> .(fA : Finite A) ->\n> .(d1P : Dec1 P) ->\n> .(Unique1 {t0 = A} P) ->\n> Injective1 (getProof (toVectSigma fA d1P))\n> toVectSigmaInjective1 fA dP uP =\n> injectiveFilterTagSigmaLemma dP (toVect fA) (toVectInjective1 fA)\n> -}\n\n\nSigma Fin properties:\n\n> using (P : Fin Z -> Type)\n> implementation Uninhabited (Sigma (Fin Z) P) where\n> uninhabited (MkSigma k _) = absurd k\n\n\n> |||\n> isoReplaceLemma1 : {A, A' : Type} -> {B : A -> Type} -> {B' : A' -> Type} ->\n> (isoA : Iso A A') ->\n> (isoBa : (a : A) -> Iso (B a) (B' (to isoA a)) ) ->\n> (a' : A') -> (b' : B' a') ->\n> to (isoBa (from isoA a')) (from (isoBa (from isoA a')) (replace (sym (toFrom isoA a')) b'))\n> =\n> b'\n> isoReplaceLemma1 isoA isoBa a' b' = trans s1 s2 where\n> s1 : to (isoBa (from isoA a')) (from (isoBa (from isoA a')) (replace (sym (toFrom isoA a')) b'))\n> =\n> (replace (sym (toFrom isoA a')) b')\n> s1 = toFrom (isoBa (from isoA a')) (replace (sym (toFrom isoA a')) b')\n> s2 : replace (sym (toFrom isoA a')) b' = b'\n> s2 = replaceLemma (sym (toFrom isoA a')) b'\n> %freeze isoReplaceLemma1\n\n\n> |||\n> isoReplaceLemma2 : {A, A' : Type} -> {B : A -> Type} -> {B' : A' -> Type} ->\n> (isoA : Iso A A') ->\n> (isoBa : (a : A) -> Iso (B a) (B' (to isoA a)) ) ->\n> (a : A) -> (b : B a) ->\n> from (isoBa (from isoA (to isoA a))) (replace (sym (toFrom isoA (to isoA a))) (to (isoBa a) b))\n> =\n> b\n> isoReplaceLemma2 {A} {A'} {B} {B'} isoA isoBa a b = trans s2 s3 where\n> s1 : replace (sym (toFrom isoA (to isoA a))) (to (isoBa a) b)\n> =\n> to (isoBa a) b\n> s1 = replaceLemma (sym (toFrom isoA (to isoA a))) (to (isoBa a) b)\n> s2 : from (isoBa (from isoA (to isoA a))) (replace (sym (toFrom isoA (to isoA a))) (to (isoBa a) b))\n> =\n> from (isoBa a) (to (isoBa a) b)\n> s2 = depCong2' {alpha = A}\n> {P = \\ a => B' (to isoA a)}\n> {Q = \\ a => \\ pa => B a}\n> {a1 = from isoA (to isoA a)}\n> {a2 = a}\n> {Pa1 = replace (sym (toFrom isoA (to isoA a))) (to (isoBa a) b)}\n> {Pa2 = to (isoBa a) b}\n> {f = \\ x => \\ y => from (isoBa x) y}\n> (fromTo isoA a)\n> s1\n> s3 : from (isoBa a) (to (isoBa a) b) = b\n> s3 = fromTo (isoBa a) b\n> %freeze isoReplaceLemma2\n\n\n> |||\n> sigmaIsoLemma : (A : Type) -> (A' : Type) -> (B : A -> Type) -> (B' : A' -> Type) ->\n> (isoA : Iso A A') ->\n> (isoBa : (a : A) -> Iso (B a) (B' (to isoA a)) ) ->\n> Iso (Sigma A B) (Sigma A' B')\n> sigmaIsoLemma A A' B B' isoA isoBa = MkIso toQ fromQ toFromQ fromToQ\n> where toQ : Sigma A B -> Sigma A' B'\n> toQ (MkSigma a b) = MkSigma (to isoA a) (to (isoBa a) b)\n>\n> fromQ : Sigma A' B' -> Sigma A B\n> fromQ (MkSigma a' b') = (MkSigma a b) where\n> a : A\n> a = from isoA a'\n> b : B a\n> b = from (isoBa (from isoA a')) (replace (sym (toFrom isoA a')) b')\n>\n> toFromQ : (ab' : Sigma A' B') -> toQ (fromQ ab') = ab'\n> toFromQ (MkSigma a' b') = trans s1 (trans s2 s3) where\n> s1 : toQ (fromQ (MkSigma a' b'))\n> =\n> toQ (MkSigma (from isoA a') (from (isoBa (from isoA a')) (replace (sym (toFrom isoA a')) b')))\n> s1 = Refl\n> s2 : toQ (MkSigma (from isoA a') (from (isoBa (from isoA a')) (replace (sym (toFrom isoA a')) b')))\n> =\n> MkSigma (to isoA (from isoA a'))\n> (to (isoBa (from isoA a')) (from (isoBa (from isoA a')) (replace (sym (toFrom isoA a')) b')))\n> s2 = Refl\n> s3 : MkSigma (to isoA (from isoA a'))\n> (to (isoBa (from isoA a')) (from (isoBa (from isoA a')) (replace (sym (toFrom isoA a')) b')))\n> =\n> MkSigma a' b'\n> s3 = sigmaEqLemma2 {s1 = MkSigma (to isoA (from isoA a'))\n> (to (isoBa (from isoA a')) (from (isoBa (from isoA a')) (replace (sym (toFrom isoA a')) b')))}\n> {s2 = MkSigma a' b'}\n> (toFrom isoA a')\n> (isoReplaceLemma1 isoA isoBa a' b')\n>\n> fromToQ : (ab : Sigma A B) -> fromQ (toQ ab) = ab\n> fromToQ (MkSigma a b) = trans s1 (trans s2 s3) where\n> s1 : fromQ (toQ (MkSigma a b))\n> =\n> fromQ (MkSigma (to isoA a) (to (isoBa a) b))\n> s1 = Refl\n> s2 : fromQ (MkSigma (to isoA a) (to (isoBa a) b))\n> =\n> MkSigma (from isoA (to isoA a))\n> (from (isoBa (from isoA (to isoA a))) (replace (sym (toFrom isoA (to isoA a))) (to (isoBa a) b)))\n> s2 = Refl\n> s3 : MkSigma (from isoA (to isoA a))\n> (from (isoBa (from isoA (to isoA a))) (replace (sym (toFrom isoA (to isoA a))) (to (isoBa a) b)))\n> =\n> MkSigma a b\n> s3 = sigmaEqLemma2 {s1 = MkSigma (from isoA (to isoA a))\n> (from (isoBa (from isoA (to isoA a))) (replace (sym (toFrom isoA (to isoA a))) (to (isoBa a) b)))}\n> {s2 = MkSigma a b}\n> (fromTo isoA a)\n> (isoReplaceLemma2 isoA isoBa a b)\n> %freeze sigmaIsoLemma\n\n\n> ||| |Sigma (Fin Z) P| are void\n> voidSigmaFinZ : {P : Fin Z -> Type} -> Iso (Sigma (Fin Z) P) Void\n> voidSigmaFinZ = MkIso (\\x => void (uninhabited x))\n> (\\x => void x)\n> (\\x => void x)\n> (\\x => void (uninhabited x))\n> %freeze voidSigmaFinZ\n\n\n> ||| Decomposition lemma\n> sigmaEitherLemma : {n : Nat} ->\n> {P : Fin (S n) -> Type} ->\n> Iso (Sigma (Fin (S n)) P) (Either (P FZ) (Sigma (Fin n) (tail P)))\n> sigmaEitherLemma {n} {P} = MkIso to from toFrom fromTo where\n> to : Sigma (Fin (S n)) P -> Either (P FZ) (Sigma (Fin n) (tail P))\n> to (MkSigma FZ j) = Left j\n> to (MkSigma (FS k) j) = Right (MkSigma k j)\n> from : Either (P FZ) (Sigma (Fin n) (tail P)) -> Sigma (Fin (S n)) P\n> from (Left j) = MkSigma FZ j\n> from (Right (MkSigma k j)) = MkSigma (FS k) j\n> toFrom : (e : Either (P FZ) (Sigma (Fin n) (tail P))) -> to (from e) = e\n> toFrom (Left j) = Refl\n> toFrom (Right (MkSigma k j)) = Refl\n> fromTo : (s : Sigma (Fin (S n)) P) -> from (to s) = s\n> fromTo (MkSigma FZ j) = Refl\n> fromTo (MkSigma (FS k) j) = Refl\n> %freeze sigmaEitherLemma\n\n\n> |||\n> sigmaFinEitherLemma : {n : Nat} -> {f : Fin (S n) -> Nat} ->\n> Iso\n> (Sigma (Fin (S n)) (Fin . f))\n> (Either (Fin (f FZ)) (Sigma (Fin n) (Fin . (tail f))))\n> sigmaFinEitherLemma {n} {f} =\n> ( Sigma (Fin (S n)) (Fin . f) )\n> ={ sigmaEitherLemma {n = n} {P = Fin . f} }=\n> ( Either (Fin (f FZ)) (Sigma (Fin n) (tail (Fin . f))) )\n> -- ={ isoCong {P = \\ X => Either (Fin (f FZ)) (Sigma (Fin n) X)} (sym (lambdaLemma1 (tail (Fin . f)))) }=\n> -- ={ isoCong {P = \\ X => Either (Fin (f FZ)) (Sigma (Fin n) X)} Refl }=\n> ={ isoRefl }= \n> ( Either (Fin (f FZ)) (Sigma (Fin n) (\\ k => (tail (Fin . f)) k)) )\n> ={ isoRefl }=\n> ( Either (Fin (f FZ)) (Sigma (Fin n) (\\ k => (Fin . f) (FS k))) )\n> ={ isoRefl }=\n> ( Either (Fin (f FZ)) (Sigma (Fin n) (\\ k => Fin (f (FS k)))) )\n> ={ isoRefl }=\n> ( Either (Fin (f FZ)) (Sigma (Fin n) (\\ k => Fin ((tail f) k))) )\n> ={ isoRefl }=\n> ( Either (Fin (f FZ)) (Sigma (Fin n) (\\ k => (Fin . (tail f)) k)) )\n> -- ={ isoCong {P = \\ X => Either (Fin (f FZ)) (Sigma (Fin n) X)} (lambdaLemma1 (Fin . (tail f))) }=\n> ={ isoRefl }= \n> ( Either (Fin (f FZ)) (Sigma (Fin n) (Fin . (tail f))) )\n> QED\n> %freeze sigmaFinEitherLemma\n\n\n> ||| |finDepPairTimes| for dependent pairs\n> finDepPairTimes : {n : Nat} -> {f : Fin n -> Nat} ->\n> Iso (Sigma (Fin n) (Fin . f))\n> (Fin (sum f))\n> finDepPairTimes {n = Z} {f} =\n> ( Sigma (Fin Z) (Fin . f) )\n> ={ voidSigmaFinZ }=\n> ( Void )\n> ={ isoSym finZeroBot }=\n> ( Fin Z )\n> QED\n> finDepPairTimes {n = S m} {f} =\n> ( Sigma (Fin (S m)) (Fin . f) )\n> ={ sigmaFinEitherLemma }=\n> ( Either (Fin (f FZ)) (Sigma (Fin m) (Fin . (tail f))) )\n> ={ eitherCongRight (finDepPairTimes {n = m} {f = tail f}) }=\n> ( Either (Fin (f FZ)) (Fin (sum (tail f))) )\n> ={ eitherFinPlus }=\n> ( Fin (f FZ + sum (tail f)) )\n> ={ isoRefl }=\n> ( Fin (sum f) )\n> QED\n> %freeze finDepPairTimes\n\nSigma Exists properties\n\n> |||\n> sigmaExistsLemma : {A : Type} -> {P : A -> Type} ->\n> Iso (Sigma A P) (Exists P)\n> sigmaExistsLemma {A} {P} = MkIso to from toFrom fromTo where\n> to : Sigma A P -> Exists P\n> to (MkSigma _ p) = Evidence _ p\n> from : Exists P -> Sigma A P\n> from (Evidence _ p) = MkSigma _ p\n> toFrom : (e : Exists P) -> to (from e) = e\n> toFrom (Evidence _ _) = Refl\n> fromTo : (s : Sigma A P) -> from (to s) = s\n> fromTo (MkSigma _ _) = Refl\n> %freeze sigmaExistsLemma\n\n\nFinitess properties\n\n> ||| For finite predicates, Sigma types of finite types are finite\n> finiteSigmaLemma0 : {A : Type} -> {P : A -> Type} ->\n> Finite A -> Finite1 P -> Finite (Sigma A P)\n> finiteSigmaLemma0 {A} {P} (MkSigma n isoA) f1P = MkSigma sumf (isoTrans step1 step2)\n> where f' : A -> Nat\n> f' a = card (f1P a)\n> f : Fin n -> Nat\n> f = f' . from isoA\n> sumf : Nat\n> sumf = sum f\n> step1 : Iso (Sigma A P) (Sigma (Fin n) (Fin . f))\n> step1 = sigmaIsoLemma A (Fin n) P (Fin . f) isoA s5 where -- s6 where\n> s1 : (a : A) -> Iso (P a) (Fin (f' a))\n> s1 a = iso (f1P a)\n> s2 : (a : A) -> Iso (P a) (Fin (f' (from isoA (to isoA a))))\n> s2 a = replace {P = \\ x => Iso (P a) (Fin (f' x))} prf (s1 a) where\n> prf : a = from isoA (to isoA a)\n> prf = sym (fromTo isoA a)\n> s3 : (a : A) -> Iso (P a) (Fin ((f' . (from isoA)) (to isoA a)))\n> s3 = s2\n> s4 : (a : A) -> Iso (P a) (Fin (f (to isoA a)))\n> s4 = s3\n> s5 : (a : A) -> Iso (P a) ((Fin . f) (to isoA a))\n> s5 = s4\n> -- s6 : (k : Fin n) -> Iso (P (from isoA k)) ((Fin . f) k)\n> -- s6 k = iso (f1P (from isoA k))\n> step2 : Iso (Sigma (Fin n) (Fin . f)) (Fin sumf)\n> step2 = finDepPairTimes {n} {f}\n> %freeze finiteSigmaLemma0\n\n\n> |||\n> finiteExistsLemma : {A : Type} -> {P : A -> Type} ->\n> Finite A -> Finite1 P -> Finite (Exists {a = A} P)\n> finiteExistsLemma {A} {P} fA f1P = MkSigma n iE where\n> fS : Finite (Sigma A P)\n> fS = finiteSigmaLemma0 fA f1P\n> n : Nat\n> n = card fS\n> iS : Iso (Sigma A P) (Fin n)\n> iS = iso fS\n> iE : Iso (Exists {a = A} P) (Fin n)\n> iE = isoTrans (isoSym (sigmaExistsLemma {A} {P})) iS\n> %freeze finiteExistsLemma\n\n\nFinite A ~= MkSigma n (Iso A (Fin n))\nFinite1 P ~= (a : A) -> MkSigma na (Iso (P a) (Fin na))\nFinite (Sigma A P) ~= MkSigma (sum na) (Iso (Sigma A P) (Fin (sum na)))\n","avg_line_length":40.5487288136,"max_line_length":143,"alphanum_fraction":0.469564763} +{"size":5776,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"module SQLite3.Constants\n\nimport SQLite3.Bindings\nimport Data.Buffer\n\npublic export\ndata ErrorCode : Type where\n\n||| Result Codes versus Error Codes\n||| \n||| \"Error codes\" are a subset of \"result codes\" that indicate that something has gone wrong.\n||| There are only a few non-error result codes: SQLITE_OK, SQLITE_ROW, and SQLITE_DONE.\n||| The term \"error code\" means any result code other than these three.\n||| -- from: https:\/\/sqlite.org\/rescode.html\npublic export\ndata ResultCode : Type where\n ||| Value: 0 \/* Successful result *\/\n Ok : ResultCode\n ||| Value: 1 \/* Generic error *\/\n Error : ResultCode\n ||| Value: 2 \/* Internal logic error in SQLite *\/\n Internal : ResultCode\n ||| Value: 3 \/* Access permission denied *\/\n Perm : ResultCode\n ||| Value: 4 \/* Callback routine requested an abort *\/\n Abort : ResultCode\n ||| Value: 5 \/* The database file is locked *\/\n Busy : ResultCode\n ||| Value: 6 \/* A table in the database is locked *\/\n Locked : ResultCode\n ||| Value: 7 \/* A malloc() failed *\/\n NoMem : ResultCode\n ||| Value: 8 \/* Attempt to write a readonly database *\/\n ReadOnly : ResultCode\n ||| Value: 9 \/* Operation terminated by sqlite3_interrupt()*\/\n Interrupt : ResultCode\n ||| Value: 10 \/* Some kind of disk I\/O error occurred *\/\n IoErr : ResultCode\n ||| Value: 11 \/* The database disk image is malformed *\/\n Corrupt : ResultCode\n ||| Value: 12 \/* Unknown opcode in sqlite3_file_control() *\/\n NotFound : ResultCode\n ||| Value: 13 \/* Insertion failed because database is full *\/\n Full : ResultCode\n ||| Value: 14 \/* Unable to open the database file *\/\n CantOpen : ResultCode\n ||| Value: 15 \/* Database lock protocol error *\/\n Protocol : ResultCode\n ||| Value: 16 \/* Internal use only *\/\n Empty : ResultCode\n ||| Value: 17 \/* The database schema changed *\/\n Schema : ResultCode\n ||| Value: 18 \/* String or BLOB exceeds size limit *\/\n TooBig : ResultCode\n ||| Value: 19 \/* Abort due to constraint violation *\/\n Constraint : ResultCode\n ||| Value: 20 \/* Data type mismatch *\/\n Mismatch : ResultCode\n ||| Value: 21 \/* Library used incorrectly *\/\n Misuse : ResultCode\n ||| Value: 22 \/* Uses OS features not supported on host *\/\n NoLFS : ResultCode\n ||| Value: 23 \/* Authorization denied *\/\n Auth : ResultCode\n ||| Value: 24 \/* Not used *\/\n Format : ResultCode\n ||| Value: 25 \/* 2nd parameter to sqlite3_bind out of range *\/\n Range : ResultCode\n ||| Value: 26 \/* File opened that is not a database file *\/\n NotADB : ResultCode\n ||| Value: 27 \/* Notifications from sqlite3_log() *\/\n Notice : ResultCode\n ||| Value: 28 \/* Warnings from sqlite3_log() *\/\n Warning : ResultCode\n ||| Value: 100 \/* sqlite3_step() has another row ready *\/\n Row : ResultCode\n ||| Value: 101 \/* sqlite3_step() has finished executing *\/\n Done : ResultCode\n\nexport\nShow ResultCode where\n show Ok = \"Ok\"\n show Error = \"Error\"\n show Internal = \"Internal\"\n show Perm = \"Perm\"\n show Abort = \"Abort\"\n show Busy = \"Busy\"\n show Locked = \"Locked\"\n show NoMem = \"NoMem\"\n show ReadOnly = \"ReadOnly\"\n show Interrupt = \"Interrupt\"\n show IoErr = \"IoErr\"\n show Corrupt = \"Corrupt\"\n show NotFound = \"NotFound\"\n show Full = \"Full\"\n show CantOpen = \"CantOpen\"\n show Protocol = \"Protocol\"\n show Empty = \"Empty\"\n show Schema = \"Schema\"\n show TooBig = \"TooBig\"\n show Constraint = \"Constraint\"\n show Mismatch = \"Mismatch\"\n show Misuse = \"Misuse\"\n show NoLFS = \"NoLFS\"\n show Auth = \"Auth\"\n show Format = \"Format\"\n show Range = \"Range\"\n show NotADB = \"NotADB\"\n show Notice = \"Notice\"\n show Warning = \"Warning\"\n show Row = \"Row\"\n show Done = \"Done\"\n\nnamespace ResultCode\n export\n from_raw : Int -> Maybe ResultCode\n from_raw 0 = Just Ok\n from_raw 1 = Just Error\n from_raw 2 = Just Internal\n from_raw 3 = Just Perm\n from_raw 4 = Just Abort\n from_raw 5 = Just Busy\n from_raw 6 = Just Locked\n from_raw 7 = Just NoMem\n from_raw 8 = Just ReadOnly\n from_raw 9 = Just Interrupt\n from_raw 10 = Just IoErr\n from_raw 11 = Just Corrupt\n from_raw 12 = Just NotFound\n from_raw 13 = Just Full\n from_raw 14 = Just CantOpen\n from_raw 15 = Just Protocol\n from_raw 16 = Just Empty\n from_raw 17 = Just Schema\n from_raw 18 = Just TooBig\n from_raw 19 = Just Constraint\n from_raw 20 = Just Mismatch\n from_raw 21 = Just Misuse\n from_raw 22 = Just NoLFS\n from_raw 23 = Just Auth\n from_raw 24 = Just Format\n from_raw 25 = Just Range\n from_raw 26 = Just NotADB\n from_raw 27 = Just Notice\n from_raw 28 = Just Warning\n from_raw 100 = Just Row\n from_raw 101 = Just Done\n from_raw _ = Nothing\n\npublic export\ndata ConcreteType : Type where\n ||| #define SQLITE_INTEGER 1\n AInteger : ConcreteType\n ||| #define SQLITE_FLOAT 2\n AFloat : ConcreteType\n ||| #define SQLITE_TEXT 3\n AText : ConcreteType\n ||| #define SQLITE_BLOB 4\n ABlob : ConcreteType\n\nexport\nShow ConcreteType where\n show AInteger = \"Integer\"\n show AFloat = \"Float\"\n show AText = \"Text\"\n show ABlob = \"Blob\"\n\nexport\nEq ConcreteType where\n AInteger == AInteger = True\n AFloat == AFloat = True\n AText == AText = True\n ABlob == ABlob = True\n _ == _ = False\n\npublic export\ndata DataType : Type where\n Concrete : ConcreteType -> DataType\n ||| #define SQLITE_NULL 5\n ANull : DataType\n\nexport\nShow DataType where\n show ANull = \"Null\"\n show (Concrete t) = show t\n\nexport\nEq DataType where\n Concrete x == Concrete x' = x == x'\n ANull == ANull = True\n _ == _ = False\n\nnamespace DataType\n export\n from_raw : Int -> Maybe DataType\n from_raw 1 = Just $ Concrete AInteger\n from_raw 2 = Just $ Concrete AFloat\n from_raw 3 = Just $ Concrete AText\n from_raw 4 = Just $ Concrete ABlob\n from_raw 5 = Just ANull\n from_raw _ = Nothing\n","avg_line_length":28.5940594059,"max_line_length":93,"alphanum_fraction":0.6627423823} +{"size":1481,"ext":"idr","lang":"Idris","max_stars_count":30.0,"content":"||| Copyright 2016 Google Inc.\n|||\n||| Licensed under the Apache License, Version 2.0 (the \"License\");\n||| you may not use this file except in compliance with the License.\n||| You may obtain a copy of the License at\n|||\n||| http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n|||\n||| Unless required by applicable law or agreed to in writing, software\n||| distributed under the License is distributed on an \"AS IS\" BASIS,\n||| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n||| See the License for the specific language governing permissions and\n||| limitations under the License.\n\nmodule Test.Parser\n\nimport Test.UnitTest\nimport Test.Utils\nimport Protobuf.Core\nimport Protobuf.Parser\nimport Protobuf.Util\n\n%access export\n\nprotoFileContents : String\nprotoFileContents = unlines [\n \"message Person {\",\n \" required string name = 0;\",\n \" required int32 id = 1;\",\n \" optional string email = 2;\",\n \" message PhoneNumber {\",\n \" required string number = 0;\",\n \" enum PhoneType {MOBILE = 0; HOME = 1; WORK = 2;}\",\n \" optional Person.PhoneNumber.PhoneType type = 1;\",\n \" }\",\n \" repeated Person.PhoneNumber phone = 3;\",\n \"}\",\n \"\"\n]\n\nexpectedFileDescriptor : (List MessageDescriptor, List EnumDescriptor)\nexpectedFileDescriptor = ([PhoneNumber, Person], [PhoneType])\n\nallTests : IO ()\nallTests = runTests (MkTestFixture \"Parser\" [\n MkTestCase \"ParseFileDescriptor\"\n (assertEq (parseFile protoFileContents) (Right expectedFileDescriptor))\n])\n","avg_line_length":30.2244897959,"max_line_length":76,"alphanum_fraction":0.711006077} +{"size":2071,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"module Examples\n\nimport Linear.Equality\nimport Linear.Types\nimport Data.Fin\nimport Data.Nat\nimport QPF\nimport QCont\n\n\n-- Example 12\nnamespace ListAsQCont\n\n ListCont : Type -> Type\n ListCont = F Nat Fin\n\n MaybeCont : Type -> Type\n MaybeCont = F Bool (\\b => if b then I else Fin 0)\n\n Just : x -<> MaybeCont x\n Just x = True # (\\Star => x)\n\n Nothing : (Fin 0 -<> x) -<> MaybeCont x\n Nothing f = False # f\n\n head : ListCont x -<> MaybeCont x\n head (0 # f) = Nothing f\n head (S n # f) = Just (f 0)\n\n-- Example 21\nnamespace NatAsQPF\n\n NatF : Desc\n NatF = Sum' (Const' I) Id'\n\n N : Type\n N = W NatF\n\n Zero : N\n Zero = Con (Inl Star)\n\n Suc : N -> N\n Suc n = Con (Inr n)\n\n elim : (0 p : N -> Type) -> p Zero -> ((0 n : N) -> p n -<> p (Suc n)) ->\n (1 n : N) -> p n\n elim p p0 ps = induction {p = p} f where\n f : (1 w : Sigma0 (qpf NatF N) (lift NatF p)) -> p (Con (fst w))\n f (_ # (Inl (Star # (Refl # (Star # Refl))))) = p0\n f (_ # (Inr (b # (Refl # ih)))) = ps b ih\n\n-- Example 22\nnamespace BinTreeAsQPF\n parameters (a : Type)\n\n BtF : Desc\n BtF = Sum' (Const' a) (Prod' Id' Id')\n\n Tree : Type\n Tree = W BtF\n\n Leaf : a -<> Tree\n Leaf x = Con (Inl x)\n\n Node : Tree -<> Tree -<> Tree\n Node l r = Con (Inr (l # r))\n\n\n elim : (0 p : Tree -> Type) ->\n (pl : (1 x : a) -> p (Leaf x)) ->\n (pn : (0 l : Tree) -> (0 r : Tree) -> p l -<> p r -<> p (Node l r)) ->\n (1 t : Tree) -> p t\n elim p pl pn = induction {p = p} f where\n f : (1 w : Sigma0 (qpf BtF Tree) (lift BtF p)) -> p (Con (fst w))\n f (_ # Inl (x # (Refl # (x # Refl)))) = pl x\n f (x # Inr (w # (q # (ihl # ihr)))) = replace1 (\\ y => p (Con y)) (eq x w q) (pn _ _ ihl ihr)\n where\n eq : (0 x : Sum a (LPair (W (Sum' (Const' a) (Prod' Id' Id'))) (W (Sum' (Const' a) (Prod' Id' Id'))))) ->\n (0 w : LPair (W (Sum' (Const' a) (Prod' Id' Id'))) (W (Sum' (Const' a) (Prod' Id' Id')))) ->\n (1 q : x = Inr w) -> Inr (fst w # snd w) = x\n eq (Inr (w1 # w2)) (w1 # w2) Refl = Refl\n","avg_line_length":25.256097561,"max_line_length":113,"alphanum_fraction":0.483341381} +{"size":6573,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"module Prelude.Show\n\nimport Builtin\nimport Prelude.Basics\nimport Prelude.EqOrd\nimport Prelude.Num\nimport Prelude.Types\n\n%default total\n\n----------\n-- SHOW --\n----------\n\n||| The precedence of an Idris operator or syntactic context.\npublic export\ndata Prec = Open | Equal | Dollar | Backtick | User Nat | PrefixMinus | App\n\n||| Gives the constructor index of the Prec as a helper for writing\n||| implementations.\npublic export\nprecCon : Prec -> Integer\nprecCon Open = 0\nprecCon Equal = 1\nprecCon Dollar = 2\nprecCon Backtick = 3\nprecCon (User n) = 4\nprecCon PrefixMinus = 5\nprecCon App = 6\n\nexport\nEq Prec where\n (==) (User m) (User n) = m == n\n (==) x y = precCon x == precCon y\n\nexport\nOrd Prec where\n compare (User m) (User n) = compare m n\n compare x y = compare (precCon x) (precCon y)\n\n||| Things that have a canonical `String` representation.\npublic export\ninterface Show ty where\n constructor MkShow\n ||| Convert a value to its `String` representation.\n ||| @ x the value to convert\n show : (x : ty) -> String\n show x = showPrec Open x\n\n ||| Convert a value to its `String` representation in a certain precedence\n ||| context.\n |||\n ||| A value should produce parentheses around itself if and only if the given\n ||| precedence context is greater than or equal to the precedence of the\n ||| outermost operation represented in the produced `String`. *This is\n ||| different from Haskell*, which requires it to be strictly greater. `Open`\n ||| should thus always produce *no* outermost parens, `App` should always\n ||| produce outermost parens except on atomic values and those that provide\n ||| their own bracketing, like `Pair` and `List`.\n ||| @ d the precedence context.\n ||| @ x the value to convert\n showPrec : (d : Prec) -> (x : ty) -> String\n showPrec _ x = show x\n\n||| Surround a `String` with parentheses depending on a condition.\n||| @ b whether to add parentheses\nexport\nshowParens : (b : Bool) -> String -> String\nshowParens False s = s\nshowParens True s = \"(\" ++ s ++ \")\"\n\n||| A helper for the common case of showing a non-infix constructor with at\n||| least one argument, for use with `showArg`.\n|||\n||| Apply `showCon` to the precedence context, the constructor name, and the\n||| args shown with `showArg` and concatenated. Example:\n||| ```\n||| data Ann a = MkAnn String a\n|||\n||| Show a => Show (Ann a) where\n||| showPrec d (MkAnn s x) = showCon d \"MkAnn\" $ showArg s ++ showArg x\n||| ```\nexport\nshowCon : (d : Prec) -> (conName : String) -> (shownArgs : String) -> String\nshowCon d conName shownArgs = showParens (d >= App) (conName ++ shownArgs)\n\n||| A helper for the common case of showing a non-infix constructor with at\n||| least one argument, for use with `showCon`.\n|||\n||| This adds a space to the front so the results can be directly concatenated.\n||| See `showCon` for details and an example.\nexport\nshowArg : Show a => (x : a) -> String\nshowArg x = \" \" ++ showPrec App x\n\nfirstCharIs : (Char -> Bool) -> String -> Bool\nfirstCharIs p \"\" = False\nfirstCharIs p str = p (assert_total (prim__strHead str))\n\nprimNumShow : (a -> String) -> Prec -> a -> String\nprimNumShow f d x = let str = f x in showParens (d >= PrefixMinus && firstCharIs (== '-') str) str\n\nexport\nShow Int where\n showPrec = primNumShow prim__cast_IntString\n\nexport\nShow Integer where\n showPrec = primNumShow prim__cast_IntegerString\n\nexport\nShow Bits8 where\n showPrec = primNumShow prim__cast_Bits8String\n\nexport\nShow Bits16 where\n showPrec = primNumShow prim__cast_Bits16String\n\nexport\nShow Bits32 where\n showPrec = primNumShow prim__cast_Bits32String\n\nexport\nShow Bits64 where\n showPrec = primNumShow prim__cast_Bits64String\n\nexport\nShow Int8 where\n showPrec = primNumShow prim__cast_Int8String\n\nexport\nShow Int16 where\n showPrec = primNumShow prim__cast_Int16String\n\nexport\nShow Int32 where\n showPrec = primNumShow prim__cast_Int32String\n\nexport\nShow Int64 where\n showPrec = primNumShow prim__cast_Int64String\n\nexport\nShow Double where\n showPrec = primNumShow prim__cast_DoubleString\n\nprotectEsc : (Char -> Bool) -> String -> String -> String\nprotectEsc p f s = f ++ (if firstCharIs p s then \"\\\\&\" else \"\") ++ s\n\nshowLitChar : Char -> String -> String\nshowLitChar '\\a' = (\"\\\\a\" ++)\nshowLitChar '\\b' = (\"\\\\b\" ++)\nshowLitChar '\\f' = (\"\\\\f\" ++)\nshowLitChar '\\n' = (\"\\\\n\" ++)\nshowLitChar '\\r' = (\"\\\\r\" ++)\nshowLitChar '\\t' = (\"\\\\t\" ++)\nshowLitChar '\\v' = (\"\\\\v\" ++)\nshowLitChar '\\SO' = protectEsc (== 'H') \"\\\\SO\"\nshowLitChar '\\DEL' = (\"\\\\DEL\" ++)\nshowLitChar '\\\\' = (\"\\\\\\\\\" ++)\nshowLitChar c\n = case getAt (fromInteger (prim__cast_CharInteger c)) asciiTab of\n Just k => strCons '\\\\' . (k ++)\n Nothing => if (c > '\\DEL')\n then strCons '\\\\' . protectEsc isDigit (show (prim__cast_CharInt c))\n else strCons c\n where\n asciiTab : List String\n asciiTab\n = [\"NUL\", \"SOH\", \"STX\", \"ETX\", \"EOT\", \"ENQ\", \"ACK\", \"BEL\",\n \"BS\", \"HT\", \"LF\", \"VT\", \"FF\", \"CR\", \"SO\", \"SI\",\n \"DLE\", \"DC1\", \"DC2\", \"DC3\", \"DC4\", \"NAK\", \"SYN\", \"ETB\",\n \"CAN\", \"EM\", \"SUB\", \"ESC\", \"FS\", \"GS\", \"RS\", \"US\"]\n\nshowLitString : List Char -> String -> String\nshowLitString [] = id\nshowLitString ('\"'::cs) = (\"\\\\\\\"\" ++) . showLitString cs\nshowLitString (c ::cs) = (showLitChar c) . showLitString cs\n\nexport\nShow Char where\n show '\\'' = \"'\\\\''\"\n show c = strCons '\\'' (showLitChar c \"'\")\n\nexport\nShow String where\n show cs = strCons '\"' (showLitString (unpack cs) \"\\\"\")\n\nexport\nShow Nat where\n show n = show (the Integer (natToInteger n))\n\nexport\nShow Bool where\n show True = \"True\"\n show False = \"False\"\n\nexport\nShow Void where\n show v impossible\n\nexport\nShow () where\n show () = \"()\"\n\nexport\n(Show a, Show b) => Show (a, b) where\n show (x, y) = \"(\" ++ show x ++ \", \" ++ show y ++ \")\"\n\nexport\n(Show a, {y : a} -> Show (p y)) => Show (DPair a p) where\n show (y ** prf) = \"(\" ++ show y ++ \" ** \" ++ show prf ++ \")\"\n\nexport\nShow a => Show (List a) where\n show xs = \"[\" ++ show' \"\" xs ++ \"]\"\n where\n show' : String -> List a -> String\n show' acc [] = acc\n show' acc [x] = acc ++ show x\n show' acc (x :: xs) = show' (acc ++ show x ++ \", \") xs\n\nexport\nShow a => Show (Maybe a) where\n showPrec d Nothing = \"Nothing\"\n showPrec d (Just x) = showCon d \"Just\" (showArg x)\n\nexport\n(Show a, Show b) => Show (Either a b) where\n showPrec d (Left x) = showCon d \"Left\" $ showArg x\n showPrec d (Right x) = showCon d \"Right\" $ showArg x\n","avg_line_length":28.3318965517,"max_line_length":98,"alphanum_fraction":0.6296972463} +{"size":1429,"ext":"idr","lang":"Idris","max_stars_count":161.0,"content":"import Data.Vect\n\n{- 1 -}\n\nreadToBlank : IO (List String)\nreadToBlank = do x <- getLine\n case x of\n \"\" => pure []\n _ => do rest <- readToBlank\n pure (x :: rest)\n\n{- 2 -}\n\nreadAndSave : IO ()\nreadAndSave = do lines <- readToBlank\n putStr \"Filename: \"\n f <- getLine\n Right () <- writeFile f (unlines lines)\n | Left err => putStrLn (show err)\n pure ()\n\n{- 3 -}\n\nreadVectFile : (filename : String) -> IO (n ** Vect n String)\nreadVectFile filename = do Right h <- openFile filename Read\n | Left err => pure (_ ** [])\n Right contents <- readContents h\n | Left err => pure (_ ** [])\n closeFile h\n pure contents\n where readContents : File -> IO (Either FileError (n ** Vect n String))\n readContents h = do eof <- fEOF h\n if eof then pure (Right (_ ** [])) else do\n Right str <- fGetLine h\n | Left err => pure (Left err)\n Right (_ ** rest) <- readContents h\n | Left err => pure (Left err)\n pure (Right (_ ** str :: rest))\n","avg_line_length":36.641025641,"max_line_length":75,"alphanum_fraction":0.3967809657} +{"size":3308,"ext":"idr","lang":"Idris","max_stars_count":16.0,"content":"module HEff\n\n-- Based on https:\/\/github.com\/effectfully\/Eff\/blob\/master\/Resources\/Core.agda\n\nimport Data.HVect\n\nEffect : Type -> Type\nEffect r = r -> (a : Type) -> (a -> r) -> Type\n\nEffects : (Type -> Type) -> Vect n Type -> Vect n Type\nEffects f [] = []\nEffects f (x :: xs) = f x :: Effects f xs\n\ndata Exists' : {t : Type} -> {rs : Vect n Type} ->\n HVect rs -> t -> HVect (Effects Effect rs) -> Effect t -> Type where\n Here : Exists' (x :: xs) x (y :: ys) y\n There : Exists' xs x ys y -> Exists' (_ :: xs) x (_ :: ys) y\n\nupdate' : {t : Type} -> (r : HVect rs) -> (e : Exists' {t = t} r s effs eff) -> t -> HVect rs\nupdate' [] Here _ impossible\nupdate' [] (There _) _ impossible\nupdate' (x :: xs) Here v = v :: xs\nupdate' (x :: xs) (There e) v = x :: update' xs e v\n\nHEffect : Type\nHEffect = {n : Nat} -> (rs : Vect n Type) -> HVect (Effects Effect rs) -> Effect (HVect rs)\n\ndata HEff : HEffect where\n Pure : (x : a) -> HEff rs effs (r' x) a r'\n Bind : (e : Exists' r s effs eff) ->\n eff s a s' ->\n ((x : a) -> HEff rs effs (update' r e (s' x)) b r'') -> HEff rs effs r b r''\n\n(>>=) : HEff rs effs r a r' -> ((x : a) -> HEff rs effs (r' x) b r'') -> HEff rs effs r b r''\n(>>=) (Pure x) f = f x\n(>>=) (Bind e x f) g = Bind e x (\\y => f y >>= g)\n\ndata Access = LoggedOut | LoggedIn\ndata Store : Access -> (ty : Type) -> (ty -> Access) -> Type where\n Login : Store LoggedOut () (const LoggedIn)\n Logout : Store LoggedIn () (const LoggedOut)\n\nlogin : {auto e : Exists' r LoggedOut effs Store} ->\n HEff rs effs r () (\\_ => update' r e LoggedIn)\nlogin {e} = Bind e Login Pure\n\nlogout : {auto e : Exists' r LoggedIn effs Store} ->\n HEff rs effs r () (\\_ => update' r e LoggedOut)\nlogout {e} = Bind e Logout Pure\n\ndata State : Type -> (a : Type) -> (a -> Type) -> Type where\n Get : State s s (const s)\n Put : s' -> State s () (const s')\n\nget : {auto e : Exists' r s effs State} ->\n HEff rs effs r s (\\_ => update' r e s)\nget {e} = Bind e Get Pure\n\nput : {auto e : Exists' r s effs State} -> s' ->\n HEff rs effs r () (\\_ => update' r e s')\nput {e} s' = Bind e (Put s') Pure\n\nrun : HEff [] [] r a r' -> a\nrun (Pure x) = x\nrun (Bind Here _ _) impossible\nrun (Bind (There _) _ _) impossible\n\nhead' : HVect xs -> head xs\nhead' (x :: _) = x\ntail' : HVect xs -> HVect (tail xs)\ntail' (x :: xs) = xs\n\nrunStore : HEff (Access :: rs) (Store :: effs) r a r' -> HEff rs effs (tail' r) a (\\x => tail' $ r' x)\nrunStore (Pure x) = Pure x\nrunStore (Bind Here Login f) = runStore $ f ()\nrunStore (Bind Here Logout f) = runStore $ f ()\nrunStore (Bind (There e) eff f) = Bind e eff (\\x => runStore $ f x)\n\nrunState : (head' r) -> HEff (Type :: rs) (State :: effs) r a r' -> HEff rs effs (tail' r) (DPair a (\\x => head' $ r' x)) (\\x => tail' $ r' (fst x))\nrunState s (Pure x) = Pure (x ** s)\nrunState s (Bind Here Get f) = runState s $ f s\nrunState s (Bind Here (Put s') f) = runState s' $ f ()\nrunState s (Bind (There e) eff f) = Bind e eff (\\x => runState s $ f x)\n\nexample : HEff [Access, Type] [Store, State] [LoggedOut, Nat] Nat (\\n => [LoggedOut, Vect n Bool])\nexample = do login\n n <- get\n put (replicate n True)\n logout\n Pure n\n\ntest : DPair Nat (\\n => Vect n Bool)\ntest = run . runState 3 . runStore $ example \n","avg_line_length":35.1914893617,"max_line_length":149,"alphanum_fraction":0.5525997582} +{"size":1384,"ext":"idr","lang":"Idris","max_stars_count":128.0,"content":"||| An order is a particular kind of binary relation. The order\n||| relation is intended to proceed in some direction, though not\n||| necessarily with a unique path.\n|||\n||| Orders are often defined simply as bundles of binary relation\n||| properties.\n|||\n||| A prominent example of an order relation is LTE over Nat.\n\nmodule Control.Order\n\nimport Control.Relation\n\n||| A preorder is reflexive and transitive.\npublic export\ninterface (Reflexive ty rel, Transitive ty rel) => Preorder ty rel where\n\n||| A partial order is an antisymmetrics preorder.\npublic export\ninterface (Preorder ty rel, Antisymmetric ty rel) => PartialOrder ty rel where\n\n||| A relation is connex if for any two distinct x and y, either x ~ y or y ~ x.\n|||\n||| This can also be stated as a trichotomy: x ~ y or x = y or y ~ x.\npublic export\ninterface Connex ty rel where\n connex : {x, y : ty} -> Not (x = y) -> Either (rel x y) (rel y x)\n\n||| A relation is strongly connex if for any two x and y, either x ~ y or y ~ x.\npublic export\ninterface StronglyConnex ty rel where\n order : (x, y : ty) -> Either (rel x y) (rel y x)\n\n||| A linear order is a connex partial order.\npublic export\ninterface (PartialOrder ty rel, Connex ty rel) => LinearOrder ty rel where\n\n----------------------------------------\n\n||| Every equivalence relation is a preorder.\npublic export\n[EP] Equivalence ty rel => Preorder ty rel where\n","avg_line_length":32.1860465116,"max_line_length":80,"alphanum_fraction":0.6921965318} +{"size":3402,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"module Ipkg.Parser\n\nimport Data.List\nimport Text.Lexer\nimport Text.Parser\nimport Text.Parser.Core\n\nimport Ipkg.Types\nimport Ipkg.Lexer\nimport Ipkg.Rule\n\ndata DescField : Type where\n PVersion : PkgVersion -> DescField\n PStrField : String -> String -> DescField\n PModules : List String -> DescField\n PDepends : List Depends -> DescField\n\npkgversion : Rule PkgVersion\npkgversion = PV <$> sepBy1 dot nat\n\npackageName : Rule String\npackageName = exact \"package\" *> identifier\n\nversion : Rule PkgVersion\nversion = property \"version\" >> pkgversion\n\nmodules : Rule (List String)\nmodules = property \"modules\" >> sep identifier\n\ndeps : Rule (List Depends)\ndeps = property \"depends\" >> sep depends\n where\n data Bound = LT PkgVersion Bool | GT PkgVersion Bool\n bound : Rule (List Bound)\n bound = do op \"<=\"\n v <- pkgversion\n pure [ LT v True ]\n <|> do op \">=\"\n v <- pkgversion\n pure [ GT v True ]\n <|> do op \"<\"\n v <- pkgversion\n pure [ LT v False ]\n <|> do op \">\"\n v <- pkgversion\n pure [ GT v False ]\n <|> do op \"==\"\n v <- pkgversion\n pure [LT v True, GT v True]\n\n mkBound : List Bound -> PkgVersionBounds -> EmptyRule PkgVersionBounds\n mkBound (LT b i :: bs) pkgbs\n = maybe (mkBound bs . { upperBound := Just b, upperInclusive := i } $ pkgbs)\n (\\_ => fail \"Dependency already has an upper bound\")\n pkgbs.upperBound\n mkBound (GT b i :: bs) pkgbs\n = maybe (mkBound bs . { lowerBound := Just b, lowerInclusive := i } $ pkgbs)\n (\\_ => fail \"Dependency already has a lower bound\")\n pkgbs.lowerBound\n mkBound [] pkgbs = pure pkgbs\n\n depends : Rule Depends\n depends = do\n name <- identifier\n bs <- sepBy (op \"&&\") bound\n pure $ D name !(mkBound (concat bs) anyBounds)\n\nstrField : Rule (String, String)\nstrField = do\n name <- identifier\n equals\n value <- stringLit <|> identifier\n pure (name, value)\n\nfield : Rule DescField\nfield = (PVersion <$> version)\n <|> (PDepends <$> deps)\n <|> (PModules <$> modules)\n <|> (uncurry PStrField <$> strField)\n\naddField : DescField -> Package -> Package\naddField (PVersion v) = { version := Just v }\naddField (PStrField nm val) = { strFields $= ((nm, val) ::) }\naddField (PDepends ds) = { depends := ds }\naddField (PModules ms) = { modules := ms }\n\n\nexpr : Rule Package\nexpr = do\n pkg <- def <$> packageName\n fields <- some field\n eof\n pure $ foldr addField pkg fields\n\nprocessWhitespace : (List (WithBounds PkgToken), a) ->\n (List (WithBounds PkgToken), a)\nprocessWhitespace = mapFst (filter notComment)\n where\n notComment : WithBounds PkgToken -> Bool\n notComment t with (t.val)\n notComment _ | (Comment x) = False\n notComment _ | Space = False\n notComment _ | _ = True\n\n\nrunParser : String -> Either (List1 (ParsingError PkgToken)) (Package, List (WithBounds PkgToken))\nrunParser s = parse expr . fst . processWhitespace $ lex tokenMap s\n\nerrMsgs : List1 (ParsingError PkgToken) -> String\nerrMsgs = concatMap decorate . forget\n where decorate : ParsingError PkgToken -> String\n decorate (Error msg bounds) = \"ParseError(\\{msg}; \\{show bounds})\"\n\nexport\nparsePkg : String -> Either String Package\nparsePkg = bimap errMsgs fst . runParser\n","avg_line_length":29.0769230769,"max_line_length":98,"alphanum_fraction":0.6199294533} +{"size":6719,"ext":"lidr","lang":"Idris","max_stars_count":null,"content":"> module Vect.Operations\n\n\n> import Data.Vect\n> import Data.Fin\n> import Data.So\n\n> import Decidable.Predicates\n> import Rel.TotalPreorder\n> import Rel.TotalPreorderOperations\n> import Nat.LTProperties\n> import Sigma.Sigma\n\n\n> %default total\n> %access public export\n> %auto_implicits on\n\n\nLookup\n\n> ||| Lookup the index of an element of a vector\n> lookup : {A : Type} -> .(a : A) -> .(as : Vect n A) -> Elem a as -> Fin n\n> lookup {n = Z} a Nil Here impossible\n> lookup {n = Z} a Nil (There p) impossible\n> lookup {n = S m} a (a :: as) Here = FZ\n> lookup {n = S m} a (a' :: as) (There prf) = FS (lookup a as prf)\n\n> ||| Lookup the index of an element of a vector\n> -- lookup' : {n : Nat} -> {A : Type} -> (DecEq A) => (a : A) -> (as : Vect n A) -> Maybe (Fin n)\n> lookup' : {n : Nat} -> {A : Type} -> (DecEq A) -> (a : A) -> (as : Vect n A) -> Maybe (Fin n)\n> lookup' {n = Z} _ _ Nil = Nothing\n> lookup' {n = S m} d a (a' :: as) with (decEq a a')\n> | (Yes _) = Just FZ\n> | (No _) with (lookup' d a as)\n> | Nothing = Nothing\n> | (Just k) = Just (FS k)\n\n\nContainer monad operations\n\n...\n\n\nFiltering\n\n> ||| Filters a vector on a decidable property\n> filter : {A : Type} ->\n> {P : A -> Type} ->\n> Dec1 P ->\n> Vect n A -> \n> Sigma Nat (\\ m => Vect m A)\n> filter d1P Nil = MkSigma Z Nil\n> filter d1P (a :: as) with (filter d1P as)\n> | (MkSigma n as') with (d1P a)\n> | (Yes _) = MkSigma (S n) (a :: as')\n> | (No _) = MkSigma n as'\n\n\n> ||| Filters a vector on a decidable property and pairs elements with proofs\n> filterTagSigma : {A : Type} ->\n> {P : A -> Type} ->\n> Dec1 P ->\n> Vect n A -> \n> Sigma Nat (\\ m => Vect m (Sigma A P))\n> filterTagSigma d1P Nil = MkSigma _ Nil\n> filterTagSigma d1P (a :: as) with (filterTagSigma d1P as)\n> | (MkSigma _ tail) with (d1P a)\n> | (Yes p) = MkSigma _ ((MkSigma a p) :: tail)\n> | (No _) = MkSigma _ tail\n\n\n> ||| Filters a vector on a decidable property and pairs elements with proofs\n> filterTagExists : {A : Type} ->\n> {P : A -> Type} ->\n> Dec1 P ->\n> Vect n A -> \n> Sigma Nat (\\ m => Vect m (Exists {a = A} P))\n> filterTagExists d1P Nil = MkSigma _ Nil\n> filterTagExists d1P (a :: as) with (filterTagExists d1P as)\n> | (MkSigma _ tail) with (d1P a)\n> | (Yes p) = MkSigma _ ((Evidence a p) :: tail)\n> | (No _) = MkSigma _ tail\n\n\n> ||| Filters a vector on a decidable property and pairs elements with proofs\n> filterTagSubset : {A : Type} ->\n> {P : A -> Type} ->\n> Dec1 P ->\n> Vect n A -> \n> Sigma Nat (\\ m => Vect m (Subset A P))\n> filterTagSubset d1P Nil = MkSigma _ Nil\n> filterTagSubset d1P (a :: as) with (filterTagSubset d1P as)\n> | (MkSigma _ tail) with (d1P a)\n> | (Yes p) = MkSigma _ ((Element a p) :: tail)\n> | (No _) = MkSigma _ tail\n\nSearching\n\n> |||\n> argmaxMax : {A : Type} -> {R : A -> A -> Type} -> \n> TotalPreorder R -> Vect n A -> .(LT Z n) -> (Fin n, A)\n> argmaxMax {n = Z} tp Nil p = absurd p\n> argmaxMax {n = S Z} tp (a :: Nil) _ = (FZ, a)\n> argmaxMax {n = S (S m)} tp (a' :: (a'' :: as)) _ with (argmaxMax tp (a'' :: as) (ltZS m))\n> | (k, max) with (totalPre tp a' max)\n> | (Left _) = (FS k, max)\n> | (Right _) = (FZ, a')\n\n\n> |||\n> argmax : {A : Type} -> {R : A -> A -> Type} -> \n> TotalPreorder R -> Vect n A -> .(LT Z n) -> Fin n\n> argmax tp as p = fst (argmaxMax tp as p)\n\n\n> |||\n> max : {A : Type} -> {R : A -> A -> Type} -> \n> TotalPreorder R -> Vect n A -> .(LT Z n) -> A\n> max tp as p = snd (argmaxMax tp as p)\n\n\n> {-\n\n> |||\n> argmaxMax : {A : Type} ->\n> TotalPreorder A -> Vect n A -> .(LT Z n) -> (Fin n, A)\n> argmaxMax {n = Z} tp Nil p = absurd p\n> argmaxMax {n = S Z} tp (a :: Nil) _ = (FZ, a)\n> argmaxMax {n = S (S m)} tp (a' :: (a'' :: as)) _ with (argmaxMax tp (a'' :: as) (ltZS m))\n> | (k, max) with (totalPre tp a' max)\n> | (Left _) = (FS k, max)\n> | (Right _) = (FZ, a')\n\n\n> |||\n> argmax : {A : Type} ->\n> TotalPreorder A -> Vect n A -> .(LT Z n) -> Fin n\n> argmax tp as p = fst (argmaxMax tp as p)\n\n\n> |||\n> max : {A : Type} ->\n> TotalPreorder A -> Vect n A -> .(LT Z n) -> A\n> max tp as p = snd (argmaxMax tp as p)\n\n> -}\n\n\nShow\n\n> implementation Show (Elem a as) where\n> show = show' where\n> show' : {n : Nat} -> {A : Type} -> {a : A} -> {as : Vect n A} -> Elem a as -> String \n> show' Here = \"Here\"\n> show' (There p) = \"There\" ++ show' p\n\n\nPointwise modify\n\n> |||\n> modifyVect : {n : Nat} -> {a : Type} ->\n> Vect n a -> Fin n -> a -> Vect n a\n> modifyVect {n = Z} Nil k _ = absurd k\n> modifyVect {n = S m} (a :: as) FZ a' = a' :: as\n> modifyVect {n = S m} (a :: as) (FS k) a' = a :: (modifyVect as k a')\n\n\nFold:\n\ndata Vect : Nat -> Type -> Type where\n Nil : Vect Z A\n Cons : A -> Vect n A -> Vect (S n) A\n\nx0 : X 0\nf : A -> X n -> X (S n)\n\n\n> foldVect : {X : Nat -> Type} -> \n> {A : Type} ->\n> X 0 ->\n> ((n : Nat) -> A -> X n -> X (S n)) ->\n> Vect n A ->\n> X n\n> foldVect {n = Z} x0 f Nil = x0\n> foldVect {n = S m} x0 f (a :: as) = f m a (foldVect x0 f as)\n\n\n> {-\n\n> |||\n> argmaxMax : {A : Type} -> {TO : A -> A -> Type} -> Preordered A TO =>\n> Vect (S n) A -> (Fin (S n), A)\n> argmaxMax {n = Z} (a :: Nil) = (FZ, a)\n> argmaxMax {A} {n = S m} (a :: (a' :: as)) with (preorder a (snd (argmaxMax (a' :: as))))\n> | (Left _) = (FS (fst ka), snd ka) where\n> ka : (Fin (S m), A)\n> ka = argmaxMax (a' :: as)\n> | (Right _) = (FZ, a)\n\n\n> |||\n> argmax : {A : Type} -> {TO : A -> A -> Type} -> Preordered A TO =>\n> Vect (S n) A -> Fin (S n)\n> argmax = fst . argmaxMax\n\n\n> |||\n> max : {A : Type} -> {TO : A -> A -> Type} -> Preordered A TO =>\n> Vect (S n) A -> A\n> max = snd . argmaxMax\n\n> -}\n\n\n> {-\n\n> |||\n> argmaxMax : {A, F : Type} -> {TO : F -> F -> Type} -> Ordered F TO =>\n> Vect (S n) (A,F) -> (A,F)\n> argmaxMax {n = Z} (af :: Nil) = af\n> argmaxMax {n = S m} (af :: (af' :: afs)) with (order (snd af) (snd (argmaxMax (af' :: afs))))\n> | (Left _) = argmaxMax (af' :: afs)\n> | (Right _) = af\n\n\n> |||\n> argmax : {A, F : Type} -> {TO : F -> F -> Type} -> Ordered F TO =>\n> Vect (S n) (A,F) -> A\n> argmax = fst . argmaxMax\n\n\n> |||\n> max : {A, F : Type} -> {TO : F -> F -> Type} -> Ordered F TO =>\n> Vect (S n) (A,F) -> F\n> max = snd . argmaxMax\n\n> ---}\n \n> ---}\n\n \n","avg_line_length":27.6502057613,"max_line_length":98,"alphanum_fraction":0.4676291115} +{"size":5879,"ext":"idr","lang":"Idris","max_stars_count":31.0,"content":"module Test.JSON\n\nimport JS\nimport JS.JSON\nimport Hedgehog\nimport Test.Object\n\nimport Generics.Derive\n\n%language ElabReflection\n\n%runElab derive \"Test.Object.Address\" [ToJSON1,FromJSON1]\n\nroundTrip : Eq a => FromJSON a => ToJSON a => Show a => Gen a -> Property\nroundTrip g = property $ do v <- forAll g\n let enc = encode v\n footnote enc\n Right v === decode enc\n\n--------------------------------------------------------------------------------\n-- Fast Eq for Nat\n--------------------------------------------------------------------------------\n\n||| The default Eq for Nat runs in O(n), which leads to stack overflows\n||| for large Nats\nexport\n[FastNatEq] Eq Nat where\n (==) = (==) `on` natToInteger\n\n||| The default Ord for Nat runs in O(n), which leads to stack overflows\n||| for large Nats\nexport\n[FastNatOrd] Ord Nat using FastNatEq where\n compare = compare `on` natToInteger\n\n--------------------------------------------------------------------------------\n-- Sum Type\n--------------------------------------------------------------------------------\n\ndata Sum : (a : Type) -> Type where\n Con1 : (name : String) -> (age : Bits32) -> (female : Bool) -> Sum a\n Con2 : (treasure : List a) -> (weight : Bits64) -> Sum a\n Con3 : (foo : Maybe a) -> (bar : Either Bool a) -> Sum a\n\n%runElab derive \"Sum\" [Generic,Meta,Show,Eq,ToJSON,FromJSON]\n\n--------------------------------------------------------------------------------\n-- Generators\n--------------------------------------------------------------------------------\n\nbits8All : Gen Bits8\nbits8All = bits8 $ linear 0 255\n\nbits16All : Gen Bits16\nbits16All = bits16 $ exponential 0 65535\n\nbits32All : Gen Bits32\nbits32All = bits32 $ exponential 0 4294967295\n\nbits64All : Gen Bits64\nbits64All = bits64 $ exponential 0 18446744073709551615\n\nunicode16 : Gen Char\nunicode16 = charc '\\0' '\\65535'\n\ndoubleE100 : Gen Double\ndoubleE100 = double $ exponentialFrom 0 (-1.0e100) 1.0e100\n\nintAll : Gen Int\nintAll = int $ exponential (-9223372036854775808) 9223372036854775807\n\ninteger128 : Gen Integer\ninteger128 = integer $ exponentialFrom 0 (-0x100000000000000000000000000000000) 0x100000000000000000000000000000000\n\nnat128 : Gen Nat\nnat128 = nat $ exponential @{FastNatOrd} 0 0x100000000000000000000000000000000\n\nlist20 : Gen a -> Gen (List a)\nlist20 = list (linear 0 20)\n\nlist1_20 : Gen a -> Gen (List1 a)\nlist1_20 = list1 (linear 1 20)\n\noptional : Gen a -> Gen (Optional a)\noptional = map maybeToOptional . maybe\n\nstring20 : Gen Char -> Gen String\nstring20 = string $ linear 0 20\n\nstring20Ascii : Gen String\nstring20Ascii = string20 ascii\n\nstring20Unicode16 : Gen String\nstring20Unicode16 = string20 unicode16\n\narray20 : Gen a -> Gen (IArray a)\narray20 = map fromList . list20\n\nvect13 : Gen a -> Gen (Vect 13 a)\nvect13 = vect 13\n\nsum : Gen (Sum Int)\nsum = map to $ sop $ MkPOP [ [ string20 alphaNum, bits32All, bool ]\n , [ list20 intAll, bits64All ]\n , [ maybe intAll, either bool intAll ]\n ]\n\n--------------------------------------------------------------------------------\n-- Properties\n--------------------------------------------------------------------------------\n\nprop_unit : Property\nprop_unit = roundTrip $ pure ()\n\nprop_array : Property\nprop_array = roundTrip $ array20 bits8All\n\nprop_bits8 : Property\nprop_bits8 = roundTrip bits8All\n\nprop_bits16 : Property\nprop_bits16 = roundTrip bits16All\n\nprop_bits32 : Property\nprop_bits32 = roundTrip bits32All\n\nprop_bits64 : Property\nprop_bits64 = roundTrip bits64All\n\nprop_bool : Property\nprop_bool = roundTrip bool\n\nprop_char : Property\nprop_char = roundTrip unicode16\n\nprop_double : Property\nprop_double = roundTrip doubleE100\n\nprop_either : Property\nprop_either = roundTrip $ either bits8All ascii\n\nprop_int : Property\nprop_int = roundTrip intAll\n\nprop_integer : Property\nprop_integer = roundTrip integer128\n\nprop_list : Property\nprop_list = roundTrip $ list20 bits8All\n\nprop_list1 : Property\nprop_list1 = roundTrip $ list1_20 unicode16\n\nprop_maybe : Property\nprop_maybe = roundTrip $ maybe (either bool bits32All)\n\nprop_nat : Property\nprop_nat = roundTrip @{FastNatEq} nat128\n\nprop_np : Property\nprop_np = roundTrip $ np [ integer128, bool, unicode16, maybe string20Ascii ]\n\nprop_ns : Property\nprop_ns = roundTrip $ ns [ integer128, bool, unicode16, maybe string20Ascii ]\n\nprop_optional : Property\nprop_optional = roundTrip $ optional bits64All\n\nprop_pair : Property\nprop_pair = roundTrip [| (,) (list1_20 bool) (maybe ascii) |]\n\nprop_string : Property\nprop_string = roundTrip $ string20 unicode\n\nprop_sum : Property\nprop_sum = roundTrip sum\n\nprop_vect : Property\nprop_vect = roundTrip $ vect13 intAll\n\nprop_address : Property\nprop_address = roundTrip addresses\n\nexport\ntest : IO ()\ntest = ignore . checkGroup . withTests 1000 $ MkGroup \"JSON\" [\n (\"prop_address\", prop_address)\n , (\"prop_array\", prop_array)\n , (\"prop_bits8\", prop_bits8)\n , (\"prop_bits16\", prop_bits16)\n , (\"prop_bits32\", prop_bits32)\n , (\"prop_bits64\", prop_bits64)\n , (\"prop_bool\", prop_bool)\n , (\"prop_char\", prop_char)\n , (\"prop_double\", prop_double)\n , (\"prop_either\", prop_either)\n , (\"prop_int\", prop_int)\n , (\"prop_integer\", prop_integer)\n , (\"prop_list\", prop_list)\n , (\"prop_list1\", prop_list1)\n , (\"prop_maybe\", prop_maybe)\n , (\"prop_nat\", prop_nat)\n , (\"prop_np\", prop_np)\n , (\"prop_ns\", prop_ns)\n , (\"prop_optional\", prop_optional)\n , (\"prop_pair\", prop_pair)\n , (\"prop_string\", prop_string)\n , (\"prop_sum\", prop_sum)\n , (\"prop_unit\", prop_unit)\n , (\"prop_vect\", prop_vect)\n ]\n","avg_line_length":27.7311320755,"max_line_length":115,"alphanum_fraction":0.597040313} +{"size":8430,"ext":"idr","lang":"Idris","max_stars_count":15.0,"content":"module BaseN\n\nimport Data.Fin\nimport ZZ\nimport GCDZZ\nimport gcd\nimport ZZUtils\nimport NatUtils\nimport NatOrder\n\n%access public export\n\n--Defines a data type Base that behaves like a list\ndata Base: (n: Nat) -> Type where\n Ones: (n: Nat) -> (Fin n) -> Base n\n Next: (n: Nat) -> (Fin n) -> (Base n) -> (Base n)\n\n--Auxiliary function that reverses a Base (S n) onto anpther given Base (S n)\ntotal\nRevonto: (n: Nat) -> (Base (S n)) -> (Base (S n)) -> (Base (S n))\nRevonto n accum (Ones (S n) x) = Next (S n) x accum\nRevonto n accum (Next (S n) x y) = Revonto n (Next (S n) x accum) y\n\n--Reverses a Base (S n)\ntotal\nRev: (n: Nat) -> (Base (S n)) -> (Base (S n))\nRev n (Ones (S n) x) = Ones (S n) x\nRev n (Next (S n) x y) = Revonto n (Ones (S n) x) y\n\n--Concatenates two values in Base (S n)\ntotal\nconcat: (n: Nat) -> (Base (S n)) -> (Base (S n)) -> (Base (S n))\nconcat n (Ones (S n) x) y = Next (S n) x y\nconcat n (Next (S n) x z) y = Next (S n) x (concat n z y)\n\n--Fin to Nat\ntotal\ntonatFin: (n: Nat) -> Fin(S n) -> Nat\ntonatFin Z FZ = Z\ntonatFin (S k) FZ = Z\ntonatFin (S k) (FS x) = S (tonatFin k x)\n\n--Outputs the length of a number in base n\ntotal\nlen: (n: Nat) -> Base (S n) -> Nat\nlen n (Ones (S n) x) = S Z\nlen n (Next (S n) x y) = S(len n y)\n\n--List Fin to Nat\ntotal\ntonat: (n: Nat) -> Base (S n) -> Nat\ntonat Z y = case y of\n (Ones (S Z) x) => case x of\n FZ => Z\n FS x impossible\n (Next (S Z) x z) => case x of\n FZ => Z\n FS x impossible\ntonat (S k) y = case y of\n (Ones (S (S k)) x) => case x of\n FZ => Z\n FS x => S(tonat k (Ones (S k) x))\n (Next (S (S k)) x z) => case x of\n FZ => tonat (S k) z\n FS w => (S(tonat k (Ones (S k) w)))*(pow (S (S k)) (len (S k) z)) + (tonat (S k) z)\n\ntotal\ntonatFindef: tonatFin (S Z) FZ = Z\ntonatFindef = Refl\n\ntotal\ntonatdef: tonat Z (Ones (S Z) FZ) = Z\ntonatdef = Refl\n\n--Nat to Fin (modular values)\ntotal\ntofinNath: (a: Nat) -> (n: Nat) -> (k: Nat) -> Fin (S n)\ntofinNath r Z k = FZ\ntofinNath r (S j) Z = FZ\ntofinNath Z (S j) (S r) = FZ\ntofinNath (S k) (S j) (S r) = f k j r (lte (S k) (S j)) where\n f: (k: Nat) -> (j: Nat) -> (r: Nat) -> (t: Bool) -> Fin (S (S j))\n f k j r True = FS (tofinNath k j r)\n f k j r False = let qrem = eculidDivideAux (S k) (S j) (SIsNotZ) in\n (tofinNath (DPair.fst(DPair.snd(qrem))) (S j) r)\n\n\ntotal\ntofinNat: (a: Nat) -> (n: Nat) -> Fin (S n)\ntofinNat a n = tofinNath a n (n+2)\n\ntotal\ntonatfinlte: (n: Nat) -> (a: Fin (S n)) -> (lte (tonatFin n a) n) = True\ntonatfinlte Z FZ = Refl\ntonatfinlte Z (FS x) impossible\ntonatfinlte (S k) FZ = Refl\ntonatfinlte (S k) (FS x) = (tonatfinlte k x)\n\ntotal\nFinNatop: (n: Nat) -> (a: Fin (S n)) -> (tofinNat (tonatFin n a) n) = a\nFinNatop Z FZ = Refl\nFinNatop Z (FS x) impossible\nFinNatop (S k) FZ = Refl\nFinNatop (S k) (FS x) = trans (cong(tonatfinlte (S k) (FS x))) (cong(FinNatop k x))\n\ntotal\nRemn: (a: Nat) -> (n: Nat) -> (r: Nat ** (lte r (S n) = True))\nRemn a n = let\n qrem = eculidDivideAux a (S n) (SIsNotZ)\n rem = DPair.fst(DPair.snd(qrem))\n in\n MkDPair rem (LTEmeanslteTrue rem (S n) (ltImpliesLTE (Basics.snd(DPair.snd(DPair.snd(qrem))))))\n\ntotal\nstrp: (Base (S n)) -> (Base (S n))\nstrp (Ones (S n) x) = (Ones (S n) x)\nstrp (Next (S n) x y) = case x of\n FZ => strp(y)\n FS z => Next (S n) x y\n\n-- Nat to List Fin n (base n representation)\ntotal\ntofinh: Nat -> (n: Nat) -> (r: Nat) -> Base (S n)\ntofinh Z n r = Ones (S n) FZ\ntofinh k n Z = Ones (S n) FZ\ntofinh (S k) n (S r) = strp(concat n (tofinh q n r) (Ones (S n) rem)) where\n qrem: (q : Nat ** (r : Nat ** (((S k) = r + (q * (S n))), LT r (S n))))\n qrem = eculidDivideAux (S k) (S n) (SIsNotZ)\n rem: Fin (S n)\n rem = tofinNat (DPair.fst(DPair.snd(qrem))) n\n q: Nat\n q = DPair.fst(qrem)\n\ntotal\ntofin: Nat -> (n: Nat) -> Base (S n)\ntofin k n = tofinh k n k\n\n--embedding Fin n in Fin S n vertically\ntotal\nembn: (n: Nat) -> Fin n -> Fin (S n)\nembn (S k) FZ = FZ\nembn (S k) (FS x) = FS (embn k x)\n\n--Generates n in (Fin (S n))\ntotal\nGenn: (n: Nat) -> (Fin (S n))\nGenn Z = FZ\nGenn (S k) = FS (Genn k)\n\n--Checks if a given element of Fin (S n) is in fact n\ntotal\nIsn: (n: Nat) -> (p: Fin (S n)) -> Bool\nIsn Z x = True\nIsn (S k) FZ = False\nIsn (S k) (FS x) = Isn k x\n\n--Proves that the definitional equality for Isn holds\ntotal\nIsnisIsn: (n: Nat) -> (p: Fin (S n)) -> (Isn (S n) (FS p)) = (Isn n p)\nIsnisIsn n p = Refl\n\n--Proves that if a given (FS x) is not n in (Fin (S n)), then x is not n-1 in (Fin n)\ntotal\nIsNotnPf: (n: Nat) -> (p: Fin (S n)) -> ((Isn (S n) (FS p)) = False) -> ((Isn n p) = False)\nIsNotnPf Z _ Refl impossible\nIsNotnPf (S k) FZ prf = Refl\nIsNotnPf (S k) (FS x) prf = trans (sym (IsnisIsn (S k) (FS x))) prf\n\n--Gives a back embedding whenever the value is not Genn\ntotal\nPredec: (n: Nat) -> (p: Fin (S n)) -> ((Isn n p) = False) -> (Fin n)\nPredec Z _ Refl impossible\nPredec (S k) FZ Refl = FZ\nPredec (S k) (FS x) prf = FS (Predec k x (IsNotnPf (S k) (FS x) prf))\n\n--Decidable type for Isn\ntotal\nDecIsn: (n: Nat) -> (p: (Fin (S n))) -> Either (Isn n p = True) (Isn n p = False)\nDecIsn Z p = Left Refl\nDecIsn (S k) FZ = Right Refl\nDecIsn (S k) (FS x) = case (DecIsn k x) of\n Left l => Left (trans (IsnisIsn k x) l)\n Right r => Right (trans (IsnisIsn k x) r)\n\n--adding two Fin n's\ntotal\naddfinh: (n: Nat) -> (k: Nat) -> Fin (S n) -> Fin (S n) -> (Fin (S n), Fin (S n))\naddfinh k Z x y = (FZ, FZ)\naddfinh Z (S r) x y = (FZ, FZ)\naddfinh (S k) (S r) FZ y = (FZ, y)\naddfinh (S k) (S r) (FS x) y = let\n a = Genn (S k)\n b = the (Fin (S (S k))) FZ\n c = the (Fin (S k)) FZ\n w = fst(addfinh (S k) r (embn (S k) x) y)\n z = snd(addfinh (S k) r (embn (S k) x) y)\n in\n case (DecIsn (S k) z) of\n Left l => (FS c, b)\n Right r => (w, FS(Predec (S k) z r))\n\ntotal\naddfin: (n: Nat) -> Fin (S n) -> Fin (S n) -> (Fin (S n), Fin (S n))\naddfin n x y = addfinh n (n+1) x y\n\n--adding two reversed lists as specified\ntotal\naddfinlh: (n: Nat) -> (k: Nat) -> Base (S n) -> Base (S n) -> Base (S n)\naddfinlh n Z a b = (Ones (S n) FZ)\naddfinlh n (S k) (Ones (S n) x) (Ones (S n) y) = case (addfin n x y) of\n (FZ, a) => Ones (S n) a\n (FS c, a) => Next (S n) a (Ones (S n) (FS c))\naddfinlh n (S k) (Ones (S n) x) (Next (S n) y z) = Next (S n) (snd (addfin n x y)) (addfinlh n k (Ones (S n) (fst (addfin n x y))) z)\naddfinlh n (S k) (Next (S n) x z) (Ones (S n) y) = Next (S n) (snd (addfin n x y)) (addfinlh n k (Ones (S n) (fst (addfin n x y))) z)\naddfinlh n (S k) (Next (S n) x z) (Next (S n) y w) = Next (S n) (snd (addfin n x y)) (addfinlh n k (Ones (S n) (fst (addfin n x y))) (addfinlh n k z w))\n\ntotal\naddfinl: (n: Nat) -> Base (S n) -> Base (S n) -> Base (S n)\naddfinl n x y = addfinlh n (4*((len n x)+(len n y))) x y\n\n--adding two lists\ntotal\naddfinlist: (n: Nat) -> Base (S n) -> Base (S n) -> Base (S n)\naddfinlist n xs ys = (Rev n (addfinl n (Rev n xs) (Rev n ys)))\n\n--multiply two reversed lists in Fin S n\ntotal\nmulfinlh: (n: Nat) -> (k: Nat) -> Base (S n) -> Base (S n) -> Base (S n)\nmulfinlh n Z a b = Ones (S n) FZ\nmulfinlh n (S k) (Ones (S n) FZ) y = Ones (S n) FZ\nmulfinlh n (S k) (Ones (S n) (FS x)) y = addfinl n y (mulfinlh n k (Ones (S n) (embn n x)) y)\nmulfinlh n (S k) (Next (S n) FZ z) y = Next (S n) FZ (mulfinlh n k z y)\nmulfinlh n (S k) (Next (S n) (FS x) z) y = addfinl n y (mulfinlh n k (Next (S n) (embn n x) z) y)\n\ntotal\nmulfinl: (n: Nat) -> Base (S n) -> Base (S n) -> Base (S n)\nmulfinl n x y = mulfinlh n (tonat n x) x y\n\n--multiply two lists\ntotal\nmulfinList: (n: Nat) -> (Base (S n)) -> (Base (S n)) -> (Base (S n))\nmulfinList n xs ys = Rev n (mulfinl n (Rev n xs) (Rev n ys))\n\n--Custom \"functions are functors\" function\ntotal\nap: (x: Type) -> (y: Type) -> (f: x->y) -> (n = m) -> (f n = f m)\nap x y f Refl = Refl\n","avg_line_length":33.9919354839,"max_line_length":152,"alphanum_fraction":0.5144721234} +{"size":474,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"longer : String -> String -> Nat\nlonger word1 word2\n = let len1 = length word1\n len2 = length word2 in\n if len1 > len2 then len1 else len2\n\nlongerWord : String -> String -> String\nlongerWord word1 word2\n = case (length word1 == length word2) of \n True => word1\n False => word2\n\n\n\npythagoras : Double -> Double -> Double\npythagoras x y = sqrt (square x + square y)\n where\n square : Double -> Double\n square x = x * x\n","avg_line_length":23.7,"max_line_length":45,"alphanum_fraction":0.5970464135} +{"size":16013,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"module Idris.IDEMode.REPL\n\nimport Compiler.Scheme.Chez\nimport Compiler.Scheme.Racket\nimport Compiler.Scheme.Gambit\nimport Compiler.Common\n\nimport Core.AutoSearch\nimport Core.CompileExpr\nimport Core.Context\nimport Core.InitPrimitives\nimport Core.Metadata\nimport Core.Normalise\nimport Core.Options\nimport Core.TT\nimport Core.Unify\n\nimport Data.List\nimport Data.List1\nimport Data.So\nimport Data.Strings\n\nimport Idris.Desugar\nimport Idris.Error\nimport Idris.ModTree\nimport Idris.Package\nimport Idris.Parser\nimport Idris.Pretty\nimport Idris.Resugar\nimport Idris.REPL\nimport Idris.Syntax\nimport Idris.Version\nimport Idris.Pretty\n\nimport Idris.IDEMode.Commands\nimport Idris.IDEMode.Holes\nimport Idris.IDEMode.Parser\nimport Idris.IDEMode.SyntaxHighlight\n\nimport TTImp.Interactive.CaseSplit\nimport TTImp.Elab\nimport TTImp.TTImp\nimport TTImp.ProcessDecls\n\nimport Utils.Hex\n\nimport Data.List\nimport System\nimport System.File\n\nimport Network.Socket\nimport Network.Socket.Data\n\n%default covering\n\n%foreign \"C:fdopen,libc 6\"\nprim__fdopen : Int -> String -> PrimIO AnyPtr\n\nexport\nsocketToFile : Socket -> IO (Either String File)\nsocketToFile (MkSocket f _ _ _) = do\n file <- FHandle <$> primIO (prim__fdopen f \"r+\")\n if !(fileError file)\n then pure (Left \"Failed to fdopen socket file descriptor\")\n else pure (Right file)\n\nexport\ninitIDESocketFile : String -> Int -> IO (Either String File)\ninitIDESocketFile h p = do\n osock <- socket AF_INET Stream 0\n case osock of\n Left fail => do\n putStrLn (show fail)\n putStrLn \"Failed to open socket\"\n exitWith (ExitFailure 1)\n Right sock => do\n res <- bind sock (Just (Hostname h)) p\n if res \/= 0\n then pure (Left (\"Failed to bind socket with error: \" ++ show res))\n else\n do res <- listen sock\n if res \/= 0\n then\n pure (Left (\"Failed to listen on socket with error: \" ++ show res))\n else\n do putStrLn (show p)\n res <- accept sock\n case res of\n Left err =>\n pure (Left (\"Failed to accept on socket with error: \" ++ show err))\n Right (s, _) =>\n socketToFile s\n\ngetChar : File -> IO Char\ngetChar h = do\n if !(fEOF h)\n then do\n putStrLn \"Alas the file is done, aborting\"\n exitWith (ExitFailure 1)\n else do\n Right chr <- fGetChar h\n | Left err => do putStrLn \"Failed to read a character\"\n exitWith (ExitFailure 1)\n pure chr\n\ngetFLine : File -> IO String\ngetFLine h\n = do Right str <- fGetLine h\n | Left err =>\n do putStrLn \"Failed to read a line\"\n exitWith (ExitFailure 1)\n pure str\n\ngetNChars : File -> Nat -> IO (List Char)\ngetNChars i Z = pure []\ngetNChars i (S k)\n = do x <- getChar i\n xs <- getNChars i k\n pure (x :: xs)\n\n-- Read 6 characters. If they're a hex number, read that many characters.\n-- Otherwise, just read to newline\ngetInput : File -> IO String\ngetInput f\n = do x <- getNChars f 6\n case fromHexChars (reverse x) of\n Nothing =>\n do rest <- getFLine f\n pure (pack x ++ rest)\n Just num =>\n do inp <- getNChars f (integerToNat (cast num))\n pure (pack inp)\n\n||| Do nothing and tell the user to wait for us to implmement this (or join the effort!)\ntodoCmd : {auto o : Ref ROpts REPLOpts} ->\n String -> Core ()\ntodoCmd cmdName = iputStrLn $ reflow $ cmdName ++ \": command not yet implemented. Hopefully soon!\"\n\n\ndata IDEResult\n = REPL REPLResult\n | NameList (List Name)\n | Term String -- should be a PTerm + metadata, or SExp.\n | TTTerm String -- should be a TT Term + metadata, or perhaps SExp\n\nreplWrap : Core REPLResult -> Core IDEResult\nreplWrap m = pure $ REPL !m\n\nprocess : {auto c : Ref Ctxt Defs} ->\n {auto u : Ref UST UState} ->\n {auto s : Ref Syn SyntaxInfo} ->\n {auto m : Ref MD Metadata} ->\n {auto o : Ref ROpts REPLOpts} ->\n IDECommand -> Core IDEResult\nprocess (Interpret cmd)\n = replWrap $ interpret cmd\nprocess (LoadFile fname_in _)\n = do let fname = case !(findIpkg (Just fname_in)) of\n Nothing => fname_in\n Just f' => f'\n replWrap $ Idris.REPL.process (Load fname) >>= outputSyntaxHighlighting fname\nprocess (TypeOf n Nothing)\n = replWrap $ Idris.REPL.process (Check (PRef replFC (UN n)))\nprocess (TypeOf n (Just (l, c)))\n = replWrap $ Idris.REPL.process (Editing (TypeAt (fromInteger l) (fromInteger c) (UN n)))\nprocess (CaseSplit l c n)\n = replWrap $ Idris.REPL.process (Editing (CaseSplit False (fromInteger l) (fromInteger c) (UN n)))\nprocess (AddClause l n)\n = replWrap $ Idris.REPL.process (Editing (AddClause False (fromInteger l) (UN n)))\nprocess (AddMissing l n)\n = do todoCmd \"add-missing\"\n pure $ REPL $ Edited $ DisplayEdit emptyDoc\nprocess (ExprSearch l n hs all)\n = replWrap $ Idris.REPL.process (Editing (ExprSearch False (fromInteger l) (UN n)\n (map UN hs)))\nprocess ExprSearchNext\n = replWrap $ Idris.REPL.process (Editing ExprSearchNext)\nprocess (GenerateDef l n)\n = replWrap $ Idris.REPL.process (Editing (GenerateDef False (fromInteger l) (UN n) 0))\nprocess GenerateDefNext\n = replWrap $ Idris.REPL.process (Editing GenerateDefNext)\nprocess (MakeLemma l n)\n = replWrap $ Idris.REPL.process (Editing (MakeLemma False (fromInteger l) (UN n)))\nprocess (MakeCase l n)\n = replWrap $ Idris.REPL.process (Editing (MakeCase False (fromInteger l) (UN n)))\nprocess (MakeWith l n)\n = replWrap $ Idris.REPL.process (Editing (MakeWith False (fromInteger l) (UN n)))\nprocess (DocsFor n modeOpt)\n = replWrap $ Idris.REPL.process (Doc (UN n))\nprocess (Apropos n)\n = do todoCmd \"apropros\"\n pure $ REPL $ Printed emptyDoc\nprocess (Directive n)\n = do todoCmd \"directive\"\n pure $ REPL $ Printed emptyDoc\nprocess (WhoCalls n)\n = do todoCmd \"who-calls\"\n pure $ NameList []\nprocess (CallsWho n)\n = do todoCmd \"calls-who\"\n pure $ NameList []\nprocess (BrowseNamespace ns)\n = replWrap $ Idris.REPL.process (Browse (List1.toList $ reverse (split (=='.') ns)))\nprocess (NormaliseTerm tm)\n = do todoCmd \"normalise-term\"\n pure $ Term tm\nprocess (ShowTermImplicits tm)\n = do todoCmd \"show-term-implicits\"\n pure $ Term tm\nprocess (HideTermImplicits tm)\n = do todoCmd \"hide-term-implicits\"\n pure $ Term tm\nprocess (ElaborateTerm tm)\n = do todoCmd \"elaborate-term\"\n pure $ TTTerm tm\nprocess (PrintDefinition n)\n = do todoCmd \"print-definition\"\n pure $ REPL $ Printed (pretty n)\nprocess (ReplCompletions n)\n = do todoCmd \"repl-completions\"\n pure $ NameList []\nprocess Version\n = replWrap $ Idris.REPL.process ShowVersion\nprocess (Metavariables _)\n = replWrap $ Idris.REPL.process Metavars\nprocess GetOptions\n = replWrap $ Idris.REPL.process GetOpts\n\nprocessCatch : {auto c : Ref Ctxt Defs} ->\n {auto u : Ref UST UState} ->\n {auto s : Ref Syn SyntaxInfo} ->\n {auto m : Ref MD Metadata} ->\n {auto o : Ref ROpts REPLOpts} ->\n IDECommand -> Core IDEResult\nprocessCatch cmd\n = do c' <- branch\n u' <- get UST\n s' <- get Syn\n o' <- get ROpts\n catch (do res <- process cmd\n commit\n pure res)\n (\\err => do put Ctxt c'\n put UST u'\n put Syn s'\n put ROpts o'\n msg <- perror err\n pure $ REPL $ REPLError msg)\n\nidePutStrLn : File -> Integer -> String -> Core ()\nidePutStrLn outf i msg\n = send outf (SExpList [SymbolAtom \"write-string\",\n toSExp msg, toSExp i])\n\nreturnFromIDE : File -> Integer -> SExp -> Core ()\nreturnFromIDE outf i msg\n = do send outf (SExpList [SymbolAtom \"return\", msg, toSExp i])\n\nprintIDEResult : File -> Integer -> SExp -> Core ()\nprintIDEResult outf i msg = returnFromIDE outf i (SExpList [SymbolAtom \"ok\", toSExp msg])\n\nprintIDEResultWithHighlight : File -> Integer -> SExp -> Core ()\nprintIDEResultWithHighlight outf i msg = returnFromIDE outf i (SExpList [SymbolAtom \"ok\", toSExp msg\n -- TODO return syntax highlighted result\n , SExpList []])\n\nprintIDEError : Ref ROpts REPLOpts => File -> Integer -> Doc IdrisAnn -> Core ()\nprintIDEError outf i msg = returnFromIDE outf i (SExpList [SymbolAtom \"error\", toSExp !(renderWithoutColor msg) ])\n\nSExpable REPLEval where\n toSExp EvalTC = SymbolAtom \"typecheck\"\n toSExp NormaliseAll = SymbolAtom \"normalise\"\n toSExp Execute = SymbolAtom \"execute\"\n\nSExpable REPLOpt where\n toSExp (ShowImplicits impl) = SExpList [ SymbolAtom \"show-implicits\", toSExp impl ]\n toSExp (ShowNamespace ns) = SExpList [ SymbolAtom \"show-namespace\", toSExp ns ]\n toSExp (ShowTypes typs) = SExpList [ SymbolAtom \"show-types\", toSExp typs ]\n toSExp (EvalMode mod) = SExpList [ SymbolAtom \"eval\", toSExp mod ]\n toSExp (Editor editor) = SExpList [ SymbolAtom \"editor\", toSExp editor ]\n toSExp (CG str) = SExpList [ SymbolAtom \"cg\", toSExp str ]\n\n\ndisplayIDEResult : {auto c : Ref Ctxt Defs} ->\n {auto u : Ref UST UState} ->\n {auto s : Ref Syn SyntaxInfo} ->\n {auto m : Ref MD Metadata} ->\n {auto o : Ref ROpts REPLOpts} ->\n File -> Integer -> IDEResult -> Core ()\ndisplayIDEResult outf i (REPL $ REPLError err)\n = printIDEError outf i err\ndisplayIDEResult outf i (REPL RequestedHelp )\n = printIDEResult outf i\n $ StringAtom $ displayHelp\ndisplayIDEResult outf i (REPL $ Evaluated x Nothing)\n = printIDEResultWithHighlight outf i\n $ StringAtom $ show x\ndisplayIDEResult outf i (REPL $ Evaluated x (Just y))\n = printIDEResultWithHighlight outf i\n $ StringAtom $ show x ++ \" : \" ++ show y\ndisplayIDEResult outf i (REPL $ Printed xs)\n = printIDEResultWithHighlight outf i\n $ StringAtom $ show xs\ndisplayIDEResult outf i (REPL $ TermChecked x y)\n = printIDEResultWithHighlight outf i\n $ StringAtom $ show x ++ \" : \" ++ show y\ndisplayIDEResult outf i (REPL $ FileLoaded x)\n = printIDEResult outf i $ SExpList []\ndisplayIDEResult outf i (REPL $ ErrorLoadingFile x err)\n = printIDEError outf i $ reflow \"Error loading file\" <++> pretty x <+> colon <++> pretty (show err)\ndisplayIDEResult outf i (REPL $ ErrorsBuildingFile x errs)\n = do errs' <- traverse perror errs\n printIDEError outf i $ reflow \"Error(s) building file\" <++> pretty x <+> colon <++> vsep errs'\ndisplayIDEResult outf i (REPL $ NoFileLoaded)\n = printIDEError outf i $ reflow \"No file can be reloaded\"\ndisplayIDEResult outf i (REPL $ CurrentDirectory dir)\n = printIDEResult outf i\n $ StringAtom $ \"Current working directory is '\" ++ dir ++ \"'\"\ndisplayIDEResult outf i (REPL CompilationFailed)\n = printIDEError outf i $ reflow \"Compilation failed\"\ndisplayIDEResult outf i (REPL $ Compiled f)\n = printIDEResult outf i $ StringAtom\n $ \"File \" ++ f ++ \" written\"\ndisplayIDEResult outf i (REPL $ ProofFound x)\n = printIDEResult outf i\n $ StringAtom $ show x\ndisplayIDEResult outf i (REPL $ Missed cases)\n = printIDEResult outf i\n $ StringAtom $ showSep \"\\n\"\n $ map handleMissing' cases\ndisplayIDEResult outf i (REPL $ CheckedTotal xs)\n = printIDEResult outf i\n $ StringAtom $ showSep \"\\n\"\n $ map (\\ (fn, tot) => (show fn ++ \" is \" ++ show tot)) xs\ndisplayIDEResult outf i (REPL $ FoundHoles holes)\n = printIDEResult outf i $ SExpList $ map sexpHole holes\ndisplayIDEResult outf i (REPL $ LogLevelSet k)\n = printIDEResult outf i\n $ StringAtom $ \"Set loglevel to \" ++ show k\ndisplayIDEResult outf i (REPL $ OptionsSet opts)\n = printIDEResult outf i optionsSexp\n where\n optionsSexp : SExp\n optionsSexp = SExpList $ map toSExp opts\ndisplayIDEResult outf i (REPL $ VersionIs x)\n = printIDEResult outf i versionSExp\n where\n semverSexp : SExp\n semverSexp = case (semVer x) of\n (maj, min, patch) => SExpList (map toSExp [maj, min, patch])\n tagSexp : SExp\n tagSexp = case versionTag x of\n Nothing => SExpList [ StringAtom \"\" ]\n Just t => SExpList [ StringAtom t ]\n versionSExp : SExp\n versionSExp = SExpList [ semverSexp, tagSexp ]\n\ndisplayIDEResult outf i (REPL $ Edited (DisplayEdit xs))\n = printIDEResult outf i $ StringAtom $ show xs\ndisplayIDEResult outf i (REPL $ Edited (EditError x))\n = printIDEError outf i x\ndisplayIDEResult outf i (REPL $ Edited (MadeLemma lit name pty pappstr))\n = printIDEResult outf i\n $ StringAtom $ (relit lit $ show name ++ \" : \" ++ show pty ++ \"\\n\") ++ pappstr\ndisplayIDEResult outf i (REPL $ Edited (MadeWith lit wapp))\n = printIDEResult outf i\n $ StringAtom $ showSep \"\\n\" (map (relit lit) wapp)\ndisplayIDEResult outf i (REPL $ (Edited (MadeCase lit cstr)))\n = printIDEResult outf i\n $ StringAtom $ showSep \"\\n\" (map (relit lit) cstr)\ndisplayIDEResult outf i (NameList ns)\n = printIDEResult outf i $ SExpList $ map toSExp ns\ndisplayIDEResult outf i (Term t)\n = printIDEResult outf i $ StringAtom t\ndisplayIDEResult outf i (TTTerm t)\n = printIDEResult outf i $ StringAtom t\ndisplayIDEResult outf i (REPL $ ConsoleWidthSet mn)\n = let width = case mn of \n Just k => show k\n Nothing => \"auto\"\n in printIDEResult outf i $ StringAtom $ \"Set consolewidth to \" ++ width\ndisplayIDEResult outf i _ = pure ()\n\n\nhandleIDEResult : {auto c : Ref Ctxt Defs} ->\n {auto u : Ref UST UState} ->\n {auto s : Ref Syn SyntaxInfo} ->\n {auto m : Ref MD Metadata} ->\n {auto o : Ref ROpts REPLOpts} ->\n File -> Integer -> IDEResult -> Core ()\nhandleIDEResult outf i (REPL Exited) = idePutStrLn outf i \"Bye for now!\"\nhandleIDEResult outf i other = displayIDEResult outf i other\n\nloop : {auto c : Ref Ctxt Defs} ->\n {auto u : Ref UST UState} ->\n {auto s : Ref Syn SyntaxInfo} ->\n {auto m : Ref MD Metadata} ->\n {auto o : Ref ROpts REPLOpts} ->\n Core ()\nloop\n = do res <- getOutput\n case res of\n REPL _ => printError $ reflow \"Running idemode but output isn't\"\n IDEMode idx inf outf => do\n inp <- coreLift $ getInput inf\n end <- coreLift $ fEOF inf\n if end\n then pure ()\n else case parseSExp inp of\n Left err =>\n do printIDEError outf idx (reflow \"Parse error:\" <++> pretty err)\n loop\n Right sexp =>\n case getMsg sexp of\n Just (cmd, i) =>\n do updateOutput i\n res <- processCatch cmd\n handleIDEResult outf i res\n loop\n Nothing =>\n do printIDEError outf idx (reflow \"Unrecognised command:\" <++> pretty (show sexp))\n loop\n where\n updateOutput : Integer -> Core ()\n updateOutput idx\n = do IDEMode _ i o <- getOutput\n | _ => pure ()\n setOutput (IDEMode idx i o)\n\nexport\nreplIDE : {auto c : Ref Ctxt Defs} ->\n {auto u : Ref UST UState} ->\n {auto s : Ref Syn SyntaxInfo} ->\n {auto m : Ref MD Metadata} ->\n {auto o : Ref ROpts REPLOpts} ->\n Core ()\nreplIDE\n = do res <- getOutput\n case res of\n REPL _ => printError $ reflow \"Running idemode but output isn't\"\n IDEMode _ inf outf => do\n send outf (version 2 0)\n loop\n","avg_line_length":36.0653153153,"max_line_length":114,"alphanum_fraction":0.6156872541} +{"size":50,"ext":"idr","lang":"Idris","max_stars_count":396.0,"content":"module Bad3\n\nbadExpr : ()\nbadExpr (whatever : ())\n","avg_line_length":10.0,"max_line_length":23,"alphanum_fraction":0.64} +{"size":103,"ext":"idr","lang":"Idris","max_stars_count":3.0,"content":"module Main\n\nimport CatR\nimport CatI\n\nmain : IO ()\nmain = putStrLn \"Welcome to the Paris Idris Group!\"\n","avg_line_length":12.875,"max_line_length":51,"alphanum_fraction":0.7281553398} +{"size":2466,"ext":"idr","lang":"Idris","max_stars_count":396.0,"content":"module Libraries.Control.ANSI.CSI\n\n%default total\n\n||| Moves the cursor n columns up.\n||| If the cursor is at the edge of the screen it has no effect.\nexport\ncursorUp : Nat -> String\ncursorUp n = \"\\x1B[\" ++ show n ++ \"A\"\n\nexport\ncursorUp1 : String\ncursorUp1 = cursorUp 1\n\n||| Moves the cursor n columns down.\n||| If the cursor is at the edge of the screen it has no effect.\nexport\ncursorDown : Nat -> String\ncursorDown n = \"\\x1B[\" ++ show n ++ \"B\"\n\nexport\ncursorDown1 : String\ncursorDown1 = cursorDown 1\n\n||| Moves the cursor n columns forward.\n||| If the cursor is at the edge of the screen it has no effect.\nexport\ncursorForward : Nat -> String\ncursorForward n = \"\\x1B[\" ++ show n ++ \"C\"\n\nexport\ncursorForward1 : String\ncursorForward1 = cursorForward 1\n\n||| Moves the cursor n columns back.\n||| If the cursor is at the edge of the screen it has no effect.\nexport\ncursorBack : Nat -> String\ncursorBack n = \"\\x1B[\" ++ show n ++ \"D\"\n\nexport\ncursorBack1 : String\ncursorBack1 = cursorBack 1\n\n||| Moves the cursor at the beginning of n lines down.\n||| If the cursor is at the edge of the screen it has no effect.\nexport\ncursorNextLine : Nat -> String\ncursorNextLine n = \"\\x1B[\" ++ show n ++ \"E\"\n\nexport\ncursorNextLine1 : String\ncursorNextLine1 = cursorNextLine 1\n\n||| Moves the cursor at the beginning of n lines up.\n||| If the cursor is at the edge of the screen it has no effect.\nexport\ncursorPrevLine : Nat -> String\ncursorPrevLine n = \"\\x1B[\" ++ show n ++ \"F\"\n\nexport\ncursorPrevLine1 : String\ncursorPrevLine1 = cursorPrevLine 1\n\n||| Moves the cursor at an arbitrary line and column.\n||| Both lines and columns start at 1.\nexport\ncursorMove : (row : Nat) -> (col : Nat) -> String\ncursorMove row col = \"\\x1B[\" ++ show row ++ \";\" ++ show col ++ \"H\"\n\npublic export\ndata EraseDirection = Start | End | All\n\nCast EraseDirection String where\n cast Start = \"1\"\n cast End = \"0\"\n cast All = \"2\"\n\n||| Clears part of the screen.\nexport\neraseScreen : EraseDirection -> String\neraseScreen to = \"\\x1B[\" ++ cast to ++ \"J\"\n\n||| Clears part of the line.\nexport\neraseLine : EraseDirection -> String\neraseLine to = \"\\x1B[\" ++ cast to ++ \"K\"\n\n||| Scrolls the whole screen up by n lines.\nexport\nscrollUp : Nat -> String\nscrollUp n = \"\\x1B[\" ++ show n ++ \"S\"\n\nexport\nscrollUp1 : String\nscrollUp1 = scrollUp 1\n\n||| Scrolls the whole screen down by n lines.\nexport\nscrollDown : Nat -> String\nscrollDown n = \"\\x1B[\" ++ show n ++ \"T\"\n\nexport\nscrollDown1 : String\nscrollDown1 = scrollDown 1\n","avg_line_length":23.2641509434,"max_line_length":66,"alphanum_fraction":0.6918085969} +{"size":16239,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"||| Functions for the processing of received request and\n||| notifications.\n|||\n||| (C) The Idris Community, 2021\nmodule Server.ProcessMessage\n\nimport Core.Context\nimport Core.Core\nimport Core.Env\nimport Core.Metadata\nimport Core.UnifyState\nimport Data.List\nimport Data.OneOf\nimport Data.SortedSet\nimport Idris.ModTree\nimport Idris.Package\nimport Idris.Pretty\nimport Idris.REPL\nimport Idris.REPL.Opts\nimport Idris.Resugar\nimport Idris.Syntax\nimport Idris.IDEMode.Holes\nimport Language.JSON\nimport Language.LSP.CodeAction\nimport Language.LSP.CodeAction.AddClause\nimport Language.LSP.CodeAction.CaseSplit\nimport Language.LSP.CodeAction.ExprSearch\nimport Language.LSP.CodeAction.GenerateDef\nimport Language.LSP.CodeAction.MakeCase\nimport Language.LSP.CodeAction.MakeLemma\nimport Language.LSP.CodeAction.MakeWith\nimport Language.LSP.Definition\nimport Language.LSP.DocumentSymbol\nimport Language.LSP.SignatureHelp\nimport Language.LSP.Message\nimport Libraries.Data.PosMap\nimport Libraries.Utils.Path\nimport Server.Capabilities\nimport Server.Configuration\nimport Server.Log\nimport Server.QuickFix\nimport Server.SemanticTokens\nimport Server.Response\nimport Server.Utils\nimport System\nimport System.Clock\nimport System.Directory\nimport System.File\nimport Data.List1\nimport Libraries.Data.List.Extra\n\ndisplayType : {auto c : Ref Ctxt Defs} ->\n {auto s : Ref Syn SyntaxInfo} ->\n Defs -> (Name, Int, GlobalDef) ->\n Core (Doc IdrisAnn)\ndisplayType defs (n, i, gdef)\n = maybe (do tm <- resugar [] !(normaliseHoles defs [] (type gdef))\n pure (pretty !(aliasName (fullname gdef)) <++> colon <++> prettyTerm tm))\n (\\num => reAnnotate Syntax <$> prettyHole defs [] n num (type gdef))\n (isHole gdef)\n\ndisplayTerm : {auto c : Ref Ctxt Defs} ->\n {auto s : Ref Syn SyntaxInfo} ->\n Defs -> ClosedTerm ->\n Core (Doc IdrisAnn)\ndisplayTerm defs tm\n = do ptm <- resugar [] !(normaliseHoles defs [] tm)\n pure (prettyTerm ptm)\n\nisDirty : Ref LSPConf LSPConfiguration => DocumentURI -> Core Bool\nisDirty uri = gets LSPConf (contains uri . dirtyFiles)\n\nisError : Ref LSPConf LSPConfiguration => DocumentURI -> Core Bool\nisError uri = gets LSPConf (contains uri . errorFiles)\n\nloadURI : Ref LSPConf LSPConfiguration\n => Ref Ctxt Defs\n => Ref UST UState\n => Ref Syn SyntaxInfo\n => Ref MD Metadata\n => Ref ROpts REPLOpts\n => InitializeParams -> URI -> Maybe Int -> Core (Either String ())\nloadURI conf uri version = do\n modify LSPConf (record {openFile = Just (uri, fromMaybe 0 version)})\n resetContext (Virtual Interactive)\n let fpath = uri.path\n let Just (startFolder, startFile) = splitParent fpath\n | Nothing => do let msg = \"Cannot find the parent folder for \\{show uri}\"\n logString Error msg\n pure $ Left msg\n True <- coreLift $ changeDir startFolder\n | False => do let msg = \"Cannot change current directory to \\{show startFolder}, folder of \\{show startFile}\"\n logString Error msg\n pure $ Left msg\n Just fname <- findIpkg (Just fpath)\n | Nothing => do let msg = \"Cannot find ipkg file for \\{show uri}\"\n logString Error msg\n pure $ Left msg\n Right res <- coreLift $ File.readFile fname\n | Left err => do let msg = \"Cannot read file at \\{show uri}\"\n logString Error msg\n pure $ Left msg\n setSource res\n errs <- buildDeps fname -- FIXME: the compiler always dumps the errors on stdout, requires\n -- a compiler change.\n case errs of\n [] => pure ()\n (_::_) => modify LSPConf (record { errorFiles $= insert uri })\n resetProofState\n let caps = (publishDiagnostics <=< textDocument) . capabilities $ conf\n modify LSPConf (record { quickfixes = [], cachedActions = empty, cachedHovers = empty })\n traverse_ (findQuickfix caps uri) errs\n sendDiagnostics caps uri version errs\n pure $ Right ()\n\nloadIfNeeded : Ref LSPConf LSPConfiguration\n => Ref Ctxt Defs\n => Ref UST UState\n => Ref Syn SyntaxInfo\n => Ref MD Metadata\n => Ref ROpts REPLOpts\n => InitializeParams -> URI -> Maybe Int -> Core (Either String ())\nloadIfNeeded conf uri version = do\n Just (oldUri, oldVersion) <- gets LSPConf openFile\n | Nothing => loadURI conf uri version\n if (oldUri == uri && (isNothing version || (Just oldVersion) == version))\n then pure $ Right ()\n else loadURI conf uri version\n\nwithURI : Ref LSPConf LSPConfiguration\n => Ref Ctxt Defs\n => Ref UST UState\n => Ref Syn SyntaxInfo\n => Ref MD Metadata\n => Ref ROpts REPLOpts\n => InitializeParams\n -> URI -> Maybe Int -> Core (Either ResponseError a) -> Core (Either ResponseError a) -> Core (Either ResponseError a)\nwithURI conf uri version d k = do\n False <- isError uri | _ => d\n case !(loadIfNeeded conf uri version) of\n Right () => k\n Left err =>\n pure $ Left (MkResponseError (Custom 3) err JNull)\n\n||| Guard for requests that requires a successful initialization before being allowed.\nwhenInitializedRequest : Ref LSPConf LSPConfiguration => (InitializeParams -> Core (Either ResponseError a)) -> Core (Either ResponseError a)\nwhenInitializedRequest k =\n case !(gets LSPConf initialized) of\n Just conf => k conf\n Nothing => pure $ Left $ serverNotInitialized\n\n||| Guard for requests that cannot be sent after the shutdown protocol.\nwhenNotShutdownRequest : Ref LSPConf LSPConfiguration => Core (Either ResponseError a) -> Core (Either ResponseError a)\nwhenNotShutdownRequest k =\n if !(gets LSPConf isShutdown)\n then pure $ Left $ (invalidRequest \"Server has been shutdown\")\n else k\n\n||| whenInitializedRequest + whenNotShutdownRequest\nwhenActiveRequest : Ref LSPConf LSPConfiguration => (InitializeParams -> Core (Either ResponseError a)) -> Core (Either ResponseError a)\nwhenActiveRequest = whenNotShutdownRequest . whenInitializedRequest\n\n||| Guard for notifications that requires a successful initialization before being allowed.\nwhenInitializedNotification : Ref LSPConf LSPConfiguration => (InitializeParams -> Core ()) -> Core ()\nwhenInitializedNotification k =\n case !(gets LSPConf initialized) of\n Just conf => k conf\n Nothing => sendUnknownResponseMessage $ serverNotInitialized\n\n||| Guard for notifications that cannot be sent after the shutdown protocol.\nwhenNotShutdownNotification : Ref LSPConf LSPConfiguration => Core () -> Core ()\nwhenNotShutdownNotification k =\n if !(gets LSPConf isShutdown)\n then sendUnknownResponseMessage $ (invalidRequest \"Server has been shutdown\")\n else k\n\n||| whenInitializedNotification + whenNotShutdownNotification\nwhenActiveNotification : Ref LSPConf LSPConfiguration => (InitializeParams -> Core ()) -> Core ()\nwhenActiveNotification = whenNotShutdownNotification . whenInitializedNotification\n\nexport\nhandleRequest :\n Ref LSPConf LSPConfiguration\n => Ref Ctxt Defs\n => Ref UST UState\n => Ref Syn SyntaxInfo\n => Ref MD Metadata\n => Ref ROpts REPLOpts\n => (method : Method Client Request)\n -> (params : MessageParams method)\n -> Core (Either ResponseError (ResponseResult method))\n\nhandleRequest Initialize params = do\n -- TODO: Here we should analyze the client capabilities.\n\n case params.initializationOptions of\n Just (JObject xs) => do\n case lookup \"logFile\" xs of\n Just (JString fname) => changeLogFile fname\n Just _ => logString Error \"Incorrect type for log file location, expected string\"\n Nothing => pure ()\n case lookup \"longActionTimeout\" xs of\n Just (JNumber v) => do\n let n = 1000000 * cast v\n let scale = 1000000000\n let seconds = n `div` scale\n let nanoseconds = n `mod` scale\n modify LSPConf (record {longActionTimeout = makeDuration seconds nanoseconds})\n Just _ => logString Error \"Incorrect type for long action timeout, expected number\"\n Nothing => pure ()\n Just _ => logString Error \"Incorrect type for initialization options\"\n Nothing => pure ()\n\n modify LSPConf (record {initialized = Just params})\n pure $ pure $ MkInitializeResult serverCapabilities (Just serverInfo)\n\nhandleRequest Shutdown params = do\n -- In a future multithreaded model, we must guarantee that all pending request are still executed.\n update LSPConf (record {isShutdown = True})\n pure $ pure $ (the (Maybe Null) Nothing)\n\nhandleRequest TextDocumentHover params = whenActiveRequest $ \\conf => do\n False <- isDirty params.textDocument.uri\n | True => pure $ pure $ make $ MkNull\n withURI conf params.textDocument.uri Nothing (pure $ pure $ make $ MkNull) $ do\n Nothing <- gets LSPConf (map snd . head' . searchPos (cast params.position) . cachedHovers)\n | Just hover => do logString Debug \"hover: found cached action\"\n pure $ pure $ make hover\n\n defs <- get Ctxt\n nameLocs <- gets MD nameLocMap\n\n let Just (loc, name) = findPointInTreeLoc (params.position.line, params.position.character) nameLocs\n | Nothing => pure $ pure $ (make $ MkHover (make $ MkMarkupContent PlainText \"\") Nothing)\n -- Lookup the name globally\n globals <- lookupCtxtName name (gamma defs)\n globalResult <- the (Core $ Maybe $ Doc IdrisAnn) $ case globals of\n [] => pure Nothing\n ts => do tys <- traverse (displayType defs) ts\n pure $ Just (vsep tys)\n localResult <- findTypeAt $ anyWithName name $ within (params.position.line, params.position.character)\n line <- case (globalResult, localResult) of\n -- Give precedence to the local name, as it shadows the others\n (_, Just (n, _, type)) => pure $ renderString $ unAnnotateS $ layoutUnbounded $ pretty (nameRoot n) <++> colon <++> !(displayTerm defs type)\n (Just globalDoc, Nothing) => pure $ renderString $ unAnnotateS $ layoutUnbounded globalDoc\n (Nothing, Nothing) => pure \"\"\n let supportsMarkup = maybe False (Markdown `elem`) $ conf.capabilities.textDocument >>= .hover >>= .contentFormat\n let markupContent = the MarkupContent $ if supportsMarkup then MkMarkupContent Markdown $ \"```idris\\n\" ++ line ++ \"\\n```\" else MkMarkupContent PlainText line\n let hover = MkHover (make markupContent) Nothing\n modify LSPConf (record { cachedHovers $= insert (cast loc, hover) })\n pure $ pure (make hover)\n\nhandleRequest TextDocumentDefinition params = whenActiveRequest $ \\conf => do\n False <- isDirty params.textDocument.uri\n | True => pure $ pure $ make $ MkNull\n withURI conf params.textDocument.uri Nothing (pure $ pure $ make $ MkNull) $ do\n Just link <- gotoDefinition params | Nothing => pure $ pure $ make MkNull\n pure $ pure $ make link\n\nhandleRequest TextDocumentCodeAction params = whenActiveRequest $ \\conf => do\n False <- isDirty params.textDocument.uri\n | True => pure $ pure $ make $ MkNull\n withURI conf params.textDocument.uri Nothing (pure $ pure $ make $ MkNull) $ do\n quickfixActions <- map Just <$> gets LSPConf quickfixes\n exprSearchAction <- map Just <$> exprSearch params\n splitAction <- caseSplit params\n lemmaAction <- makeLemma params\n withAction <- makeWith params\n clauseAction <- addClause params\n makeCaseAction <- handleMakeCase params\n generateDefAction <- map Just <$> generateDef params\n let resp = flatten $ quickfixActions\n ++ [splitAction, lemmaAction, withAction, clauseAction, makeCaseAction]\n ++ generateDefAction ++ exprSearchAction\n pure $ pure $ make resp\n where\n flatten : List (Maybe CodeAction) -> List (OneOf [Command, CodeAction])\n flatten [] = []\n flatten (Nothing :: xs) = flatten xs\n flatten ((Just x) :: xs) = make x :: flatten xs\n\nhandleRequest TextDocumentSignatureHelp params = whenActiveRequest $ \\conf => do\n False <- isDirty params.textDocument.uri\n | True => pure $ pure $ make $ MkNull\n withURI conf params.textDocument.uri Nothing (pure $ pure $ make $ MkNull) $ do\n Just signatureHelpData <- signatureHelp params | Nothing => pure $ pure $ make MkNull\n pure $ pure $ make signatureHelpData\n\nhandleRequest TextDocumentDocumentSymbol params = whenActiveRequest $ \\conf => do\n False <- isDirty params.textDocument.uri\n | True => pure $ pure $ make $ MkNull\n withURI conf params.textDocument.uri Nothing (pure $ pure $ make $ MkNull) $ do\n documentSymbolData <- documentSymbol params\n pure $ pure $ make documentSymbolData\n\nhandleRequest TextDocumentCodeLens params = whenActiveRequest $ \\conf =>\n pure $ pure $ make MkNull\n\nhandleRequest TextDocumentCompletion params = whenActiveRequest $ \\conf =>\n pure $ pure $ make MkNull\n\nhandleRequest TextDocumentDocumentLink params = whenActiveRequest $ \\conf =>\n pure $ pure $ make MkNull\n\nhandleRequest TextDocumentSemanticTokensFull params = whenActiveRequest $ \\conf => do\n False <- isDirty params.textDocument.uri\n | True => pure $ Left (MkResponseError RequestCancelled \"Document Dirty\" JNull)\n False <- gets LSPConf (contains params.textDocument.uri . semanticTokensSentFiles)\n | True => pure $ Left (MkResponseError RequestCancelled \"Semantic tokens already sent\" JNull)\n withURI conf params.textDocument.uri Nothing (pure $ Left (MkResponseError RequestCancelled \"Document Errors\" JNull)) $ do\n md <- get MD\n src <- getSource\n let srcLines = forget $ lines src\n let getLineLength = \\lineNum => maybe 0 (cast . length) $ elemAt srcLines (integerToNat (cast lineNum))\n let tokens = getSemanticTokens md getLineLength\n modify LSPConf (record { semanticTokensSentFiles $= insert params.textDocument.uri })\n pure $ pure $ (make $ tokens)\n\nhandleRequest method params = whenActiveRequest $ \\conf => do\n logString Warning $ \"received a not supported \\{show (toJSON method)} request\"\n pure $ Left methodNotFound\n\nexport\nhandleNotification :\n Ref LSPConf LSPConfiguration\n => Ref Ctxt Defs\n => Ref UST UState\n => Ref Syn SyntaxInfo\n => Ref MD Metadata\n => Ref ROpts REPLOpts\n => (method : Method Client Notification)\n -> (params : MessageParams method)\n -> Core ()\n\nhandleNotification Exit params = do\n let status = if !(gets LSPConf isShutdown) then ExitSuccess else ExitFailure 1\n coreLift $ exitWith status\n\nhandleNotification TextDocumentDidOpen params = whenActiveNotification $ \\conf =>\n ignore $ loadURI conf params.textDocument.uri (Just params.textDocument.version)\n\nhandleNotification TextDocumentDidSave params = whenActiveNotification $ \\conf => do\n modify LSPConf (record\n { dirtyFiles $= delete params.textDocument.uri\n , errorFiles $= delete params.textDocument.uri\n , semanticTokensSentFiles $= delete params.textDocument.uri\n })\n ignore $ loadURI conf params.textDocument.uri Nothing\n when (fromMaybe False $ conf.capabilities.workspace >>= semanticTokens >>= refreshSupport) $\n sendRequestMessage_ WorkspaceSemanticTokensRefresh Nothing\n\nhandleNotification TextDocumentDidChange params = whenActiveNotification $ \\conf => do\n modify LSPConf (record { dirtyFiles $= insert params.textDocument.uri })\n\nhandleNotification TextDocumentDidClose params = whenActiveNotification $ \\conf => do\n modify LSPConf (record { openFile = Nothing\n , quickfixes = []\n , cachedActions = empty\n , cachedHovers = empty\n , dirtyFiles $= delete params.textDocument.uri\n , errorFiles $= delete params.textDocument.uri\n , semanticTokensSentFiles $= delete params.textDocument.uri\n })\n logString Info $ \"File \\{params.textDocument.uri.path} closed\"\n\nhandleNotification method params = whenActiveNotification $ \\conf =>\n logString Warning \"unhandled notification\"\n","avg_line_length":44.1277173913,"max_line_length":163,"alphanum_fraction":0.6815690621} +{"size":7419,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"module Decidable.Equality\n\nimport Data.Maybe\nimport Data.Either\nimport Data.Nat\nimport Data.List\n\n%default total\n\n--------------------------------------------------------------------------------\n-- Decidable equality\n--------------------------------------------------------------------------------\n\n||| Decision procedures for propositional equality\npublic export\ninterface DecEq t where\n ||| Decide whether two elements of `t` are propositionally equal\n decEq : (x1 : t) -> (x2 : t) -> Dec (x1 = x2)\n\n--------------------------------------------------------------------------------\n-- Utility lemmas\n--------------------------------------------------------------------------------\n\n||| The negation of equality is symmetric (follows from symmetry of equality)\nexport\nnegEqSym : forall a, b . (a = b -> Void) -> (b = a -> Void)\nnegEqSym p h = p (sym h)\n\n||| Everything is decidably equal to itself\nexport\ndecEqSelfIsYes : DecEq a => {x : a} -> decEq x x = Yes Refl\ndecEqSelfIsYes {x} with (decEq x x)\n decEqSelfIsYes {x} | Yes Refl = Refl\n decEqSelfIsYes {x} | No contra = absurd $ contra Refl\n\n--------------------------------------------------------------------------------\n--- Unit\n--------------------------------------------------------------------------------\n\nexport\nDecEq () where\n decEq () () = Yes Refl\n\n--------------------------------------------------------------------------------\n-- Booleans\n--------------------------------------------------------------------------------\n\nexport\nDecEq Bool where\n decEq True True = Yes Refl\n decEq False False = Yes Refl\n decEq False True = No absurd\n decEq True False = No absurd\n\n--------------------------------------------------------------------------------\n-- Nat\n--------------------------------------------------------------------------------\n\nexport\nDecEq Nat where\n decEq Z Z = Yes Refl\n decEq Z (S _) = No absurd\n decEq (S _) Z = No absurd\n decEq (S n) (S m) with (decEq n m)\n decEq (S n) (S m) | Yes p = Yes $ cong S p\n decEq (S n) (S m) | No p = No $ \\h : (S n = S m) => p $ succInjective n m h\n\n--------------------------------------------------------------------------------\n-- Maybe\n--------------------------------------------------------------------------------\n\nexport\nDecEq t => DecEq (Maybe t) where\n decEq Nothing Nothing = Yes Refl\n decEq Nothing (Just _) = No absurd\n decEq (Just _) Nothing = No absurd\n decEq (Just x') (Just y') with (decEq x' y')\n decEq (Just x') (Just y') | Yes p = Yes $ cong Just p\n decEq (Just x') (Just y') | No p\n = No $ \\h : Just x' = Just y' => p $ justInjective h\n\n--------------------------------------------------------------------------------\n-- Either\n--------------------------------------------------------------------------------\n\nUninhabited (Left x = Right y) where\n uninhabited Refl impossible\n\nUninhabited (Right x = Left y) where\n uninhabited Refl impossible\n\nexport\n(DecEq t, DecEq s) => DecEq (Either t s) where\n decEq (Left x) (Left y) with (decEq x y)\n decEq (Left x) (Left x) | Yes Refl = Yes Refl\n decEq (Left x) (Left y) | No contra = No (contra . leftInjective)\n decEq (Left x) (Right y) = No absurd\n decEq (Right x) (Left y) = No absurd\n decEq (Right x) (Right y) with (decEq x y)\n decEq (Right x) (Right x) | Yes Refl = Yes Refl\n decEq (Right x) (Right y) | No contra = No (contra . rightInjective)\n\n--------------------------------------------------------------------------------\n-- Tuple\n--------------------------------------------------------------------------------\n\npairInjective : (a, b) = (c, d) -> (a = c, b = d)\npairInjective Refl = (Refl, Refl)\n\nexport\n(DecEq a, DecEq b) => DecEq (a, b) where\n decEq (a, b) (a', b') with (decEq a a')\n decEq (a, b) (a', b') | (No contra) =\n No $ contra . fst . pairInjective\n decEq (a, b) (a, b') | (Yes Refl) with (decEq b b')\n decEq (a, b) (a, b) | (Yes Refl) | (Yes Refl) = Yes Refl\n decEq (a, b) (a, b') | (Yes Refl) | (No contra) =\n No $ contra . snd . pairInjective\n\n--------------------------------------------------------------------------------\n-- List\n--------------------------------------------------------------------------------\n\nexport\nDecEq a => DecEq (List a) where\n decEq [] [] = Yes Refl\n decEq (x :: xs) [] = No absurd\n decEq [] (x :: xs) = No absurd\n decEq (x :: xs) (y :: ys) with (decEq x y)\n decEq (x :: xs) (y :: ys) | No contra =\n No $ contra . fst . consInjective\n decEq (x :: xs) (x :: ys) | Yes Refl with (decEq xs ys)\n decEq (x :: xs) (x :: xs) | (Yes Refl) | (Yes Refl) = Yes Refl\n decEq (x :: xs) (x :: ys) | (Yes Refl) | (No contra) =\n No $ contra . snd . consInjective\n\n-- TODO: Other prelude data types\n\n-- For the primitives, we have to cheat because we don't have access to their\n-- internal implementations. We use believe_me for the inequality proofs\n-- because we don't them to reduce (and they should never be needed anyway...)\n-- A postulate would be better, but erasure analysis may think they're needed\n-- for computation in a higher order setting.\n\n\n--------------------------------------------------------------------------------\n-- Int\n--------------------------------------------------------------------------------\nexport\nimplementation DecEq Int where\n decEq x y = case x == y of -- Blocks if x or y not concrete\n True => Yes primitiveEq\n False => No primitiveNotEq\n where primitiveEq : forall x, y . x = y\n primitiveEq = believe_me (Refl {x})\n primitiveNotEq : forall x, y . x = y -> Void\n primitiveNotEq prf = believe_me {b = Void} ()\n\n--------------------------------------------------------------------------------\n-- Char\n--------------------------------------------------------------------------------\nexport\nimplementation DecEq Char where\n decEq x y = case x == y of -- Blocks if x or y not concrete\n True => Yes primitiveEq\n False => No primitiveNotEq\n where primitiveEq : forall x, y . x = y\n primitiveEq = believe_me (Refl {x})\n primitiveNotEq : forall x, y . x = y -> Void\n primitiveNotEq prf = believe_me {b = Void} ()\n\n--------------------------------------------------------------------------------\n-- Integer\n--------------------------------------------------------------------------------\nexport\nimplementation DecEq Integer where\n decEq x y = case x == y of -- Blocks if x or y not concrete\n True => Yes primitiveEq\n False => No primitiveNotEq\n where primitiveEq : forall x, y . x = y\n primitiveEq = believe_me (Refl {x})\n primitiveNotEq : forall x, y . x = y -> Void\n primitiveNotEq prf = believe_me {b = Void} ()\n\n--------------------------------------------------------------------------------\n-- String\n--------------------------------------------------------------------------------\nexport\nimplementation DecEq String where\n decEq x y = case x == y of -- Blocks if x or y not concrete\n True => Yes primitiveEq\n False => No primitiveNotEq\n where primitiveEq : forall x, y . x = y\n primitiveEq = believe_me (Refl {x})\n primitiveNotEq : forall x, y . x = y -> Void\n primitiveNotEq prf = believe_me {b = Void} ()\n","avg_line_length":37.6598984772,"max_line_length":80,"alphanum_fraction":0.4256638361} +{"size":2481,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"module Data.IOArray\n\nimport Data.IOArray.Prims\nimport Data.List\n\n%default total\n\nexport\nrecord IOArray elem where\n constructor MkIOArray\n maxSize : Int\n content : ArrayData (Maybe elem)\n\nexport\nmax : IOArray elem -> Int\nmax = maxSize\n\nexport\nnewArray : HasIO io => Int -> io (IOArray elem)\nnewArray size\n = pure (MkIOArray size !(primIO (prim__newArray size Nothing)))\n\nexport\nwriteArray : HasIO io => IOArray elem -> Int -> elem -> io Bool\nwriteArray arr pos el\n = if pos < 0 || pos >= max arr\n then pure False\n else do primIO (prim__arraySet (content arr) pos (Just el))\n pure True\n\nexport\nreadArray : HasIO io => IOArray elem -> Int -> io (Maybe elem)\nreadArray arr pos\n = if pos < 0 || pos >= max arr\n then pure Nothing\n else primIO (prim__arrayGet (content arr) pos)\n\n-- Make a new array of the given size with the elements copied from the\n-- other array\nexport\nnewArrayCopy : HasIO io =>\n (newsize : Int) -> IOArray elem -> io (IOArray elem)\nnewArrayCopy newsize arr\n = do let newsize' = if newsize < max arr then max arr else newsize\n arr' <- newArray newsize'\n copyFrom (content arr) (content arr') (max arr - 1)\n pure arr'\n where\n copyFrom : ArrayData (Maybe elem) ->\n ArrayData (Maybe elem) ->\n Int -> io ()\n copyFrom old new pos\n = if pos < 0\n then pure ()\n else do el <- primIO $ prim__arrayGet old pos\n primIO $ prim__arraySet new pos el\n copyFrom old new $ assert_smaller pos (pos - 1)\n\nexport\ntoList : HasIO io => IOArray elem -> io (List (Maybe elem))\ntoList arr = iter 0 (max arr) []\n where\n iter : Int -> Int -> List (Maybe elem) -> io (List (Maybe elem))\n iter pos end acc\n = if pos >= end\n then pure (reverse acc)\n else do el <- readArray arr pos\n assert_total (iter (pos + 1) end (el :: acc))\n\nexport\nfromList : HasIO io => List (Maybe elem) -> io (IOArray elem)\nfromList ns\n = do arr <- newArray (cast (length ns))\n addToArray 0 ns arr\n pure arr\n where\n addToArray : Int -> List (Maybe elem) -> IOArray elem -> io ()\n addToArray loc [] arr = pure ()\n addToArray loc (Nothing :: ns) arr = addToArray (loc + 1) ns arr\n addToArray loc (Just el :: ns) arr\n = do primIO $ prim__arraySet (content arr) loc (Just el)\n addToArray (loc + 1) ns arr\n","avg_line_length":29.8915662651,"max_line_length":71,"alphanum_fraction":0.5981459089} +{"size":9491,"ext":"idr","lang":"Idris","max_stars_count":4.0,"content":"module NatProps\n\nimport Basic\nimport Unit\nimport Void\nimport Coproduct\nimport Nat\nimport Sigma\nimport Path\nimport CoproductProps\nimport PreorderReasoning\nimport General\nimport Dec\n\n%default total\n\nNegN : (n : Nat) -> Type -> Type\nNegN Z p = p\nNegN (S k) p = Neg (NegN k p)\n\ndni : p -> NegN N.two p\ndni a u = u a\n\ncontrapositive : (a -> b) -> (Neg b -> Neg a)\ncontrapositive f v a = v (f a)\n\ntno : NegN N.three p -> Neg p\ntno = contrapositive dni\n\nabsurdityX3IsAbsurdity : {p : _} -> NegN N.three p <=> Neg p\nabsurdityX3IsAbsurdity = firstly # secondly\n where\n firstly : NegN N.three p -> Neg p\n firstly = tno\n\n secondly : Neg p -> NegN N.three p\n secondly = dni\n\nPositiveNotZero : (x : Nat) -> S x \/= Z\n-- p : S x == Z\nPositiveNotZero x p = UnitNotVoid (g p)\n where\n f : Nat -> Type\n f Z = Void\n f (S _) = Unit\n\n g : S x == Z -> Unit == Void\n g = ap f\n\npred : Nat -> Nat\npred Z = Z\npred (S k) = k\n\nSuccLeftCancel : {x, y : _} -> S x == S y -> x == y\nSuccLeftCancel = ap pred\n\nNatNotSuccNat : (x : Nat) -> x \/= S x\nNatNotSuccNat Z = negSym (PositiveNotZero Z)\nNatNotSuccNat (S k) = let r = NatNotSuccNat k in \\l =>\n r (SuccLeftCancel l)\n\n-- Proof that Nat has decidable equality.\n-- Doesn't use pattern matching.\n-- OMG\n-- You'll never know the true value of pattern matching\n-- until you are left without it (as an exercise).\nnamespace NatDec\n Lemma0 : {x, y : _} -> x == y -> (S x \/= y)\n Lemma0 p = J (\\x, y, _ => (S x \/= y))\n (\\x => negSym (NatNotSuccNat x)) x y p\n\n Lemma1 : {x, y : _} -> Dec (x == y) -> Dec (S x == S y)\n Lemma1 = SumInduction (const $ Dec (S x == S y))\n (\\p => Inl (ap S p))\n (\\p => Inr (\\l => p (SuccLeftCancel l)))\n\n export\n NatDecEq : DecEq Nat\n NatDecEq x y = NatInduction (\\x => (y : Nat) -> (x == y) + (x \/= y))\n -- p0 : (y : Nat) -> (Z == y) + (Z \/= y)\n (\\y => (NatInduction (\\y => (Z == y) + (Z \/= y))\n -- p0\n (Inl $ Refl Z)\n -- pn\n (\\y, _ => Inr (negSym $ PositiveNotZero y))\n --n\n y))\n -- pn : (x : Nat) -> (y : Nat) -> (S x == y) + (S x \/= y)\n -- hyp : Dec (x == y)\n (\\x, hyp, y =>\n NatInduction (\\y => (S x == y) + (S x \/= y))\n --p0\n (Inr (PositiveNotZero x))\n --pn\n (\\y, _ => Lemma1 $ hyp y)\n --n\n y)\n x y\n\nplusAssoc : (x, y, z : Nat) -> (x + y) + z == x + (y + z)\nplusAssoc Z y z = Chain $ || (Z + y) + z\n |=> Z + (y + z) ...(Refl _)\nplusAssoc (S x) y z = Chain $ || (S x + y) + z\n |=> S ((x + y) + z) ...(Refl _)\n |=> S (x + (y + z)) ...(ap S $ plusAssoc x y z)\n |=> (S x + (y + z)) ...(Refl _)\n\nBaseOnRight : (x : Nat) -> x + Z == x\nBaseOnRight Z = Refl _\nBaseOnRight (S x) = ap S (BaseOnRight x)\n\nStepOnRight : (x, y : Nat) -> x + S y == S (x + y)\n-- goal : S y == S (Z + y)\nStepOnRight Z y = Refl _\n-- goal : S (x + S y) == S (S (x + y))\nStepOnRight (S x) y = Chain $ || S (x + S y)\n |=> S (S (x + y)) ...(ap S $ StepOnRight x y)\n\nPlusComm : (x, y : Nat) -> x + y == y + x\nPlusComm x Z = BaseOnRight x\n-- goal : x + S y == S (y + x)\nPlusComm x (S y) = Chain $ || x + S y\n |=> S (x + y) ...(StepOnRight x y)\n |=> S (y + x) ...(ap S $ PlusComm x y)\n\nOnLhs : {x, y, z : _} -> x == z -> x == y -> z == y\nOnLhs p q = sym p . q\n\nOnRhs : {x, y, z : _} -> y == z -> x == y -> x == z\nOnRhs p q = q . p\n\nPlusRightCancel : (x, y, z : Nat) -> x + y == z + y -> x == z\n-- goal : x == z\n-- prf : x + Z == z + Z\nPlusRightCancel x Z z prf = Chain $ || x\n |=> x + Z ...(sym $ BaseOnRight x)\n |=> z + Z ...prf\n |=> z ...(BaseOnRight z)\n-- goal : x == z\n-- prf : x + S y == z + S y\n-- prf' : TypeOf prf -> x + y == z + y\n-- hyp : x + y == z + y -> x == z\nPlusRightCancel x (S y) z prf =\n let prf' =\n Chain $ || x + S y == z + S y\n |=> S (x + y) == z + S y ...(OnLhs $ StepOnRight x y)\n |=> S (x + y) == S (z + y) ...(OnRhs $ StepOnRight z y)\n |=> x + y == z + y ...SuccLeftCancel\n $\n prf\n in PlusRightCancel x y z prf'\n\n||| Alternative definition of non-strict inequality.\nLte' : Nat -> Nat -> Type\nLte' x y = Sigma Nat (\\z => z + x == y)\n\nLteImpliesLte' : (x, y : Nat) -> x <= y -> Lte' x y\nLteImpliesLte' Z y _ = y # (Chain $ || y + Z\n |=> Z + y ...(PlusComm y Z))\nLteImpliesLte' (S _) Z l = VoidRecursion _ l\n-- prf : z + x == y\n-- goal : z + S x == S y\nLteImpliesLte' (S x) (S y) l = let z # prf = LteImpliesLte' x y l in\n let prf' = Chain $ || z + x == y\n |=> x + z == y ...(OnLhs $ PlusComm z x)\n |=> S x + z == S y ...(ap S)\n |=> z + S x == S y ...(OnLhs $ PlusComm (S x) z)\n $ prf\n in z # prf'\n\nLte'ImpliesLte : (x, y : Nat) -> Lte' x y -> x <= y\nLte'ImpliesLte Z _ _ = ()\nLte'ImpliesLte (S x) Z (z # contra) =\n let contra' = OnLhs (PlusComm z (S x)) contra in\n let p = PositiveNotZero (x + z) in\n p contra'\nLte'ImpliesLte (S x) (S y) (z # prf) =\n let prf' = Chain $ || z + S x == S y\n |=> S x + z == S y ...(OnLhs $ PlusComm z (S x))\n |=> x + z == y ...(ap pred)\n |=> z + x == y ...(OnLhs $ PlusComm x z)\n $ prf in\n Lte'ImpliesLte x y (z # prf')\n\nLogicallyEqualivalentLte : (x, y : Nat) -> x <= y <=> Lte' x y\nLogicallyEqualivalentLte x y = LteImpliesLte' x y\n # Lte'ImpliesLte x y\n\nLteRefl : (n : Nat) -> n <= n\nLteRefl Z = ()\nLteRefl (S n) = LteRefl n\n\nLteTrans : (l, m, n : Nat) -> l <= m -> m <= n -> l <= n\nLteTrans Z m n q p = ()\nLteTrans (S l) Z n q p = VoidRecursion _ q\nLteTrans (S l) (S m) Z q p = VoidRecursion _ p\nLteTrans (S l) (S m) (S n) q p = LteTrans l m n q p\n\nLteAnti : (m, n : Nat) -> m <= n -> n <= m -> m == n\nLteAnti Z Z q p = Refl Z\nLteAnti (S m) Z q p = VoidRecursion _ q\nLteAnti Z (S n) q p = VoidRecursion _ p\nLteAnti (S m) (S n) q p = ap S $ LteAnti m n q p\n\nLteSucc : (n : Nat) -> n <= S n\nLteSucc Z = ()\nLteSucc (S n) = LteSucc n\n\nZeroMinimal : (n : Nat) -> Z <= n\nZeroMinimal _ = ()\n\nUniqueMinimal : (n : Nat) -> n <= Z -> n == Z\nUniqueMinimal Z p = Refl Z\nUniqueMinimal (S n) p = VoidRecursion _ p\n\nLteSplit : (m, n : Nat) -> m <= S n -> (m <= n) + (m == S n)\nLteSplit Z n p = Inl ()\nLteSplit (S m) Z p with (UniqueMinimal _ p)\n LteSplit (S Z) Z p | Refl _ = Inr (Refl (S Z))\nLteSplit (S m) (S n) p = let H = LteSplit m n p in\n case H of\n Inl p => Inl p\n Inr p => Inr (ap S p)\n\nLteSplit' : (m, n : Nat) -> m <= n -> (S m <= n) + (m == n)\nLteSplit' Z Z p = Inr (Refl Z)\nLteSplit' Z (S n) p = Inl ()\nLteSplit' (S m) Z p = VoidRecursion _ p\nLteSplit' (S m) (S n) p =\n case LteSplit' m n p of\n Inl x => Inl x\n Inr x => Inr (ap S x)\n\n\ninfixl 1 <\n\n(<) : Nat -> Nat -> Type\nx < y = S x <= y\n\nNotLtGivesLte : (m, n : Nat) -> Neg (n < m) -> m <= n\nNotLtGivesLte Z n _ = ()\nNotLtGivesLte (S m) Z p = p ()\nNotLtGivesLte (S m) (S n) p = NotLtGivesLte m n p\n\nBoundedForallNext : (p : Nat -> Type)\n -> (k : Nat)\n -> p k\n -> ((n : Nat) -> n < k -> p n)\n -> (n : Nat) -> n < S k -> p n\nBoundedForallNext p k pk f n l with (LteSplit' n k l)\n BoundedForallNext p k pk f n l | Inl prf = f n prf\n BoundedForallNext p k pk f k l | Inr (Refl _) = pk\n\n||| The type of roots of a function.\nRoot : (Nat -> Nat) -> Type\nRoot f = Sigma Nat (\\n => f n == Z)\n\nHasNoRootLt : (Nat -> Nat) -> Nat -> Type\nHasNoRootLt f k = (n : Nat) -> n < k -> f n \/= Z\n\nIsMinimalRoot : (Nat -> Nat) -> Nat -> Type\nIsMinimalRoot f m = Pair (f m == Z) (f `HasNoRootLt` m)\n\nAtMostOneMinimalRoot : (f : Nat -> Nat)\n -> (m, n : Nat)\n -> IsMinimalRoot f m\n -> IsMinimalRoot f n\n -> m == n\n-- prfm : forall n. n < m -> f n == Z -> Void\n-- prfn : forall m. m < n -> f m == Z -> Void\nAtMostOneMinimalRoot f m n (rm # prfm) (rn # prfn) = c _ _ a b\n where\n a : Neg (m < n)\n a contra = prfn m contra rm\n\n b : Neg (n < m)\n b contra = prfm n contra rn\n\n c : (m, n : Nat) -> Neg (m < n) -> Neg (n < m) -> m == n\n c m n q q' = LteAnti m n (NotLtGivesLte _ _ q') (NotLtGivesLte _ _ q)\n\nMinimalRoot : (Nat -> Nat) -> Type\nMinimalRoot f = Sigma Nat (IsMinimalRoot f)\n\nMinimalRootIsRoot : MinimalRoot f -> Root f\nMinimalRootIsRoot (r # prf # _) = r # prf\n\nBoundedNatSearch : (k, f : _) -> MinimalRoot f + (f `HasNoRootLt` k)\nBoundedNatSearch Z f = Inr (\\_, v, _ => v)\nBoundedNatSearch (S k) f = SumRecursion _ Inl y\n (BoundedNatSearch k f)\n where\n A : Nat -> (Nat -> Nat) -> Type\n A k f = MinimalRoot f + (f `HasNoRootLt` k)\n\n y : f `HasNoRootLt` k -> A (S k) f\n y u = SumRecursion _ y0 y1 (NatDecEq (f k) Z)\n where\n y0 : f k == Z -> A (S k) f\n y0 p = Inl (k # p # u)\n\n y1 : f k \/= Z -> A (S k) f\n y1 v = Inr (BoundedForallNext (\\n => f n \/= Z) k v u)\n\nRightFailsGivesLeftHolds : {P, Q : Type} -> P + Q -> Neg Q -> P\nRightFailsGivesLeftHolds (Inl p) u = p\nRightFailsGivesLeftHolds (Inr q) u = VoidRecursion _ (u q)\n\nRootGivesMinimalRoot : (f : _) -> Root f -> MinimalRoot f\nRootGivesMinimalRoot f (n # p) = y\n where\n g : Neg (f `HasNoRootLt` S n)\n g phi = phi n (LteRefl n) p\n\n y : MinimalRoot f\n y = RightFailsGivesLeftHolds (BoundedNatSearch (S n) f) g\n\n","avg_line_length":29.8459119497,"max_line_length":76,"alphanum_fraction":0.4846696871} +{"size":300,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"module Main\n\nimport Data.String\n\n-- Test, that Scheme-dependent builtins are correctly blacklisted\/overridden\n\nmain : IO ()\nmain = do\n putStrLn $ fastPack ['a', 'b', 'c']\n putStrLn $ fastConcat [\"first part\", \"|\", \"\", \"|\", \"END of the string\"]\n putStrLn $ fastConcat [\"last\", \"part\", \"empty\", \"\"]\n","avg_line_length":25.0,"max_line_length":76,"alphanum_fraction":0.6433333333} +{"size":14072,"ext":"idr","lang":"Idris","max_stars_count":30.0,"content":"%!PS-Adobe-2.0 EPSF-1.2\n%%Creator: idraw\n%%DocumentFonts: Helvetica\n%%Pages: 1\n%%BoundingBox: 59 512 306 652\n%%EndComments\n\n%%BeginIdrawPrologue\n\/arrowhead {\n0 begin\ntransform originalCTM itransform\n\/taily exch def\n\/tailx exch def\ntransform originalCTM itransform\n\/tipy exch def\n\/tipx exch def\n\/dy tipy taily sub def\n\/dx tipx tailx sub def\n\/angle dx 0 ne dy 0 ne or { dy dx atan } { 90 } ifelse def\ngsave\noriginalCTM setmatrix\ntipx tipy translate\nangle rotate\nnewpath\narrowHeight neg arrowWidth 2 div moveto\n0 0 lineto\narrowHeight neg arrowWidth 2 div neg lineto\npatternNone not {\noriginalCTM setmatrix\n\/padtip arrowHeight 2 exp 0.25 arrowWidth 2 exp mul add sqrt brushWidth mul\narrowWidth div def\n\/padtail brushWidth 2 div def\ntipx tipy translate\nangle rotate\npadtip 0 translate\narrowHeight padtip add padtail add arrowHeight div dup scale\narrowheadpath\nifill\n} if\nbrushNone not {\noriginalCTM setmatrix\ntipx tipy translate\nangle rotate\narrowheadpath\nistroke\n} if\ngrestore\nend\n} dup 0 9 dict put def\n\n\/arrowheadpath {\nnewpath\narrowHeight neg arrowWidth 2 div moveto\n0 0 lineto\narrowHeight neg arrowWidth 2 div neg lineto\n} def\n\n\/leftarrow {\n0 begin\ny exch get \/taily exch def\nx exch get \/tailx exch def\ny exch get \/tipy exch def\nx exch get \/tipx exch def\nbrushLeftArrow { tipx tipy tailx taily arrowhead } if\nend\n} dup 0 4 dict put def\n\n\/rightarrow {\n0 begin\ny exch get \/tipy exch def\nx exch get \/tipx exch def\ny exch get \/taily exch def\nx exch get \/tailx exch def\nbrushRightArrow { tipx tipy tailx taily arrowhead } if\nend\n} dup 0 4 dict put def\n\n%%EndIdrawPrologue\n\n\/arrowHeight 11 def\n\/arrowWidth 5 def\n\n\/IdrawDict 51 dict def\nIdrawDict begin\n\n\/reencodeISO {\ndup dup findfont dup length dict begin\n{ 1 index \/FID ne { def }{ pop pop } ifelse } forall\n\/Encoding ISOLatin1Encoding def\ncurrentdict end definefont\n} def\n\n\/ISOLatin1Encoding [\n\/.notdef\/.notdef\/.notdef\/.notdef\/.notdef\/.notdef\/.notdef\/.notdef\n\/.notdef\/.notdef\/.notdef\/.notdef\/.notdef\/.notdef\/.notdef\/.notdef\n\/.notdef\/.notdef\/.notdef\/.notdef\/.notdef\/.notdef\/.notdef\/.notdef\n\/.notdef\/.notdef\/.notdef\/.notdef\/.notdef\/.notdef\/.notdef\/.notdef\n\/space\/exclam\/quotedbl\/numbersign\/dollar\/percent\/ampersand\/quoteright\n\/parenleft\/parenright\/asterisk\/plus\/comma\/minus\/period\/slash\n\/zero\/one\/two\/three\/four\/five\/six\/seven\/eight\/nine\/colon\/semicolon\n\/less\/equal\/greater\/question\/at\/A\/B\/C\/D\/E\/F\/G\/H\/I\/J\/K\/L\/M\/N\n\/O\/P\/Q\/R\/S\/T\/U\/V\/W\/X\/Y\/Z\/bracketleft\/backslash\/bracketright\n\/asciicircum\/underscore\/quoteleft\/a\/b\/c\/d\/e\/f\/g\/h\/i\/j\/k\/l\/m\n\/n\/o\/p\/q\/r\/s\/t\/u\/v\/w\/x\/y\/z\/braceleft\/bar\/braceright\/asciitilde\n\/.notdef\/.notdef\/.notdef\/.notdef\/.notdef\/.notdef\/.notdef\/.notdef\n\/.notdef\/.notdef\/.notdef\/.notdef\/.notdef\/.notdef\/.notdef\/.notdef\n\/.notdef\/dotlessi\/grave\/acute\/circumflex\/tilde\/macron\/breve\n\/dotaccent\/dieresis\/.notdef\/ring\/cedilla\/.notdef\/hungarumlaut\n\/ogonek\/caron\/space\/exclamdown\/cent\/sterling\/currency\/yen\/brokenbar\n\/section\/dieresis\/copyright\/ordfeminine\/guillemotleft\/logicalnot\n\/hyphen\/registered\/macron\/degree\/plusminus\/twosuperior\/threesuperior\n\/acute\/mu\/paragraph\/periodcentered\/cedilla\/onesuperior\/ordmasculine\n\/guillemotright\/onequarter\/onehalf\/threequarters\/questiondown\n\/Agrave\/Aacute\/Acircumflex\/Atilde\/Adieresis\/Aring\/AE\/Ccedilla\n\/Egrave\/Eacute\/Ecircumflex\/Edieresis\/Igrave\/Iacute\/Icircumflex\n\/Idieresis\/Eth\/Ntilde\/Ograve\/Oacute\/Ocircumflex\/Otilde\/Odieresis\n\/multiply\/Oslash\/Ugrave\/Uacute\/Ucircumflex\/Udieresis\/Yacute\n\/Thorn\/germandbls\/agrave\/aacute\/acircumflex\/atilde\/adieresis\n\/aring\/ae\/ccedilla\/egrave\/eacute\/ecircumflex\/edieresis\/igrave\n\/iacute\/icircumflex\/idieresis\/eth\/ntilde\/ograve\/oacute\/ocircumflex\n\/otilde\/odieresis\/divide\/oslash\/ugrave\/uacute\/ucircumflex\/udieresis\n\/yacute\/thorn\/ydieresis\n] def\n\/Helvetica reencodeISO def\n\n\/none null def\n\/numGraphicParameters 17 def\n\/stringLimit 65535 def\n\n\/Begin {\nsave\nnumGraphicParameters dict begin\n} def\n\n\/End {\nend\nrestore\n} def\n\n\/SetB {\ndup type \/nulltype eq {\npop\nfalse \/brushRightArrow idef\nfalse \/brushLeftArrow idef\ntrue \/brushNone idef\n} {\n\/brushDashOffset idef\n\/brushDashArray idef\n0 ne \/brushRightArrow idef\n0 ne \/brushLeftArrow idef\n\/brushWidth idef\nfalse \/brushNone idef\n} ifelse\n} def\n\n\/SetCFg {\n\/fgblue idef\n\/fggreen idef\n\/fgred idef\n} def\n\n\/SetCBg {\n\/bgblue idef\n\/bggreen idef\n\/bgred idef\n} def\n\n\/SetF {\n\/printSize idef\n\/printFont idef\n} def\n\n\/SetP {\ndup type \/nulltype eq {\npop true \/patternNone idef\n} {\ndup -1 eq {\n\/patternGrayLevel idef\n\/patternString idef\n} {\n\/patternGrayLevel idef\n} ifelse\nfalse \/patternNone idef\n} ifelse\n} def\n\n\/BSpl {\n0 begin\nstorexyn\nnewpath\nn 1 gt {\n0 0 0 0 0 0 1 1 true subspline\nn 2 gt {\n0 0 0 0 1 1 2 2 false subspline\n1 1 n 3 sub {\n\/i exch def\ni 1 sub dup i dup i 1 add dup i 2 add dup false subspline\n} for\nn 3 sub dup n 2 sub dup n 1 sub dup 2 copy false subspline\n} if\nn 2 sub dup n 1 sub dup 2 copy 2 copy false subspline\npatternNone not brushLeftArrow not brushRightArrow not and and { ifill } if\nbrushNone not { istroke } if\n0 0 1 1 leftarrow\nn 2 sub dup n 1 sub dup rightarrow\n} if\nend\n} dup 0 4 dict put def\n\n\/Circ {\nnewpath\n0 360 arc\nclosepath\npatternNone not { ifill } if\nbrushNone not { istroke } if\n} def\n\n\/CBSpl {\n0 begin\ndup 2 gt {\nstorexyn\nnewpath\nn 1 sub dup 0 0 1 1 2 2 true subspline\n1 1 n 3 sub {\n\/i exch def\ni 1 sub dup i dup i 1 add dup i 2 add dup false subspline\n} for\nn 3 sub dup n 2 sub dup n 1 sub dup 0 0 false subspline\nn 2 sub dup n 1 sub dup 0 0 1 1 false subspline\npatternNone not { ifill } if\nbrushNone not { istroke } if\n} {\nPoly\n} ifelse\nend\n} dup 0 4 dict put def\n\n\/Elli {\n0 begin\nnewpath\n4 2 roll\ntranslate\nscale\n0 0 1 0 360 arc\nclosepath\npatternNone not { ifill } if\nbrushNone not { istroke } if\nend\n} dup 0 1 dict put def\n\n\/Line {\n0 begin\n2 storexyn\nnewpath\nx 0 get y 0 get moveto\nx 1 get y 1 get lineto\nbrushNone not { istroke } if\n0 0 1 1 leftarrow\n0 0 1 1 rightarrow\nend\n} dup 0 4 dict put def\n\n\/MLine {\n0 begin\nstorexyn\nnewpath\nn 1 gt {\nx 0 get y 0 get moveto\n1 1 n 1 sub {\n\/i exch def\nx i get y i get lineto\n} for\npatternNone not brushLeftArrow not brushRightArrow not and and { ifill } if\nbrushNone not { istroke } if\n0 0 1 1 leftarrow\nn 2 sub dup n 1 sub dup rightarrow\n} if\nend\n} dup 0 4 dict put def\n\n\/Poly {\n3 1 roll\nnewpath\nmoveto\n-1 add\n{ lineto } repeat\nclosepath\npatternNone not { ifill } if\nbrushNone not { istroke } if\n} def\n\n\/Rect {\n0 begin\n\/t exch def\n\/r exch def\n\/b exch def\n\/l exch def\nnewpath\nl b moveto\nl t lineto\nr t lineto\nr b lineto\nclosepath\npatternNone not { ifill } if\nbrushNone not { istroke } if\nend\n} dup 0 4 dict put def\n\n\/Text {\nishow\n} def\n\n\/idef {\ndup where { pop pop pop } { exch def } ifelse\n} def\n\n\/ifill {\n0 begin\ngsave\npatternGrayLevel -1 ne {\nfgred bgred fgred sub patternGrayLevel mul add\nfggreen bggreen fggreen sub patternGrayLevel mul add\nfgblue bgblue fgblue sub patternGrayLevel mul add setrgbcolor\neofill\n} {\neoclip\noriginalCTM setmatrix\npathbbox \/t exch def \/r exch def \/b exch def \/l exch def\n\/w r l sub ceiling cvi def\n\/h t b sub ceiling cvi def\n\/imageByteWidth w 8 div ceiling cvi def\n\/imageHeight h def\nbgred bggreen bgblue setrgbcolor\neofill\nfgred fggreen fgblue setrgbcolor\nw 0 gt h 0 gt and {\nl w add b translate w neg h scale\nw h true [w 0 0 h neg 0 h] { patternproc } imagemask\n} if\n} ifelse\ngrestore\nend\n} dup 0 8 dict put def\n\n\/istroke {\ngsave\nbrushDashOffset -1 eq {\n[] 0 setdash\n1 setgray\n} {\nbrushDashArray brushDashOffset setdash\nfgred fggreen fgblue setrgbcolor\n} ifelse\nbrushWidth setlinewidth\noriginalCTM setmatrix\nstroke\ngrestore\n} def\n\n\/ishow {\n0 begin\ngsave\nfgred fggreen fgblue setrgbcolor\n\/fontDict printFont printSize scalefont dup setfont def\n\/descender fontDict begin 0 \/FontBBox load 1 get FontMatrix end\ntransform exch pop def\n\/vertoffset 1 printSize sub descender sub def {\n0 vertoffset moveto show\n\/vertoffset vertoffset printSize sub def\n} forall\ngrestore\nend\n} dup 0 3 dict put def\n\/patternproc {\n0 begin\n\/patternByteLength patternString length def\n\/patternHeight patternByteLength 8 mul sqrt cvi def\n\/patternWidth patternHeight def\n\/patternByteWidth patternWidth 8 idiv def\n\/imageByteMaxLength imageByteWidth imageHeight mul\nstringLimit patternByteWidth sub min def\n\/imageMaxHeight imageByteMaxLength imageByteWidth idiv patternHeight idiv\npatternHeight mul patternHeight max def\n\/imageHeight imageHeight imageMaxHeight sub store\n\/imageString imageByteWidth imageMaxHeight mul patternByteWidth add string def\n0 1 imageMaxHeight 1 sub {\n\/y exch def\n\/patternRow y patternByteWidth mul patternByteLength mod def\n\/patternRowString patternString patternRow patternByteWidth getinterval def\n\/imageRow y imageByteWidth mul def\n0 patternByteWidth imageByteWidth 1 sub {\n\/x exch def\nimageString imageRow x add patternRowString putinterval\n} for\n} for\nimageString\nend\n} dup 0 12 dict put def\n\n\/min {\ndup 3 2 roll dup 4 3 roll lt { exch } if pop\n} def\n\n\/max {\ndup 3 2 roll dup 4 3 roll gt { exch } if pop\n} def\n\n\/midpoint {\n0 begin\n\/y1 exch def\n\/x1 exch def\n\/y0 exch def\n\/x0 exch def\nx0 x1 add 2 div\ny0 y1 add 2 div\nend\n} dup 0 4 dict put def\n\n\/thirdpoint {\n0 begin\n\/y1 exch def\n\/x1 exch def\n\/y0 exch def\n\/x0 exch def\nx0 2 mul x1 add 3 div\ny0 2 mul y1 add 3 div\nend\n} dup 0 4 dict put def\n\n\/subspline {\n0 begin\n\/movetoNeeded exch def\ny exch get \/y3 exch def\nx exch get \/x3 exch def\ny exch get \/y2 exch def\nx exch get \/x2 exch def\ny exch get \/y1 exch def\nx exch get \/x1 exch def\ny exch get \/y0 exch def\nx exch get \/x0 exch def\nx1 y1 x2 y2 thirdpoint\n\/p1y exch def\n\/p1x exch def\nx2 y2 x1 y1 thirdpoint\n\/p2y exch def\n\/p2x exch def\nx1 y1 x0 y0 thirdpoint\np1x p1y midpoint\n\/p0y exch def\n\/p0x exch def\nx2 y2 x3 y3 thirdpoint\np2x p2y midpoint\n\/p3y exch def\n\/p3x exch def\nmovetoNeeded { p0x p0y moveto } if\np1x p1y p2x p2y p3x p3y curveto\nend\n} dup 0 17 dict put def\n\n\/storexyn {\n\/n exch def\n\/y n array def\n\/x n array def\nn 1 sub -1 0 {\n\/i exch def\ny i 3 2 roll put\nx i 3 2 roll put\n} for\n} def\n\n\/SSten {\nfgred fggreen fgblue setrgbcolor\ndup true exch 1 0 0 -1 0 6 -1 roll matrix astore\n} def\n\n\/FSten {\ndup 3 -1 roll dup 4 1 roll exch\nnewpath\n0 0 moveto\ndup 0 exch lineto\nexch dup 3 1 roll exch lineto\n0 lineto\nclosepath\nbgred bggreen bgblue setrgbcolor\neofill\nSSten\n} def\n\n\/Rast {\nexch dup 3 1 roll 1 0 0 -1 0 6 -1 roll matrix astore\n} def\n\n%%EndProlog\n\n%I Idraw 13 Grid 8 8 \n\n%%Page: 1 1\n\nBegin\n%I b u\n%I cfg u\n%I cbg u\n%I f u\n%I p u\n%I t\n[ 0.770999 0 0 0.770999 0 0 ] concat\n\/originalCTM matrix currentmatrix def\n\nBegin %I Elli\n%I b 65535\n1 0 0 [] 0 SetB\n%I cfg Black\n0 0 0 SetCFg\n%I cbg LtGray\n0.762951 0.762951 0.762951 SetCBg\n%I p\n1 SetP\n%I t\n[ 0.500304 -0 -0 0.500304 68.5416 541.829 ] concat\n%I\n337 492 110 78 Elli\nEnd\n\nBegin %I Line\n%I b 65535\n3 0 0 [] 0 SetB\n%I cfg Black\n0 0 0 SetCFg\n%I cbg White\n1 1 1 SetCBg\nnone SetP %I p n\n%I t\n[ 0.24241 -0 -0 0.24241 149.082 678.504 ] concat\n%I\n-252 74 163 526 Line\n%I 4\nEnd\n\nBegin %I BSpl\n%I b 65535\n3 0 0 [] 0 SetB\n%I cfg Black\n0 0 0 SetCFg\n%I cbg LtGray\n0.762951 0.762951 0.762951 SetCBg\n%I p\n1 SetP\n%I t\n[ 0.24241 -0 -0 0.24241 149.082 678.504 ] concat\n%I 10\n163 527\n187 553\n220 578\n271 598\n327 612\n383 612\n440 604\n475 593\n517 570\n517 570\n10 BSpl\n%I 4\nEnd\n\nBegin %I Line\n%I b 65535\n3 0 0 [] 0 SetB\n%I cfg Black\n0 0 0 SetCFg\n%I cbg White\n1 1 1 SetCBg\nnone SetP %I p n\n%I t\n[ 0.24241 -0 -0 0.24241 149.082 678.504 ] concat\n%I\n516 571 871 209 Line\n%I 4\nEnd\n\nBegin %I Elli\n%I b 65535\n1 0 0 [] 0 SetB\n%I cfg Black\n0 0 0 SetCFg\n%I cbg White\n1 1 1 SetCBg\n%I p\n1 SetP\n%I t\n[ 1 -0 -0 1 -11 36 ] concat\n%I\n99 660 8 8 Elli\nEnd\n\nBegin %I Text\n%I cfg Black\n0 0 0 SetCFg\n%I f -*-helvetica-medium-r-normal--24-*\nHelvetica 24 SetF\n%I t\n[ 1 0 0 1 99.371 703.331 ] concat\n%I\n[\n(p)\n] Text\nEnd\n\nBegin %I Text\n%I cfg Black\n0 0 0 SetCFg\n%I f -*-helvetica-medium-r-normal--18-*\nHelvetica 18 SetF\n%I t\n[ 1 0 0 1 111.002 684.863 ] concat\n%I\n[\n(0)\n] Text\nEnd\n\nBegin %I Elli\n%I b 65535\n1 0 0 [] 0 SetB\n%I cfg Black\n0 0 0 SetCFg\n%I cbg White\n1 1 1 SetCBg\n%I p\n1 SetP\n%I t\n[ 0.484819 -0 -0 0.484819 247.497 520.941 ] concat\n%I\n230 435 16 16 Elli\nEnd\n\nBegin %I Elli\n%I b 65535\n1 0 0 [] 0 SetB\n%I cfg Black\n0 0 0 SetCFg\n%I cbg White\n1 1 1 SetCBg\n%I p\n1 SetP\n%I t\n[ 0.484819 -0 -0 0.484819 165.324 604.086 ] concat\n%I\n230 435 16 16 Elli\nEnd\n\nBegin %I Elli\n%I b 65535\n1 0 0 [] 0 SetB\n%I cfg Black\n0 0 0 SetCFg\n%I cbg White\n1 1 1 SetCBg\n%I p\n1 SetP\n%I t\n[ 0.484819 -0 -0 0.484819 75.3908 593.178 ] concat\n%I\n230 435 16 16 Elli\nEnd\n\nBegin %I Text\n%I cfg Black\n0 0 0 SetCFg\n%I f -*-helvetica-medium-r-normal--24-*\nHelvetica 24 SetF\n%I t\n[ 1 0 0 1 229.806 798.221 ] concat\n%I\n[\n(W)\n] Text\nEnd\n\nBegin %I Text\n%I cfg Black\n0 0 0 SetCFg\n%I f -*-helvetica-medium-r-normal--18-*\nHelvetica 18 SetF\n%I t\n[ 1 0 0 1 282.626 838.941 ] concat\n%I\n[\n(B)\n] Text\nEnd\n\nBegin %I Text\n%I cfg Black\n0 0 0 SetCFg\n%I f -*-helvetica-medium-r-normal--18-*\nHelvetica 18 SetF\n%I t\n[ 1 0 0 1 171.473 830.698 ] concat\n%I\n[\n(A)\n] Text\nEnd\n\nBegin %I Text\n%I cfg Black\n0 0 0 SetCFg\n%I f -*-helvetica-medium-r-normal--24-*\nHelvetica 24 SetF\n%I t\n[ 1 0 0 1 373.882 740.405 ] concat\n%I\n[\n(p)\n] Text\nEnd\n\nBegin %I Text\n%I cfg Black\n0 0 0 SetCFg\n%I f -*-helvetica-medium-r-normal--18-*\nHelvetica 18 SetF\n%I t\n[ 1 0 0 1 385.513 721.937 ] concat\n%I\n[\n(1)\n] Text\nEnd\n\nBegin %I Text\n%I cfg Black\n0 0 0 SetCFg\n%I f -*-helvetica-medium-r-normal--24-*\nHelvetica 24 SetF\n%I t\n[ 1 0 0 1 108.34 793.707 ] concat\n%I\n[\n(u)\n] Text\nEnd\n\nBegin %I Text\n%I cfg Black\n0 0 0 SetCFg\n%I f -*-helvetica-medium-r-normal--14-*\nHelvetica 14 SetF\n%I t\n[ 1 0 0 1 122.879 777.054 ] concat\n%I\n[\n(A)\n] Text\nEnd\n\nBegin %I Text\n%I cfg Black\n0 0 0 SetCFg\n%I f -*-helvetica-medium-r-normal--24-*\nHelvetica 24 SetF\n%I t\n[ 1 0 0 1 321.796 810.429 ] concat\n%I\n[\n(u)\n] Text\nEnd\n\nBegin %I Text\n%I cfg Black\n0 0 0 SetCFg\n%I f -*-helvetica-medium-r-normal--14-*\nHelvetica 14 SetF\n%I t\n[ 1 0 0 1 336.334 793.776 ] concat\n%I\n[\n(B)\n] Text\nEnd\n\nBegin %I Line\n%I b 65535\n1 0 1 [] 0 SetB\n%I cfg Black\n0 0 0 SetCFg\n%I cbg White\n1 1 1 SetCBg\nnone SetP %I p n\n%I t\n[ 0.96913 -0 -0 0.96913 -3.87652 99.8204 ] concat\n%I\n97 633 183 723 Line\n%I 1\nEnd\n\nBegin %I Line\n%I b 65535\n1 0 1 [] 0 SetB\n%I cfg Black\n0 0 0 SetCFg\n%I cbg White\n1 1 1 SetCBg\nnone SetP %I p n\n%I t\n[ 0.96913 -0 -0 0.96913 -3.87652 99.8204 ] concat\n%I\n309 732 368 671 Line\n%I 1\nEnd\n\nEnd %I eop\n\nshowpage\n\n%%Trailer\n\nend\n","avg_line_length":17.1609756098,"max_line_length":78,"alphanum_fraction":0.7305997726} +{"size":8769,"ext":"idr","lang":"Idris","max_stars_count":15.0,"content":"module Highlight.Parser\n\nimport Highlight.Regions\n\nimport Lightyear.Core\nimport Lightyear.Combinators\nimport Lightyear.Char\nimport Lightyear.Strings\n\n||| The data format output by Idris's highlighting routines\npublic export\ndata SExpr = SSym String | SString String | SInt Integer | SList (List SExpr)\n\n%name SExpr sexp\n\nexport\nShow SExpr where\n show (SSym x) = \":\" ++ x\n show (SString x) = show x\n show (SInt x) = show x\n show (SList xs) = \"(\" ++ concat (intersperse \" \" (map show xs)) ++ \")\"\n\nsSymInj : SSym x = SSym y -> x = y\nsSymInj Refl = Refl\n\nsStringInj : SString x = SString y -> x = y\nsStringInj Refl = Refl\n\nsIntInj : SInt x = SInt y -> x = y\nsIntInj Refl = Refl\n\nsListInj : SList xs = SList ys -> xs = ys\nsListInj Refl = Refl\n\nDecEq SExpr where\n decEq (SSym x) (SSym y) with (decEq x y)\n decEq (SSym x) (SSym x) | Yes Refl = Yes Refl\n decEq (SSym x) (SSym y) | No contra = No $ contra . sSymInj\n decEq (SSym x) (SString y) = No $ \\(Refl) impossible\n decEq (SSym x) (SInt y) = No $ \\(Refl) impossible\n decEq (SSym x) (SList xs) = No $ \\(Refl) impossible\n decEq (SString x) (SSym y) = No $ \\(Refl) impossible\n decEq (SString x) (SString y) with (decEq x y)\n decEq (SString x) (SString x) | Yes Refl = Yes Refl\n decEq (SString x) (SString y) | No contra = No $ contra . sStringInj\n decEq (SString x) (SInt y) = No $ \\(Refl) impossible\n decEq (SString x) (SList xs) = No $ \\(Refl) impossible\n decEq (SInt x) (SSym y) = No $ \\(Refl) impossible\n decEq (SInt x) (SString y) = No $ \\(Refl) impossible\n decEq (SInt x) (SInt y) with (decEq x y)\n decEq (SInt x) (SInt x) | Yes Refl = Yes Refl\n decEq (SInt x) (SInt y) | No contra = No $ contra . sIntInj\n decEq (SInt x) (SList xs) = No $ \\(Refl) impossible\n decEq (SList xs) (SSym x) = No $ \\(Refl) impossible\n decEq (SList xs) (SString x) = No $ \\(Refl) impossible\n decEq (SList xs) (SInt x) = No $ \\(Refl) impossible\n decEq (SList xs) (SList ys) with (assert_total $ decEq xs ys)\n decEq (SList xs) (SList xs) | Yes Refl = Yes Refl\n decEq (SList xs) (SList ys) | No contra = No $ contra . sListInj\n\nnamespace Assoc\n ||| Because much of the highlighting information is in alist form,\n ||| we need a representation that lets us do lookups in alists. This\n ||| datatype represents the results of those lookups.\n |||\n ||| This datatype is slightly deficient - it should guarantee that\n ||| we find the _first_ matching key, but it only guarantees that we\n ||| find _a_ matching key. Ah well, duplicate keys don't occur in\n ||| Idris's highlighting output.\n |||\n ||| @ needle what we are looking for\n ||| @ value the associated information, once found\n ||| @ haystack where we are looking\n data Assoc : (needle : SExpr) -> (value : List SExpr) -> (haystack : List SExpr) -> Type where\n ||| The key was found at the beginning\n Car : Assoc k v (SList (k :: v) :: sexprs)\n ||| The key was found in the tail\n Cdr : Assoc k v sexprs -> Assoc k v (sexpr :: sexprs)\n\n total\n noAssocEmpty : Assoc needle value [] -> Void\n noAssocEmpty Car impossible\n noAssocEmpty (Cdr prf) impossible\n\n total\n assocConsNotList : Assoc needle value (headSexpr :: sexprs) ->\n Not (xs : List SExpr ** headSexpr = SList xs) ->\n Assoc needle value sexprs\n assocConsNotList (Cdr x) notEqList = x\n assocConsNotList Car nope = absurd $ nope (_ ** Refl)\n\n total\n assocNonEmpty : Assoc needle value (SList [] :: sexprs) -> Assoc needle value sexprs\n assocNonEmpty (Cdr x) = x\n\n -- The following function could probably be cleaned up a bit, but that would require real thought...\n ||| Do a lookup in an alist.\n total\n assoc : (needle : SExpr) -> (haystack : List SExpr) -> Dec (value : List SExpr ** Assoc needle value haystack)\n assoc needle [] = No $ \\(v ** prf) => noAssocEmpty prf\n assoc needle (SSym x :: xs) with (assoc needle xs)\n assoc needle (SSym x :: xs) | Yes prf = Yes (fst prf ** Cdr (snd prf))\n assoc needle (SSym x :: xs) | No contra =\n No $ \\(value ** location) =>\n contra (value ** assocConsNotList location (\\(xs ** Refl) impossible))\n assoc needle (SString x :: xs) with (assoc needle xs)\n assoc needle (SString x :: xs) | Yes prf = Yes (fst prf ** Cdr (snd prf))\n assoc needle (SString x :: xs) | No contra =\n No $ \\(value ** location) =>\n contra (value ** assocConsNotList location (\\(xs ** Refl) impossible))\n assoc needle (SInt x :: xs) with (assoc needle xs)\n assoc needle (SInt x :: xs) | Yes prf = Yes (fst prf ** Cdr (snd prf))\n assoc needle (SInt x :: xs) | No contra =\n No $ \\(value ** location) =>\n contra (value ** assocConsNotList location (\\(xs ** Refl) impossible))\n assoc needle (SList [] :: xs) with (assoc needle xs)\n assoc needle (SList [] :: xs) | Yes prf = Yes (fst prf ** Cdr (snd prf))\n assoc needle (SList [] :: xs) | No contra =\n No $ \\(value ** location) =>\n contra (value ** assocNonEmpty location)\n assoc needle (SList (y :: ys) :: xs) with (decEq needle y)\n assoc needle (SList (needle :: ys) :: xs) | Yes Refl = Yes (_ ** Car)\n assoc needle (SList (y :: ys) :: xs) | No notHere with (assoc needle xs)\n assoc needle (SList (y :: ys) :: xs) | No notHere | Yes prf = Yes (fst prf ** Cdr (snd prf))\n assoc needle (SList (y :: ys) :: xs) | No notHere | No notThere =\n No $ \\(value ** location) =>\n case location of\n Car => notHere Refl\n Cdr tl => notThere (_ ** tl)\n\n||| Parse a parenthesized sequence\ninParens : Parser a -> Parser a\ninParens p = token \"(\" *!> p <* token \")\"\n\n||| Parse the end of an escape sequence in a string\nescaped : Parser Char\nescaped = char '\\\\' <|>| char '\"' -- TODO - more?\n\n||| Parse a single character from a string (possibly an escape sequence)\nstringChar : Parser Char\nstringChar = (char '\\\\' *!> escaped) <|>| (satisfy (\\c => c \/= '\\\\' && c \/= '\"'))\n\n||| Parse a string literal\nstringLit : Parser String\nstringLit = lexeme $ char '\"' *!> (pack <$> many stringChar) <* char '\"'\n\n||| Parse a character that is allowed as part of a symbol name\nsymbolChar : Parser Char\nsymbolChar = satisfy (\\c => ('a' <= c && c <= 'z') ||\n ('A' <= c && c <= 'Z') ||\n ('0' <= c && c <= '9') ||\n (c == '-'))\n\n||| Parse a symbol\nsymbol : Parser String\nsymbol = lexeme $ char ':' *> (pack <$> many symbolChar)\n\n||| Parse a whole S-expression\nexport\nexpr : Parser SExpr\nexpr = SString <$> stringLit\n <|>| SSym <$> symbol\n <|>| SInt <$> lexeme integer\n <|>| SList <$> inParens (many expr)\n\n\ndecToMaybe : Dec a -> Maybe a\ndecToMaybe (Yes p) = Just p\ndecToMaybe (No _) = Nothing\n\ntotal\ngetRegion : SExpr -> Maybe (Region ())\ngetRegion (SList xs) = do ([SString fn] ** _) <- decToMaybe (assoc (SSym \"filename\") xs)\n | _ => Nothing\n ([SInt sl, SInt sc] ** _) <- decToMaybe (assoc (SSym \"start\") xs)\n | _ => Nothing\n ([SInt el, SInt ec] ** _) <- decToMaybe (assoc (SSym \"end\") xs)\n | _ => Nothing\n pure (MkRegion fn sl sc el (1 + ec) ())\ngetRegion _ = Nothing\n\nexport\ngetRegionMeta : SExpr -> Maybe (Region SExpr)\ngetRegionMeta (SList [r, meta]) = map (const meta) <$> getRegion r\ngetRegionMeta _ = Nothing\n\ngetHighlightType : SExpr -> Maybe HighlightType\ngetHighlightType (SList xs) = do ([SSym d] ** _) <- decToMaybe (assoc (SSym \"decor\") xs)\n | _ => Nothing\n case d of\n \"bound\" => Just (Bound False) -- TODO look for implicit\n \"keyword\" => Just Keyword\n other =>\n [| Name (isName other) (pure $ getDocstring xs) (pure $ getType xs) |]\n where\n isName : String -> Maybe NameHL\n isName \"function\" = Just Function\n isName \"data\" = Just Constructor\n isName \"type\" = Just TypeConstructor\n isName _ = Nothing\n getDocstring : List SExpr -> String\n getDocstring xs = case decToMaybe $ assoc (SSym \"doc-overview\") xs of\n Just ([SString d] ** _) => d\n _ => \"\"\n getType : List SExpr -> String\n getType xs = case decToMaybe $ assoc (SSym \"type\") xs of\n Just ([SString d] ** _) => d\n _ => \"\"\ngetHighlightType _ = Nothing\n\nexport\nmkHls : List (Region SExpr) -> List (Region HighlightType)\nmkHls [] = []\nmkHls (r::rs) = case getHighlightType (metadata r) of\n Nothing => mkHls rs\n Just hl => map (const hl) r :: mkHls rs\n","avg_line_length":40.4101382488,"max_line_length":112,"alphanum_fraction":0.5820504048} +{"size":1141,"ext":"idr","lang":"Idris","max_stars_count":26.0,"content":"module GRIN.GrinState\n\nimport Data.List\nimport Data.SortedMap\nimport Data.SortedSet as Set\n\nimport GRIN.AST\nimport GRIN.Error\nimport GRIN.Analysis.MaxVar\n\npublic export 0\nCallGraph : Type -> Type\nCallGraph name = SortedMap name (SortedSet name)\n\npublic export 0\nEffectMap : Type -> Type\nEffectMap name = SortedMap name Bool\n\npublic export\nrecord GrinState name where\n constructor MkGrinState\n prog : Prog name\n calls : Maybe (CallGraph name)\n calledBy : Maybe (CallGraph name)\n effectMap : Maybe (EffectMap name)\n toInline : SortedMap name (Def name) -- should have all fetch ids removed\n errors : List Error\n varMap : SortedMap Var Var\n nextVar : Var\n\nexport\ngetErrors : GrinState name -> List Error\ngetErrors = reverse . errors\n\nexport\nnewGrinState : Ord name => Prog name -> GrinState name\nnewGrinState prog = MkGrinState\n { prog\n , calls = Nothing\n , calledBy = Nothing\n , effectMap = Nothing\n , toInline = empty\n , errors = []\n , varMap = empty\n , nextVar = incVar $ maxVar prog\n }\n\npublic export\ndata AnalysisTag\n = CallsGraph\n | CalledByGraph\n | CallGraphs\n | Effects\n","avg_line_length":21.1296296296,"max_line_length":77,"alphanum_fraction":0.7046450482} +{"size":728,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"module CH10_0\n\ndata TakeN : List a -> Type where\n Fewer : TakeN xs\n Exact : (n_xs : List a) -> TakeN (n_xs ++ rest)\n\ntakeN : (n : Nat) -> (xs : List a) -> TakeN xs\ntakeN Z _ = Exact []\ntakeN _ [] = Fewer\ntakeN (S k) (x :: xs) = case takeN k xs of\n Fewer => Fewer\n Exact ys => Exact (x :: ys)\n\ngroupByN : (n : Nat) -> (xs : List a) -> List (List a)\ngroupByN n xs with (takeN n xs)\n groupByN n xs | Fewer = [xs]\n groupByN n (n_xs ++ rest) | (Exact n_xs) = n_xs :: (groupByN n rest)\n\nhalves : List a -> (List a, List a)\nhalves xs with (takeN (div (length xs) 2) xs)\n halves xs | Fewer = ([], xs)\n halves (n_xs ++ rest) | (Exact n_xs) = (n_xs, rest)\n","avg_line_length":31.652173913,"max_line_length":70,"alphanum_fraction":0.5206043956} +{"size":13025,"ext":"idr","lang":"Idris","max_stars_count":128.0,"content":"||| A simple parser combinator library for String. Inspired by attoparsec zepto.\nmodule Data.String.Parser\nimport public Control.Monad.Identity\nimport Control.Monad.Trans\n\nimport Data.String\nimport Data.String.Extra\nimport Data.Fin\nimport Data.List\nimport Data.List.Alternating\nimport Data.List1\nimport Data.SnocList\nimport Data.Vect\n\n%default total\n\n||| The input state, pos is position in the string and maxPos is the length of the input string.\npublic export\nrecord State where\n constructor S\n input : String\n pos : Int\n maxPos : Int\n\nShow State where\n show s = \"(\" ++ show s.input ++ \", \" ++ show s.pos ++ \", \" ++ show s.maxPos ++ \")\"\n\n||| Result of applying a parser\npublic export\ndata Result a = Fail Int String | OK a State\n\nFunctor Result where\n map f (Fail i err) = Fail i err\n map f (OK r s) = OK (f r) s\n\npublic export\nrecord ParseT (m : Type -> Type) (a : Type) where\n constructor P\n runParser : State -> m (Result a)\n\npublic export\nParser : Type -> Type\nParser = ParseT Identity\n\npublic export\nFunctor m => Functor (ParseT m) where\n map f p = P $ \\s => map (map f) (p.runParser s)\n\npublic export\nMonad m => Applicative (ParseT m) where\n pure x = P $ \\s => pure $ OK x s\n f <*> x = P $ \\s => case !(f.runParser s) of\n OK f' s' => map (map f') (x.runParser s')\n Fail i err => pure $ Fail i err\n\npublic export\nMonad m => Alternative (ParseT m) where\n empty = P $ \\s => pure $ Fail s.pos \"no alternative left\"\n a <|> b = P $ \\s => case !(a.runParser s) of\n OK r s' => pure $ OK r s'\n Fail _ _ => b.runParser s\n\npublic export\nMonad m => Monad (ParseT m) where\n m >>= k = P $ \\s => case !(m.runParser s) of\n OK a s' => (k a).runParser s'\n Fail i err => pure $ Fail i err\n\npublic export\nMonadTrans ParseT where\n lift x = P $ \\s => map (flip OK s) x\n\n||| Run a parser in a monad\n||| Returns a tuple of the result and final position on success.\n||| Returns an error message on failure.\nexport\nparseT : Functor m => ParseT m a -> String -> m (Either String (a, Int))\nparseT p str = map (\\case\n OK r s => Right (r, s.pos)\n Fail i err => Left $ let (line, col) = computePos i str in \"Parse failed at position \\{show line}-\\{show col}: \\{err}\")\n (p.runParser (S str 0 (strLength str)))\n where\n computePosAcc : Int -> List Char -> (Int, Int) -> (Int, Int)\n computePosAcc 0 input acc = acc\n computePosAcc n [] acc = acc\n computePosAcc n ('\\n' :: is) (line, col) = computePosAcc (n - 1) is (line + 1, 0)\n computePosAcc n (i :: is) (line, col) = computePosAcc (n - 1) is (line, col + 1)\n\n -- compute the position as line:col\n computePos : Int -> String -> (Int, Int)\n computePos pos input = computePosAcc pos (fastUnpack input) (0,0)\n\n||| Run a parser in a pure function\n||| Returns a tuple of the result and final position on success.\n||| Returns an error message on failure.\nexport\nparse : Parser a -> String -> Either String (a, Int)\nparse p str = runIdentity $ parseT p str\n\n||| Combinator that replaces the error message on failure.\n||| This allows combinators to output relevant errors\nexport\n() : Functor m => ParseT m a -> String -> ParseT m a\n() p msg = P $ \\s => map (\\case\n OK r s' => OK r s'\n Fail i _ => Fail i msg)\n (p.runParser s)\n\ninfixl 0 \n\n||| Discards the result of a parser\nexport\nskip : Functor m => ParseT m a -> ParseT m ()\nskip = ignore\n\n||| Maps the result of the parser `p` or returns `def` if it fails.\nexport\noptionMap : Functor m => b -> (a -> b) -> ParseT m a -> ParseT m b\noptionMap def f p = P $ \\s => map (\\case\n OK r s' => OK (f r) s'\n Fail _ _ => OK def s)\n (p.runParser s)\n\n||| Runs the result of the parser `p` or returns `def` if it fails.\nexport\noption : Functor m => a -> ParseT m a -> ParseT m a\noption def = optionMap def id\n\n||| Returns a Bool indicating whether `p` succeeded\nexport\nsucceeds : Functor m => ParseT m a -> ParseT m Bool\nsucceeds = optionMap False (const True)\n\n||| Returns a Maybe that contains the result of `p` if it succeeds or `Nothing` if it fails.\nexport\noptional : Functor m => ParseT m a -> ParseT m (Maybe a)\noptional = optionMap Nothing Just\n\n||| Succeeds if and only if the argument parser fails.\n|||\n||| In Parsec, this combinator is called `notFollowedBy`.\nexport\nrequireFailure : Functor m => ParseT m a -> ParseT m ()\nrequireFailure (P runParser) = P $ \\s => reverseResult s <$> runParser s\nwhere\n reverseResult : State -> Result a -> Result ()\n reverseResult s (Fail _ _) = OK () s\n reverseResult s (OK _ _) = Fail (pos s) \"Purposefully changed OK to Fail\"\n\n||| Fail with some error message\nexport\nfail : Applicative m => String -> ParseT m a\nfail x = P $ \\s => pure $ Fail s.pos x\n\n||| Succeeds if the next char satisfies the predicate `f`\nexport\nsatisfy : Applicative m => (Char -> Bool) -> ParseT m Char\nsatisfy f = P $ \\s => pure $ if s.pos < s.maxPos\n then let ch = assert_total $ strIndex s.input s.pos in\n if f ch\n then OK ch (S s.input (s.pos + 1) s.maxPos)\n else Fail s.pos \"could not satisfy predicate\"\n else Fail s.pos \"could not satisfy predicate\"\n\n||| Succeeds if the string `str` follows.\nexport\nstring : Applicative m => String -> ParseT m String\nstring str = P $ \\s => pure $ let len = strLength str in\n if s.pos+len <= s.maxPos\n then let head = strSubstr s.pos len s.input in\n if head == str\n then OK str (S s.input (s.pos + len) s.maxPos)\n else Fail s.pos (\"string \" ++ show str)\n else Fail s.pos (\"string \" ++ show str)\n\n||| Succeeds if the end of the string is reached.\nexport\neos : Applicative m => ParseT m ()\neos = P $ \\s => pure $ if s.pos == s.maxPos\n then OK () s\n else Fail s.pos \"expected the end of the string\"\n\n||| Succeeds if the next char is `c`\nexport\nchar : Applicative m => Char -> ParseT m Char\nchar c = satisfy (== c) \"expected \\{show c}\"\n\n||| Parses a space character\nexport\nspace : Applicative m => ParseT m Char\nspace = satisfy isSpace \"expected space\"\n\n||| Parses a letter or digit (a character between \\'0\\' and \\'9\\').\n||| Returns the parsed character.\nexport\nalphaNum : Applicative m => ParseT m Char\nalphaNum = satisfy isAlphaNum \"expected letter or digit\"\n\n||| Parses a letter (an upper case or lower case character). Returns the\n||| parsed character.\nexport\nletter : Applicative m => ParseT m Char\nletter = satisfy isAlpha \"expected letter\"\n\nmutual\n ||| Succeeds if `p` succeeds, will continue to match `p` until it fails\n ||| and accumulate the results in a list\n export\n covering\n some : Monad m => ParseT m a -> ParseT m (List a)\n some p = [| p :: many p |]\n\n ||| Always succeeds, will accumulate the results of `p` in a list until it fails.\n export\n covering\n many : Monad m => ParseT m a -> ParseT m (List a)\n many p = some p <|> pure []\n\n||| Parse left-nested lists of the form `((init op arg) op arg) op arg`\nexport\ncovering\nhchainl : Monad m => ParseT m init -> ParseT m (init -> arg -> init) -> ParseT m arg -> ParseT m init\nhchainl pini pop parg = pini >>= go\n where\n covering\n go : init -> ParseT m init\n go x = (do op <- pop\n arg <- parg\n go $ op x arg) <|> pure x\n\n||| Parse right-nested lists of the form `arg op (arg op (arg op end))`\nexport\ncovering\nhchainr : Monad m => ParseT m arg -> ParseT m (arg -> end -> end) -> ParseT m end -> ParseT m end\nhchainr parg pop pend = go id <*> pend\n where\n covering\n go : (end -> end) -> ParseT m (end -> end)\n go f = (do arg <- parg\n op <- pop\n go $ f . op arg) <|> pure f\n\n||| Always succeeds, applies the predicate `f` on chars until it fails and creates a string\n||| from the results.\nexport\ncovering\ntakeWhile : Monad m => (Char -> Bool) -> ParseT m String\ntakeWhile f = pack <$> many (satisfy f)\n\n||| Similar to `takeWhile` but fails if the resulting string is empty.\nexport\ncovering\ntakeWhile1 : Monad m => (Char -> Bool) -> ParseT m String\ntakeWhile1 f = pack <$> some (satisfy f)\n\n||| Takes from the input until the `stop` string is found.\n||| Fails if the `stop` string cannot be found.\nexport\ncovering\ntakeUntil : Monad m => (stop : String) -> ParseT m String\ntakeUntil stop = do\n let StrCons s top = strM stop\n | StrNil => pure \"\"\n takeUntil' s top [<]\n where\n takeUntil' : Monad m' => (s : Char) -> (top : String) -> (acc : SnocList String) -> ParseT m' String\n takeUntil' s top acc = do\n init <- takeWhile (\/= s)\n skip $ char s \"end of string reached - \\{show stop} not found\"\n case !(succeeds $ string top) of\n False => takeUntil' s top $ acc :< (init +> s)\n True => pure $ concat $ acc :< init\n\n||| Parses zero or more space characters\nexport\ncovering\nspaces : Monad m => ParseT m ()\nspaces = skip (many space)\n\n||| Parses one or more space characters\nexport\ncovering\nspaces1 : Monad m => ParseT m ()\nspaces1 = skip (some space) \"whitespaces\"\n\n||| Discards brackets around a matching parser\nexport\nparens : Monad m => ParseT m a -> ParseT m a\nparens p = char '(' *> p <* char ')'\n\n||| Discards whitespace after a matching parser\nexport\ncovering\nlexeme : Monad m => ParseT m a -> ParseT m a\nlexeme p = p <* spaces\n\n||| Matches a specific string, then skips following whitespace\nexport\ncovering\ntoken : Monad m => String -> ParseT m ()\ntoken s = lexeme (skip $ string s) \"expected token \" ++ show s\n\n||| Matches a single digit\nexport\ndigit : Monad m => ParseT m (Fin 10)\ndigit = do x <- satisfy isDigit\n case lookup x digits of\n Nothing => fail \"not a digit\"\n Just y => pure y\n where\n digits : List (Char, Fin 10)\n digits = [ ('0', 0)\n , ('1', 1)\n , ('2', 2)\n , ('3', 3)\n , ('4', 4)\n , ('5', 5)\n , ('6', 6)\n , ('7', 7)\n , ('8', 8)\n , ('9', 9)\n ]\n\nfromDigits : Num a => (Fin 10 -> a) -> List (Fin 10) -> a\nfromDigits f xs = foldl addDigit 0 xs\nwhere\n addDigit : a -> Fin 10 -> a\n addDigit num d = 10*num + f d\n\nintFromDigits : List (Fin 10) -> Integer\nintFromDigits = fromDigits finToInteger\n\nnatFromDigits : List (Fin 10) -> Nat\nnatFromDigits = fromDigits finToNat\n\n||| Matches a natural number\nexport\ncovering\nnatural : Monad m => ParseT m Nat\nnatural = natFromDigits <$> some digit\n\n||| Matches an integer, eg. \"12\", \"-4\"\nexport\ncovering\ninteger : Monad m => ParseT m Integer\ninteger = do minus <- succeeds (char '-')\n x <- some digit\n pure $ if minus then (intFromDigits x)*(-1) else intFromDigits x\n\n\n||| Parse repeated instances of at least one `p`, separated by `s`,\n||| returning a list of successes.\n|||\n||| @ p the parser for items\n||| @ s the parser for separators\nexport\ncovering\nsepBy1 : Monad m => (p : ParseT m a)\n -> (s : ParseT m b)\n -> ParseT m (List1 a)\nsepBy1 p s = [| p ::: many (s *> p) |]\n\n||| Parse zero or more `p`s, separated by `s`s, returning a list of\n||| successes.\n|||\n||| @ p the parser for items\n||| @ s the parser for separators\nexport\ncovering\nsepBy : Monad m => (p : ParseT m a)\n -> (s : ParseT m b)\n -> ParseT m (List a)\nsepBy p s = optionMap [] forget (p `sepBy1` s)\n\n||| Parses \/one\/ or more occurrences of `p` separated by `comma`.\nexport\ncovering\ncommaSep1 : Monad m => ParseT m a -> ParseT m (List1 a)\ncommaSep1 p = p `sepBy1` (char ',')\n\n||| Parses \/zero\/ or more occurrences of `p` separated by `comma`.\nexport\ncovering\ncommaSep : Monad m => ParseT m a -> ParseT m (List a)\ncommaSep p = p `sepBy` (char ',')\n\n||| Parses alternating occurrences of `a`s and `b`s.\n||| Can be thought of as parsing:\n||| - a list of `b`s, separated, and surrounded, by `a`s\n||| - a non-empty list of `a`s, separated by `b`s\n||| where we care about the separators\nexport\ncovering\nalternating : Monad m\n => ParseT m a\n -> ParseT m b\n -> ParseT m (Odd a b)\nalternating x y = do vx <- x\n (vx ::) <$> [| y :: alternating x y |] <|> pure [vx]\n\n||| Run the specified parser precisely `n` times, returning a vector\n||| of successes.\nexport\nntimes : Monad m => (n : Nat) -> ParseT m a -> ParseT m (Vect n a)\nntimes Z p = pure Vect.Nil\nntimes (S n) p = [| p :: (ntimes n p) |]\n","avg_line_length":32.0024570025,"max_line_length":142,"alphanum_fraction":0.5827255278} +{"size":1453,"ext":"idr","lang":"Idris","max_stars_count":396.0,"content":"module Algebra.Semiring\n\n%default total\n\ninfixl 8 |+|\ninfixl 9 |*|\n\n||| A Semiring has two binary operations and an identity for each\npublic export\ninterface Semiring a where\n (|+|) : a -> a -> a\n plusNeutral : a\n (|*|) : a -> a -> a\n timesNeutral : a\n\n||| Erased linearity corresponds to the neutral for |+|\npublic export\nerased : Semiring a => a\nerased = plusNeutral\n\n||| Purely linear corresponds to the neutral for |*|\npublic export\nlinear : Semiring a => a\nlinear = timesNeutral\n\n||| A semiring eliminator\npublic export\nelimSemi : (Semiring a, Eq a) => (zero : b) -> (one : b) -> (a -> b) -> a -> b\nelimSemi zero one other r {a} =\n if r == Semiring.plusNeutral {a}\n then zero\n else if r == Semiring.timesNeutral {a}\n then one\n else other r\n\nexport\nisErased : (Semiring a, Eq a) => a -> Bool\nisErased = elimSemi True False (const False)\n\nexport\nisLinear : (Semiring a, Eq a) => a -> Bool\nisLinear = elimSemi False True (const False)\n\nexport\nisRigOther : (Semiring a, Eq a) => a -> Bool\nisRigOther = elimSemi False False (const True)\n\nexport\nbranchZero : (Semiring a, Eq a) => Lazy b -> Lazy b -> a -> b\nbranchZero yes no rig = if isErased rig then yes else no\n\nexport\nbranchOne : (Semiring a, Eq a) => Lazy b -> Lazy b -> a -> b\nbranchOne yes no rig = if isLinear rig then yes else no\n\nexport\nbranchVal : (Semiring a, Eq a) => Lazy b -> Lazy b -> a -> b\nbranchVal yes no rig = if isRigOther rig then yes else no\n","avg_line_length":24.6271186441,"max_line_length":78,"alphanum_fraction":0.6524432209} +{"size":7154,"ext":"lidr","lang":"Idris","max_stars_count":null,"content":"> module Opt.Operations\n\n\n> import Control.Isomorphism\n> import Data.Fin\n> import Data.Vect\n> import Syntax.PreorderReasoning\n\n> import Finite.Predicates\n> import Finite.Operations\n> import Finite.Properties\n> import Rel.TotalPreorder\n> import Rel.TotalPreorderOperations\n> import Vect.Operations\n> import Vect.Properties\n> import Fun.Operations\n> import Nat.LTProperties\n\n\n> %default total \n\n> %access public export\n\n\n> |||\n> argmaxMax : {A, B : Type} -> {R : B -> B -> Type} -> \n> TotalPreorder R -> \n> (fA : Finite A) -> \n> (ne : CardNotZ fA) -> \n> (f : A -> B) -> (A, B)\n> argmaxMax {A} {B} tp fA nefA f = max (extendLeftLemma tp) abs ltZn where\n> n : Nat\n> n = card fA\n> ltZn : LT Z n\n> ltZn = notZisgtZ nefA\n> abs : Vect n (A,B)\n> abs = map (pair (id, f)) (toVect fA)\n\n\n> |||\n> max : {A, B : Type} -> {R : B -> B -> Type} -> \n> TotalPreorder R -> \n> (fA : Finite A) -> \n> (ne : CardNotZ fA) -> \n> (f : A -> B) -> B\n> max tp fA nefA f = snd (argmaxMax tp fA nefA f)\n\n\n> |||\n> argmax : {A, B : Type} -> {R : B -> B -> Type} -> \n> TotalPreorder R -> \n> (fA : Finite A) -> \n> (ne : CardNotZ fA) -> \n> (f : A -> B) -> A\n> argmax tp fA nefA f = fst (argmaxMax tp fA nefA f)\n\n\n> |||\n> maxSpec : {A, B : Type} -> {R : B -> B -> Type} -> \n> (tp : TotalPreorder R) -> \n> (fA : Finite A) -> \n> (nefA : CardNotZ fA) -> \n> (f : A -> B) ->\n> (a : A) -> R (f a) (max tp fA nefA f)\n> maxSpec {A} {B} {R} tp fA nefA f a = s4 where\n> n : Nat\n> n = card fA\n> ltZn : LT Z n\n> ltZn = notZisgtZ nefA\n> abs : Vect n (A,B)\n> abs = map (pair (id, f)) (toVect fA)\n> s1 : Elem (a, f a) abs\n> s1 = mapLemma (toVect fA) (pair (id, f)) a (toVectComplete fA a)\n> s2 : (extendLeft R) (a, f a) (max (extendLeftLemma tp) abs ltZn) \n> s2 = maxLemma (extendLeftLemma tp) (a, f a) abs ltZn s1\n> s3 : R (f a) (snd (max (extendLeftLemma tp) abs ltZn))\n> s3 = s2\n> s4 : R (f a) (max tp fA nefA f)\n> s4 = s3\n\n\n> |||\n> argmaxSpec : {A, B : Type} -> {R : B -> B -> Type} -> \n> (tp : TotalPreorder R) -> \n> (fA : Finite A) -> \n> (nefA : CardNotZ fA) -> \n> (f : A -> B) ->\n> (max tp fA nefA f) = f (argmax tp fA nefA f)\n> argmaxSpec {A} {B} tp fA nefA f = s3 where\n> ab : (A,B)\n> ab = argmaxMax tp fA nefA f\n> s1 : Elem ab (map (pair (Prelude.Basics.id, f)) (toVect fA))\n> s1 = maxElemLemma (extendLeftLemma tp) (map (pair (id, f)) (toVect fA)) (notZisgtZ nefA)\n> s2 : f (fst ab) = snd ab\n> s2 = mapIdfLemma (toVect fA) f ab s1\n> s3 : max tp fA nefA f = f (argmax tp fA nefA f)\n> s3 = sym s2\n\n\n> {-\n\n> argmaxMax : {A, B : Type} -> \n> TotalPreorder B -> \n> (fA : Finite A) -> \n> (ne : CardNotZ fA) -> \n> (f : A -> B) -> (A, B)\n> argmaxMax {A} {B} tp fA nefA f = max (fromTotalPreorder2 tp) abs ltZn where\n> n : Nat\n> n = card fA\n> ltZn : LT Z n\n> ltZn = notZisgtZ nefA\n> abs : Vect n (A,B)\n> abs = map (pair (id, f)) (toVect fA)\n\n\n> max : {A, B : Type} ->\n> TotalPreorder B -> \n> (fA : Finite A) -> \n> (ne : CardNotZ fA) -> \n> (f : A -> B) -> B\n> max tp fA nefA f = snd (argmaxMax tp fA nefA f)\n\n\n> argmax : {A, B : Type} ->\n> TotalPreorder B -> \n> (fA : Finite A) -> \n> (ne : CardNotZ fA) -> \n> (f : A -> B) -> A\n> argmax tp fA nefA f = fst (argmaxMax tp fA nefA f)\n\n\n> maxSpec : {A, B : Type} -> \n> (tp : TotalPreorder B) -> \n> (fA : Finite A) -> \n> (nefA : CardNotZ fA) -> \n> (f : A -> B) ->\n> (a : A) -> R tp (f a) (max tp fA nefA f)\n> maxSpec {A} {B} tp fA nefA f a = s4 where\n> n : Nat\n> n = card fA\n> ltZn : LT Z n\n> ltZn = notZisgtZ nefA\n> abs : Vect n (A,B)\n> abs = map (pair (id, f)) (toVect fA)\n> s1 : Elem (a, f a) abs\n> s1 = mapLemma (toVect fA) (pair (id, f)) a (toVectComplete fA a)\n> s2 : (from2 (R tp)) (a, f a) (max (fromTotalPreorder2 tp) abs ltZn) \n> s2 = maxLemma (fromTotalPreorder2 tp) (a, f a) abs ltZn s1\n> s3 : R tp (f a) (snd (max (fromTotalPreorder2 tp) abs ltZn))\n> s3 = s2\n> s4 : R tp (f a) (max tp fA nefA f)\n> s4 = s3\n\n\n> argmaxSpec : {A, B : Type} -> \n> (tp : TotalPreorder B) -> \n> (fA : Finite A) -> \n> (nefA : CardNotZ fA) -> \n> (f : A -> B) ->\n> (max tp fA nefA f) = f (argmax tp fA nefA f)\n> argmaxSpec {A} {B} tp fA nefA f = s3 where\n> ab : (A,B)\n> ab = argmaxMax tp fA nefA f\n> s1 : Elem ab (map (pair (Prelude.Basics.id, f)) (toVect fA))\n> s1 = maxElemLemma (fromTotalPreorder2 tp) (map (pair (id, f)) (toVect fA)) (notZisgtZ nefA)\n> s2 : f (fst ab) = snd ab\n> s2 = mapIdfLemma (toVect fA) f ab s1\n> s3 : max tp fA nefA f = f (argmax tp fA nefA f)\n> s3 = sym s2\n\n\n> {-\n\n> argmaxMax : {A, B : Type} -> {TO : B -> B -> Type} -> \n> Preordered B TO => \n> (fA : Finite A) -> (ne : CardNotZ fA) -> \n> (f : A -> B) -> (A,B)\n> argmaxMax {A} {B} {TO} fA nefA f = \n> VectOperations.max {A = (A,B)} {TO = sndType TO} abs ltZn where\n> n : Nat\n> n = card fA\n> ltZn : LT Z n\n> ltZn = notZisgtZ nefA\n> abs : Vect n (A,B)\n> abs = map (pair (id, f)) (toVect fA)\n\n\n> max : {A, B : Type} -> {TO : B -> B -> Type} -> \n> Preordered B TO => \n> (fA : Finite A) -> (ne : CardNotZ fA) -> \n> (f : A -> B) -> B\n> max fA nefA f = snd (argmaxMax fA nefA f)\n\n\n> argmax : {A, B : Type} -> {TO : B -> B -> Type} -> \n> Preordered B TO => \n> (fA : Finite A) -> (ne : CardNotZ fA) -> \n> (f : A -> B) -> A\n> argmax fA nefA f = fst (argmaxMax fA nefA f)\n\n\n> maxSpec : {A, B : Type} -> {TO : B -> B -> Type} -> \n> Preordered B TO => \n> (fA : Finite A) -> (nefA : CardNotZ fA) -> \n> (f : A -> B) ->\n> (a : A) -> TO (f a) (max fA nefA f)\n> maxSpec {A} {B} {TO} fA nefA f a = s4 where\n> n : Nat\n> n = card fA\n> ltZn : LT Z n\n> ltZn = notZisgtZ nefA\n> abs : Vect n (A,B)\n> abs = map (pair (id, f)) (toVect fA)\n> s1 : Elem (a, f a) abs\n> s1 = mapLemma (toVect fA) (pair (id, f)) a (toVectComplete fA a)\n> s2 : (sndType TO) (a, f a) (max abs ltZn) \n> s2 = maxLemma (a, f a) abs ltZn s1\n> s3 : TO (f a) (snd (max abs ltZn))\n> s3 = s2\n> s4 : TO (f a) (max fA nefA f)\n> s4 = s3\n\n\n> argmaxSpec : {A, B : Type} -> {TO : B -> B -> Type} -> \n> Preordered B TO => \n> (fA : Finite A) -> (nefA : CardNotZ fA) -> \n> (f : A -> B) ->\n> (max fA nefA f) = f (argmax fA nefA f)\n> argmaxSpec {A} {B} fA nefA f = s3 where\n> ab : (A,B)\n> ab = argmaxMax fA nefA f\n> s1 : Elem ab (map (pair (id, f)) (toVect fA))\n> s1 = maxElemLemma (map (pair (id, f)) (toVect fA)) (notZisgtZ nefA)\n> s2 : f (fst ab) = snd ab\n> s2 = mapIdfLemma (toVect fA) f ab s1\n> s3 : max fA nefA f = f (argmax fA nefA f)\n> s3 = sym s2\n\n> -}\n\n> ---}\n","avg_line_length":29.5619834711,"max_line_length":95,"alphanum_fraction":0.4721833939} +{"size":1157,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"module TTImp.ProcessTransform\n\nimport Core.Context\nimport Core.Core\nimport Core.Env\nimport Core.Metadata\nimport Core.Normalise\nimport Core.UnifyState\n\nimport TTImp.Elab\nimport TTImp.Elab.Check\nimport TTImp.ProcessDef -- for checking LHS\nimport TTImp.TTImp\n\n%default covering\n\nexport\nprocessTransform : {vars : _} ->\n {auto c : Ref Ctxt Defs} ->\n {auto m : Ref MD Metadata} ->\n {auto u : Ref UST UState} ->\n List ElabOpt -> NestedNames vars -> Env Term vars -> FC ->\n Name -> RawImp -> RawImp -> Core ()\nprocessTransform eopts nest env fc tn_in lhs rhs\n = do tn <- inCurrentNS tn_in\n tidx <- resolveName tn\n (_, (vars' ** (sub', env', nest', lhstm, lhsty))) <-\n checkLHS True top True tidx eopts nest env fc lhs\n logTerm \"\" 3 \"Transform LHS\" lhstm\n rhstm <- wrapError (InRHS fc tn_in) $\n checkTermSub tidx InExpr (InTrans :: eopts) nest' env' env sub' rhs (gnf env' lhsty)\n clearHoleLHS\n logTerm \"\" 3 \"Transform RHS\" rhstm\n addTransform fc (MkTransform tn env' lhstm rhstm)\n","avg_line_length":33.0571428571,"max_line_length":107,"alphanum_fraction":0.6032843561} +{"size":5323,"ext":"idr","lang":"Idris","max_stars_count":13.0,"content":"module Data.Nat.NatTheorems\n\nimport Data.Bool.BoolTheorems\n\n%default total\n%access export\n\n-- Raw Nat comparison is very inefficient at runtime, so lets make some faster\n-- operations that take advantage of the compiler optimisations for Nat, and make\n-- some assertions about them. Note that toIntegerNat and fromInteger are special\n-- case in the compiler to be the identity, overriding their normal definitions.\n\npublic export\neqNat : Nat -> Nat -> Bool\neqNat x y = toIntegerNat x == toIntegerNat y\n\npublic export\nltNat : Nat -> Nat -> Bool\nltNat x y = toIntegerNat x < toIntegerNat y\n\npublic export\nleNat : Nat -> Nat -> Bool\nleNat x y = toIntegerNat x <= toIntegerNat y\n\npublic export\ngtNat : Nat -> Nat -> Bool\ngtNat x y = toIntegerNat x > toIntegerNat y\n\npublic export\ngeNat : Nat -> Nat -> Bool\ngeNat x y = toIntegerNat x >= toIntegerNat y\n\n%hint\neqNatIsEq : eqNat x y = r -> x == y = r\neqNatIsEq prf = believe_me prf\n\n%hint\nltNatIsLt : {x: Nat} -> {y : Nat} -> {r: Bool} -> ltNat x y = r -> x < y = r\nltNatIsLt prf = believe_me prf\n\n%hint\nleNatIsLt : leNat x y = r -> x <= y = r\nleNatIsLt prf = believe_me prf\n\n%hint\ngtNatIsLt : gtNat x y = r -> x > y = r\ngtNatIsLt prf = believe_me prf\n\n%hint\ngeNatIsLt : geNat x y = r -> x >= y = r\ngeNatIsLt prf = believe_me prf\n\n-- Theorems about Nat compare\n\nUninhabited (EQ = LT) where\n uninhabited Refl impossible\nUninhabited (EQ = GT) where\n uninhabited Refl impossible\nUninhabited (Interfaces.GT = LT) where\n uninhabited Refl impossible\nUninhabited (Interfaces.GT = EQ) where\n uninhabited Refl impossible\nUninhabited (LT = EQ) where\n uninhabited Refl impossible\nUninhabited (LT = Interfaces.GT) where\n uninhabited Refl impossible\n\nnatCompareSASBOImpliesCompareABO : (a : Nat)\n -> (b : Nat)\n -> (o : Ordering)\n -> compare (S a) (S b) = o\n -> compare a b = o\nnatCompareSASBOImpliesCompareABO a b o prf = prf\n\n-- Theorems about Nat equality...\n\nnatSAEqSBTrueImpliesAEqBTrue : (a : Nat) -> (b : Nat) ->\n (S a == S b = True) -> a == b = True\nnatSAEqSBTrueImpliesAEqBTrue a b prf = prf\n\nnatAEqBTrueImpliesEq : (a : Nat) -> (b : Nat) -> (a == b = True) -> a = b\nnatAEqBTrueImpliesEq Z Z _ = Refl\nnatAEqBTrueImpliesEq Z (S x) prf = absurd prf\nnatAEqBTrueImpliesEq (S x) Z prf = absurd prf\nnatAEqBTrueImpliesEq (S x) (S y) prf =\n eqSucc x y (natAEqBTrueImpliesEq x y (natSAEqSBTrueImpliesAEqBTrue x y prf))\n\nnatComparesAsEQImpliesEq : (a : Nat) -> (b : Nat) -> compare a b = EQ -> a = b\nnatComparesAsEQImpliesEq Z Z _ = Refl\nnatComparesAsEQImpliesEq (S _) Z prf = absurd prf\nnatComparesAsEQImpliesEq Z (S _) prf = absurd prf\nnatComparesAsEQImpliesEq (S x) (S y) prf = eqSucc x y (natComparesAsEQImpliesEq x y prf)\n\n-- Theorems about Nat less than\n\nnatALtZIsFalse : (a : Nat) -> (a < 0) = False\nnatALtZIsFalse Z = Refl\nnatALtZIsFalse (S _) = Refl\n\nnatComparesAsLtImpliesLT : (a : Nat) -> (b : Nat) -> compare a b = LT -> LT a b\nnatComparesAsLtImpliesLT Z Z prf = absurd prf\nnatComparesAsLtImpliesLT (S x) Z prf = absurd prf\nnatComparesAsLtImpliesLT Z (S x) _ = LTESucc (LTEZero)\nnatComparesAsLtImpliesLT (S x) (S y) prf =\n LTESucc $ natComparesAsLtImpliesLT x y (natCompareSASBOImpliesCompareABO x y LT prf)\n\nnatALtBTrueImpliesComparesAsLT : (a : Nat) -> (b : Nat) -> a < b = True -> compare a b = LT\nnatALtBTrueImpliesComparesAsLT a b prf with (compare a b)\n natALtBTrueImpliesComparesAsLT _ _ prf | GT = absurd prf\n natALtBTrueImpliesComparesAsLT _ _ prf | EQ = absurd prf\n natALtBTrueImpliesComparesAsLT _ _ prf | LT = Refl\n\nnatALtBIsFalseImpliesComparesAsEQOrGT : (a : Nat) -> (b : Nat) -> (a < b = False) -> Either (compare a b = EQ) (compare a b = GT)\nnatALtBIsFalseImpliesComparesAsEQOrGT a b prf with (compare a b)\n natALtBIsFalseImpliesGTEAB _ _ _ | GT = Right Refl\n natALtBIsFalseImpliesGTEAB _ _ _ | EQ = Left Refl\n natALtBIsFalseImpliesGTEAB _ _ prf | LT = absurd prf\n\nnatALtBIsTrueImpliesLTAB : (a : Nat) -> (b : Nat) -> (a < b = True) -> LT a b\nnatALtBIsTrueImpliesLTAB a b prf =\n natComparesAsLtImpliesLT a b (natALtBTrueImpliesComparesAsLT a b prf)\n\n-- Theorems about Nat <=\n\nnatALTBImpliesALTEB : (a : Nat) -> (b : Nat) -> LT a b -> LTE a b\nnatALTBImpliesALTEB a b prf = lteSuccLeft prf\n\n-- Theorems about Nat <\n\nnatComparesAsGTImpliesGT : (a : Nat) -> (b : Nat) -> compare a b = GT -> GT a b\nnatComparesAsGTImpliesGT Z Z prf = absurd prf\nnatComparesAsGTImpliesGT (S _) Z _ = LTESucc LTEZero\nnatComparesAsGTImpliesGT Z (S _) prf = absurd prf\nnatComparesAsGTImpliesGT (S x) (S y) prf = LTESucc (natComparesAsGTImpliesGT x y prf)\n\n-- Theorems about Nat >=\n\nnatEQImpliesGTE : (a : Nat) -> (b : Nat) -> (a = b) -> GTE a b\nnatEQImpliesGTE a b prf = rewrite prf in lteRefl\n\nnatGTImpliesGTE : (a : Nat) -> (b : Nat) -> (GT a b) -> GTE a b\nnatGTImpliesGTE a b prf = lteSuccLeft prf\n\nnatComparesAsEQOrGTImpliesGTE :\n (a : Nat) ->\n (b : Nat) ->\n Either (compare a b = EQ) (compare a b = GT) ->\n GTE a b\nnatComparesAsEQOrGTImpliesGTE a b (Left eqPrf) =\n natEQImpliesGTE a b (natComparesAsEQImpliesEq a b eqPrf)\nnatComparesAsEQOrGTImpliesGTE a b (Right gtPrf) =\n natGTImpliesGTE a b (natComparesAsGTImpliesGT a b gtPrf)\n\nnatALtBIsFalseImpliesGTEAB : (a : Nat) -> (b : Nat) -> (a < b = False) -> GTE a b\nnatALtBIsFalseImpliesGTEAB a b prf =\n natComparesAsEQOrGTImpliesGTE a b (natALtBIsFalseImpliesComparesAsEQOrGT a b prf)\n","avg_line_length":33.9044585987,"max_line_length":129,"alphanum_fraction":0.7043020853} +{"size":4729,"ext":"idr","lang":"Idris","max_stars_count":16.0,"content":"module Language.Elab.Types\n\nimport Language.Elab.Syntax\n\nimport Language.Reflection\n\nimport Util\n\n%language ElabReflection\n\n-- Helper types for deriving more cleanly\n\n-- A argument to a constructor along with additional relation data like whether it's an index of the type\npublic export\nrecord ArgInfo where\n constructor MkArgInfo\n count : Count\n piInfo : PiInfo TTImp\n name : Name\n type : TTImp\n isIndex : Bool -- as in not a parameter\n -- An index has its name in the return type and is not a basic %type\n -- Nat is an index in MkFoo : Foo a Z\n -- (n : Nat) is an index in Foo a n\n --------------\n -- meta : Maybe MetaArgInfo\n -- position : Nat\n -- Do I need the position if I can establish it's an index anyway?\n\nexport\nShow ArgInfo where\n show (MkArgInfo count piInfo name type ind)\n = \"MkArgInfo \" ++ show count ++ \" \" ++ show piInfo ++ \" \" ++ showPrec App name ++ \" \" ++ \"tyttimp \" ++ show ind\n\nexport\nlogArgInfo : Nat -> ArgInfo -> Elab ()\nlogArgInfo n (MkArgInfo count piInfo name type isIndex) = do\n logMsg \"logArgInfo\" n $ \"MkArgInfo \" ++ show count ++ \" \" ++ show piInfo ++ \" \" ++ showPrec App name\n logTerm \"logArgInfo\" n \"argimp: \" type\n\n\n-- Fully qualified Name\n-- `type` is our fully applied type, e.g. given args a,b,c: Foo a b c\npublic export\nrecord Constructor where\n constructor MkConstructor\n name : Name\n args : List ArgInfo\n type : TTImp\n\n-- Fully qualified Name\n-- `type` is our fully applied type, e.g. given args a,b,c: Foo a b c\npublic export\nrecord TypeInfo where\n constructor MkTypeInfo\n name : Name\n args : List ArgInfo\n cons : List Constructor\n type : TTImp\n\n\n-- This seems to be fairly slow, not sure why\ninfix 8 `indexOf`\nprivate\ntotal\nindexOf : Name -> TTImp -> Bool\nindexOf n1 (IVar _ n2) = n1 == n2\nindexOf l (IApp _ z w) = indexOf l z || indexOf l w\nindexOf _ _ = False\n\n\n-- workhorse of the module, though you'll tend to use it through makeTypeInfo\n-- If an argument doesn't have a name we generate one for it, this simplifies\n-- use of names. That being said idris (with PR 337) should have already\n-- generated names for everything so this shouldn't come up often.\n-- TODO: revisit this decision\nexport\ngetConType : Name -> Elab (List ArgInfo, TTImp)\ngetConType qn = go (snd !(lookupName qn))\n where\n go : TTImp -> Elab (List ArgInfo, TTImp)\n go (IPi _ c i n0 argTy retTy0) = do\n (xs,retTy1) <- go retTy0\n let n1 = maybe !(genSym \"arg\") id n0\n logMsg \"getConType\" 1 \"compute\"\n let b = maybe False (`indexOf`retTy1) n0\n pure $ (MkArgInfo c i n1 argTy b :: xs, retTy1)\n go retTy = pure ([],retTy)\n\n-- makes them unique for now\nexport\ngenArgs : Name -> Elab (List ArgInfo)\ngenArgs qn = do (_,tyimp) <- lookupName qn\n go tyimp\n where\n go : TTImp -> Elab (List ArgInfo)\n go (IPi _ c i n argTy retTy)\n = let isIndex = not (isType argTy) -- && isExplicitPi i\n in [| pure (MkArgInfo c i !(readableGenSym \"arg\") argTy isIndex) :: go retTy |]\n go _ = pure []\n\n\n-- TODO try making this explicitly to reduce quoting\n-- Takes String so that you can process the names as you like\n-- NB: Likely to change\nexport\nappTyCon : List String -> Name -> TTImp\nappTyCon ns n = foldl (\\tt,v => `( ~(tt) ~(iBindVar v) )) (iVar n) ns\n\nexport\npullExplicits : TypeInfo -> List ArgInfo\npullExplicits x = filter (isExplicitPi . piInfo) (args x)\n\nexport\npullImplicits : TypeInfo -> List ArgInfo\npullImplicits x = filter (isImplicitPi . piInfo) (args x)\n\nargnam : ArgInfo -> Name\nargnam (MkArgInfo count piInfo name type isIndex) = name\n\n-- not bad start, we might try not renaming here, make names at use-site?\nexport\nmakeTypeInfo : Name -> Elab TypeInfo\nmakeTypeInfo n = do\n logMsg \"makeTypeInfo\" 1 \"bado\"\n (tyname,tyimp) <- lookupName n\n args <- genArgs n\n connames <- getCons tyname\n conlist <- traverse getConType connames\n logMsg \"makeTypeInfo\" 1 \"I'm being computed\"\n let tyargs = filter (isExplicitPi . piInfo) args\n ty = appTyCon (map (\\arg => extractNameStr arg.name) tyargs) tyname\n pure $ MkTypeInfo tyname args\n (zipWith (\\x,(y,z) => MkConstructor x y z) connames conlist) ty\n\n\n\n-----------------------------\n-- Testing Area\n-----------------------------\n-- {-\ndata MyNat' : Type where\n MZ' : MyNat'\n MS' : MyNat' -> MyNat'\n\n-- Time making this is directly related to arg count\ndata Foo6'' : Type -> Type -> Type -> Nat -> Type where\n Zor6'' : a -> b -> Foo6'' a b c Z\n Gor6'' : b -> Foo6'' a b c (S k)\n Nor6A'' : a -> b -> c -> c -> c -> c -> (n : Nat) -> Foo6'' a b c n\n Nor6B'' : a -> (0 _ : b) -> c -> Foo6'' a b c n -- NB: 0 Use arg\n Bor6'' : Foo6'' a b c n\n Wah6'' : a -> (n : Nat) -> Foo6'' a b c n\n\n{-\n-- I need a minimal example of reflected OrderedSet failing\n-}\n","avg_line_length":29.9303797468,"max_line_length":115,"alphanum_fraction":0.6513004864} +{"size":4415,"ext":"idr","lang":"Idris","max_stars_count":396.0,"content":"module Prelude.IO\n\nimport Builtin\nimport PrimIO\nimport Prelude.Basics\nimport Prelude.Interfaces\nimport Prelude.Show\n\n%default total\n\n--------\n-- IO --\n--------\n\npublic export\nFunctor IO where\n map f io = io_bind io $ io_pure . f\n\n%inline\npublic export\nApplicative IO where\n pure x = io_pure x\n f <*> a\n = io_bind f (\\f' =>\n io_bind a (\\a' =>\n io_pure (f' a')))\n\n%inline\npublic export\nMonad IO where\n b >>= k = io_bind b k\n\npublic export\ninterface Monad io => HasIO io where\n constructor MkHasIO\n liftIO : IO a -> io a\n\npublic export\ninterface Monad io => HasLinearIO io where\n constructor MkHasLinearIO\n liftIO1 : (1 _ : IO a) -> io a\n\npublic export %inline\nHasLinearIO IO where\n liftIO1 x = x\n\npublic export %inline\nHasLinearIO io => HasIO io where\n liftIO x = liftIO1 x\n\nexport %inline\nprimIO : HasIO io => (fn : (1 x : %World) -> IORes a) -> io a\nprimIO op = liftIO (fromPrim op)\n\nexport %inline\nprimIO1 : HasLinearIO io => (1 fn : (1 x : %World) -> IORes a) -> io a\nprimIO1 op = liftIO1 (fromPrim op)\n\n%extern\nprim__onCollectAny : AnyPtr -> (AnyPtr -> PrimIO ()) -> PrimIO GCAnyPtr\n%extern\nprim__onCollect : Ptr t -> (Ptr t -> PrimIO ()) -> PrimIO (GCPtr t)\n\nexport\nonCollectAny : AnyPtr -> (AnyPtr -> IO ()) -> IO GCAnyPtr\nonCollectAny ptr c = fromPrim (prim__onCollectAny ptr (\\x => toPrim (c x)))\n\nexport\nonCollect : Ptr t -> (Ptr t -> IO ()) -> IO (GCPtr t)\nonCollect ptr c = fromPrim (prim__onCollect ptr (\\x => toPrim (c x)))\n\n%foreign \"C:idris2_getString, libidris2_support, idris_support.h\"\n \"javascript:lambda:x=>x\"\n \"jvm:getString,io\/github\/mmhelloworld\/idrisjvm\/runtime\/Objects\"\nexport\nprim__getString : Ptr String -> String\n\n%foreign \"C:putchar,libc 6\"\n \"jvm:putChar(char void),io\/github\/mmhelloworld\/idrisjvm\/runtime\/Console\"\nprim__putChar : Char -> (1 x : %World) -> IORes ()\n%foreign \"C:getchar,libc 6\"\n \"jvm:getChar(java\/lang\/Object char),io\/github\/mmhelloworld\/idrisjvm\/runtime\/Console\"\n%extern prim__getChar : (1 x : %World) -> IORes Char\n\n%foreign \"C:idris2_getStr, libidris2_support, idris_support.h\"\n \"node:support:getStr,support_system_file\"\n \"jvm:getString(java\/lang\/Object java\/lang\/String),io\/github\/mmhelloworld\/idrisjvm\/runtime\/Console\"\nprim__getStr : PrimIO String\n\n%foreign \"C:idris2_putStr, libidris2_support, idris_support.h\"\n \"node:lambda:x=>process.stdout.write(x)\"\n \"jvm:printString,io\/github\/mmhelloworld\/idrisjvm\/runtime\/Console\"\nprim__putStr : String -> PrimIO ()\n\n||| Output a string to stdout without a trailing newline.\nexport\nputStr : HasIO io => String -> io ()\nputStr str = primIO (prim__putStr str)\n\n||| Output a string to stdout with a trailing newline.\nexport\nputStrLn : HasIO io => String -> io ()\nputStrLn str = putStr (prim__strAppend str \"\\n\")\n\n||| Read one line of input from stdin, without the trailing newline.\nexport\ngetLine : HasIO io => io String\ngetLine = primIO prim__getStr\n\n||| Write one single-byte character to stdout.\nexport\nputChar : HasIO io => Char -> io ()\nputChar c = primIO (prim__putChar c)\n\n||| Write one multi-byte character to stdout, with a trailing newline.\nexport\nputCharLn : HasIO io => Char -> io ()\nputCharLn c = putStrLn (prim__cast_CharString c)\n\n||| Read one single-byte character from stdin.\nexport\ngetChar : HasIO io => io Char\ngetChar = primIO prim__getChar\n\n%foreign \"scheme:blodwen-thread\"\n \"jvm:fork(java\/util\/function\/Function#apply#java\/lang\/Object#java\/lang\/Object java\/util\/concurrent\/ForkJoinTask),io\/github\/mmhelloworld\/idrisjvm\/runtime\/Runtime\"\nexport\nprim__fork : (1 prog : PrimIO ()) -> PrimIO ThreadID\n\nexport\nfork : (1 prog : IO ()) -> IO ThreadID\nfork act = fromPrim (prim__fork (toPrim act))\n\n%foreign \"scheme:blodwen-thread-wait\"\n \"jvm:await(java\/util\/concurrent\/ForkJoinTask void),io\/github\/mmhelloworld\/idrisjvm\/runtime\/Runtime\"\nexport\nprim__threadWait : (1 threadID : ThreadID) -> PrimIO ()\n\nexport\nthreadWait : (1 threadID : ThreadID) -> IO ()\nthreadWait threadID = fromPrim (prim__threadWait threadID)\n\n%foreign \"C:idris2_readString, libidris2_support, idris_support.h\"\nexport\nprim__getErrno : Int\n\n||| Output something showable to stdout, without a trailing newline.\nexport\nprint : (HasIO io, Show a) => a -> io ()\nprint x = putStr $ show x\n\n||| Output something showable to stdout, with a trailing newline.\nexport\nprintLn : (HasIO io, Show a) => a -> io ()\nprintLn x = putStrLn $ show x\n","avg_line_length":28.3012820513,"max_line_length":170,"alphanum_fraction":0.704416761} +{"size":708,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"module Prims\n\ndata MyList a = Nil | (:::) a (MyList a)\n\ninfixr 10 :::\n\n-- *Prims> 1 ::: Nil\n-- 1 ::: [] : MyList Integer\n-- *Prims> 0 ::: 1 ::: Nil\n-- 0 ::: 1 ::: [] : MyList Integer\n\n-- Idris requires type declarations, using a single colon :\nhead' : MyList a -> Maybe a\nhead' Nil = Nothing\nhead' (x ::: xs) = Just x\n\n-- *Prims> :let ls : MyList Nat; ls = 0 ::: 1 ::: Nil\n-- *Prims> head' ls\n-- Just 0 : Maybe Nat\n\n-- data Nat = Z | S Nat Natural numbers (zero and successor)\n-- Z : Nat data constructors\n\nplus' : Nat -> Nat -> Nat\nplus' Z y = y\nplus' (S k) y = S (plus' k y)\n\nx : Int\nx = 123\n\nfoo : String\nfoo = \"boo\"\n\nbar : Char\nbar = 'X'\n\nbool : Bool\nbool = True\n","avg_line_length":18.1538461538,"max_line_length":72,"alphanum_fraction":0.5282485876} +{"size":1171,"ext":"idr","lang":"Idris","max_stars_count":112.0,"content":"module Quantities.SIBaseUnits\n\nimport Quantities.Core\nimport Quantities.SIPrefixes\nimport Quantities.SIBaseQuantities\n\n%default total\n%access public export\n\nMetre : ElemUnit Length\nMetre = MkElemUnit \"m\" 1\nMeter : ElemUnit Length\nMeter = Metre\nM : ElemUnit Length\nM = Meter\n\nCentimetre : Unit Length\nCentimetre = centi Metre\nCentimeter : Unit Length\nCentimeter = Centimetre\nCm : Unit Length\nCm = Centimetre\n\nKilometre : Unit Length\nKilometre = kilo Metre\nKilometer : Unit Length\nKilometer = Kilometre\nKm : Unit Length\nKm = Kilometre\n\nGram : ElemUnit Mass\nGram = MkElemUnit \"g\" 0.001\nG : ElemUnit Mass\nG = Gram\n\nKilogram : Unit Mass\nKilogram = kilo Gram\nKg : Unit Mass\nKg = Kilogram\n\nSecond : ElemUnit Time\nSecond = MkElemUnit \"s\" 1\nS : ElemUnit Time\nS = Second\n\nAmpere : ElemUnit ElectricCurrent\nAmpere = MkElemUnit \"A\" 1\nA : ElemUnit ElectricCurrent\nA = Ampere\n\nKelvin : ElemUnit Temperature\nKelvin = MkElemUnit \"K\" 1\nK : ElemUnit Temperature\nK = Kelvin\n\nMole : ElemUnit AmountOfSubstance\nMole = MkElemUnit \"mol\" 1\nMol : ElemUnit AmountOfSubstance\nMol = Mole\n\nCandela : ElemUnit LuminousIntensity\nCandela = MkElemUnit \"cd\" 1\nCd : ElemUnit LuminousIntensity\nCd = Candela\n","avg_line_length":18.0153846154,"max_line_length":36,"alphanum_fraction":0.7694278395} +{"size":1515,"ext":"idr","lang":"Idris","max_stars_count":40.0,"content":"{- Copied straight from the book -}\nmodule Part2.Sec6_2_2_printf\n\n{- This one is like recursive enumeration -}\ndata Format = Number Format\n | Str Format\n | Lit String Format\n | End\n\n{- Nice recursive definition that ends up resolving to a long function returning String.\n This ends up being implementable with TypeFamilies and DataKinds (for Format) in Haskell. -}\nPrintfType : Format -> Type\nPrintfType (Number fmt) = (i : Int) -> PrintfType fmt\nPrintfType (Str fmt) = (str : String) -> PrintfType fmt\nPrintfType (Lit str fmt) = PrintfType fmt\nPrintfType End = String\n\n{- CPS implemenation that still maps nicely to Haskell -}\nprintfFmt : (fmt : Format) -> (acc : String) -> PrintfType fmt\nprintfFmt (Number fmt) acc = \\i => printfFmt fmt (acc ++ show i)\nprintfFmt (Str fmt) acc = \\str => printfFmt fmt (acc ++ str)\nprintfFmt (Lit lit fmt) acc = printfFmt fmt (acc ++ lit)\nprintfFmt End acc = acc\n\n\n{- No dependent typing here -}\ntoFormat : (xs : List Char) -> Format\ntoFormat [] = End\ntoFormat ('%' :: 'd' :: chars) = Number (toFormat chars)\ntoFormat ('%' :: 's' :: chars) = Str (toFormat chars)\ntoFormat ('%' :: chars) = Lit \"%\" (toFormat chars)\ntoFormat (c :: chars) = case toFormat chars of\n Lit lit chars' => Lit (strCons c lit) chars'\n fmt => Lit (strCons c \"\") fmt\n\n{- Hah, so simple! Currently no such luck in Haskell -}\nprintf : (fmt : String) -> PrintfType (toFormat (unpack fmt))\nprintf fmt = printfFmt _ \"\"\n","avg_line_length":38.8461538462,"max_line_length":95,"alphanum_fraction":0.6429042904} +{"size":5328,"ext":"idr","lang":"Idris","max_stars_count":34.0,"content":"module Test.SemVar.ParserTest\n\nimport IdrTest.Test\nimport IdrTest.Expectation\n\nimport SemVar\nimport SemVar.Data\nimport SemVar.Parser\n\nversionSpecs : List (String, Maybe Version)\nversionSpecs =\n [\n (\n \"1.2.3-prerelease+commit\",\n Just (MkVersion 1 2 3 (Just \"prerelease\") (Just \"commit\"))\n ),\n (\n \"1.2.3\",\n Just (MkVersion 1 2 3 Nothing Nothing)\n )\n ]\n\n-- TODO: Build a lot more examples from https:\/\/devhints.io\/semver\n-- TODO: Cover wildcards and partial ranges\nreqSpecs : List (String, Maybe Requirement)\nreqSpecs =\n [\n (\n \"~1.2.3\",\n Just (\n AND\n (GTE $ MkVersion 1 2 3 Nothing Nothing)\n (LT $ MkVersion 1 3 0 Nothing Nothing)\n )\n ),\n (\n \"^1.2.3\",\n Just (\n AND\n (GTE $ MkVersion 1 2 3 Nothing Nothing)\n (LT $ MkVersion 2 0 0 Nothing Nothing)\n )\n ),\n (\n \"^0.2.3\",\n Just (\n AND\n (GTE $ MkVersion 0 2 3 Nothing Nothing)\n (LT $ MkVersion 0 3 0 Nothing Nothing)\n )\n ),\n (\n \"^0.0.1\",\n Just (\n EQ $ MkVersion 0 0 1 Nothing Nothing\n )\n ),\n (\n \"^1.2\",\n Just (\n AND\n (GTE $ MkVersion 1 2 0 Nothing Nothing)\n (LT $ MkVersion 2 0 0 Nothing Nothing)\n )\n ),\n (\n \"~1.2\",\n Just (\n AND\n (GTE $ MkVersion 1 2 0 Nothing Nothing)\n (LT $ MkVersion 1 3 0 Nothing Nothing)\n )\n ),\n (\n \"^1\",\n Just (\n AND\n (GTE $ MkVersion 1 0 0 Nothing Nothing)\n (LT $ MkVersion 2 0 0 Nothing Nothing)\n )\n ),\n -- (\n -- \"~1\",\n -- Just (\n -- AND\n -- (GTE $ MkVersion 1 0 0 Nothing Nothing)\n -- (LT $ MkVersion 2 0 0 Nothing Nothing)\n -- )\n -- ),\n -- (\n -- \"1.x\",\n -- Just (\n -- AND\n -- (GTE $ MkVersion 1 0 0 Nothing Nothing)\n -- (LT $ MkVersion 2 0 0 Nothing Nothing)\n -- )\n -- ),\n -- (\n -- \"1\",\n -- Just (\n -- AND\n -- (GTE $ MkVersion 1 0 0 Nothing Nothing)\n -- (LT $ MkVersion 2 0 0 Nothing Nothing)\n -- )\n -- ),\n -- (\n -- \"*\",\n -- Just (\n -- GTE $ MkVersion 0 0 0 Nothing Nothing\n -- )\n -- ),\n -- (\n -- \"x\",\n -- Just (\n -- GTE $ MkVersion 0 0 0 Nothing Nothing\n -- )\n -- ),\n -- (\n -- \"1.2.x\",\n -- Just (\n -- AND\n -- (GTE $ MkVersion 1 2 0 Nothing Nothing)\n -- (LT $ MkVersion 1 3 0 Nothing Nothing)\n -- )\n -- ),\n -- (\n -- \">= 1.2.x\",\n -- Just (\n -- GTE $ MkVersion 1 2 0 Nothing Nothing\n -- )\n -- ),\n -- (\n -- \"<= 2.x\",\n -- Just (\n -- LT $ MkVersion 3 0 0 Nothing Nothing\n -- )\n -- ),\n -- (\n -- \"~1.2.x\",\n -- Just (\n -- AND\n -- (GTE $ MkVersion 1 2 0 Nothing Nothing)\n -- (LT $ MkVersion 1 3 0 Nothing Nothing)\n -- )\n -- ),\n (\n \"1.2.3\",\n Just (\n EQ $ MkVersion 1 2 3 Nothing Nothing\n )\n ),\n (\n \"=1.2.3\",\n Just (\n EQ $ MkVersion 1 2 3 Nothing Nothing\n )\n ),\n (\n \">1.2.3\",\n Just (\n GT $ MkVersion 1 2 3 Nothing Nothing\n )\n ),\n (\n \"<1.2.3\",\n Just (\n LT $ MkVersion 1 2 3 Nothing Nothing\n )\n ),\n (\n \">=1.2.3\",\n Just (\n GTE $ MkVersion 1 2 3 Nothing Nothing\n )\n ),\n (\n \"1.2.3 - 2.3.4\",\n Just (\n AND\n (GTE $ MkVersion 1 2 3 Nothing Nothing)\n (LTE $ MkVersion 2 3 4 Nothing Nothing)\n )\n ),\n -- (\n -- \"1.2.3 - 2.3\",\n -- Just (\n -- AND\n -- (GTE $ MkVersion 1 2 3 Nothing Nothing)\n -- (LT $ MkVersion 2 4 0 Nothing Nothing)\n -- )\n -- ),\n -- (\n -- \"1.2.3 - 2\",\n -- Just (\n -- AND\n -- (GTE $ MkVersion 1 2 3 Nothing Nothing)\n -- (LT $ MkVersion 3 0 0 Nothing Nothing)\n -- )\n -- ),\n -- (\n -- \"1.2 - 2.3.0\",\n -- Just (\n -- AND\n -- (GTE $ MkVersion 1 2 0 Nothing Nothing)\n -- (LTE $ MkVersion 2 3 0 Nothing Nothing)\n -- )\n -- ),\n (\n \">=0.14 <16\",\n Just (\n AND\n (GTE $ MkVersion 0 14 0 Nothing Nothing)\n (LT $ MkVersion 16 0 0 Nothing Nothing)\n )\n ),\n (\n \"0.14.0 || 15.0.0\",\n Just (\n OR\n (EQ $ MkVersion 0 14 0 Nothing Nothing)\n (EQ $ MkVersion 15 0 0 Nothing Nothing)\n )\n )\n -- (\n -- \"0.14.x || 15.x.x\",\n -- Just (\n -- OR\n -- (AND\n -- (GTE $ MkVersion 0 14 0 Nothing Nothing)\n -- (LT $ MkVersion 16 0 0 Nothing Nothing)\n -- )\n -- (AND\n -- (GTE $ MkVersion 0 14 0 Nothing Nothing)\n -- (LT $ MkVersion 16 0 0 Nothing Nothing)\n -- )\n -- )\n -- )\n ]\n\nexport\nsuite : Test\nsuite =\n let\n versionTests =\n map (\\(text, result) =>\n test text (\\_ => assertEq (parseVersion text) result)\n ) versionSpecs\n\n reqTests =\n map (\\(text, result) =>\n test text (\\_ => assertEq (parseRequirement text) result)\n ) reqSpecs\n in\n describe \"Parser Tests\"\n [ describe \"Version Specs\" versionTests\n , describe \"Requirement Specs\" reqTests\n ]\n","avg_line_length":20.6511627907,"max_line_length":66,"alphanum_fraction":0.4256756757} +{"size":5368,"ext":"idr","lang":"Idris","max_stars_count":9.0,"content":"{- This Source Code Form is subject to the terms of the Mozilla Public\n - License, v. 2.0. If a copy of the MPL was not distributed with this\n - file, You can obtain one at http:\/\/mozilla.org\/MPL\/2.0\/. -}\n\nmodule Main\n\nimport Todo\nimport TodoHtml\n\nimport Event\nimport Http\nimport Record\n\nimport FerryJS\nimport FerryJS.Util\n\nimport Sql\nimport Sql.JS\n\nimport Html as H\n\nimport Effects\nimport Data.String\n\nimport Debug.Error\nimport Debug.Trace\n\n-- To use the error function\n%language ElabReflection\n\nServer : Type\nServer = Event Multiple (Request, Response)\n\ndata Msg = NewRequest (Request, Response)\n\nState : Type\nState = (Callback Msg, DBConnection)\n\nconnection : JS_IO (Maybe DBConnection)\nconnection = do\n args <- getArgs\n (case args of\n -- Todo: better error handling\n [_, _, db, name, pass] => Just <$> newConnection {user=name} {database=db} {password=pass}\n _ => pure Nothing)\n\n-- Next state function\n\nignore : JS_IO a -> JS_IO ()\nignore = map (const ())\n\nrespondWithTodos : Response -> List Todo -> JS_IO ()\nrespondWithTodos res ts = do\n str <- showTodos ts\n write res str\n\nRoute : Type\nRoute = State -> (Request, Response) -> JS_IO State\n\nreturnTodos : Route\nreturnTodos st@(cb, conn) (req, res) = do\n result <- runSelectQuery selectAll conn\n execute $ map (respondWithTodos res) (waitSelectResult result)\n pure st\n\nrespondMessageCode : String -> Nat -> Route\nrespondMessageCode msg code st (req, res) = do\n setStatusCode res code\n write res msg\n pure st\n\nrespondMessage : String -> Route\nrespondMessage msg = respondMessageCode msg 200\n\n-- Todo: set 404 header\nnotFound : Route\nnotFound = respondMessageCode \"Not found\" 404\n\nrespondWithForm : Response -> List Todo -> JS_IO ()\nrespondWithForm res [t] = do\n page <- withinContent [todoForm t]\n write res page\nrespondWithForm res [] = write res \"Could not find Todo with given id\"\nrespondWithForm res _ = \n error \"Todo error: should not find multiple values for private key 'id'\"\n\ndisplayForm : Int -> Route\ndisplayForm id st@(cb, conn) (req, res) = do\n result <- runSelectQuery (selectWhereId id) conn\n execute $ map (respondWithForm res) (waitSelectResult result)\n pure st\n\neditTodo : Route\neditTodo st@(cb, conn) (req, res) =\n let url = getUrl req\n in let search = getQueryAs {sch=[(\"id\", String)]} url\n in case search of\n Nothing => notFound st (req, res)\n Just rec =>\n let id = parseInteger (rec .. \"id\") {a=Int}\n in case id of\n Just id => displayForm id st (req, res)\n Nothing => respondMessage \"Error converting id to Int\" st (req, res)\n\nnewTodo : Route\nnewTodo st@(cb, conn) (req, res) = do\n page <- withinContent [emptyForm]\n write res page\n pure st\n\nupsertTodo : Todo -> DBConnection -> JS_IO (Event Single Int)\nupsertTodo t conn =\n case t .. \"id\" of\n Nothing => waitRowCountResult <$> runInsertQuery (insertTodo t) conn\n Just id => waitRowCountResult <$> runUpdateQuery (updateTodo t) conn\n\nconvertId : Maybe String -> Maybe Int\nconvertId = join . map (parseInteger {a=Int})\n\nstringTodoSchema : Schema\nstringTodoSchema = [(\"id\", Maybe String), (\"name\", String), (\"done\", Maybe String)]\n\nrequestToStringTodo : Request -> Maybe (Record Main.stringTodoSchema)\nrequestToStringTodo req = getQueryAs {sch=stringTodoSchema} (getUrl req)\n \nrequestToTodo : Request -> Maybe Todo\nrequestToTodo req =\n (\\rec => Record.update {se=S (S Z)} \"done\" isJust (Record.update {se=Z} \"id\" convertId rec))\n <$> requestToStringTodo req\n\nsaveTodo : Route\nsaveTodo st@(cb, conn) (req, res) =\n case requestToTodo req of\n Nothing => notFound st (req, res)\n Just todo => do\n ev <- upsertTodo todo conn\n doAfter ev (returnTodos st (req, res))\n pure st\n\ndeleteTodo : Route\ndeleteTodo st@(cb, conn) (req, res) = \n let maybeId = do\n rec <- getQueryAs {sch=[(\"id\", Maybe String)]} (getUrl req)\n id <- rec .. \"id\"\n parseInteger {a=Int} id\n in case maybeId of\n Just id => do\n ev <- runDeleteQuery (removeTodoWithId id) conn\n doAfter (waitRowCountResult ev) (returnTodos st (req, res))\n pure st\n Nothing => notFound st (req, res)\n\nRouter : Type\nRouter = Url -> Maybe Route\n\npathRouter : List String -> Route -> Router\npathRouter s route url = if getPath url == s then Just route\n else Nothing\ntryAll : List Router -> Router\ntryAll [] _ = Nothing\ntryAll (hd::tail) url = (hd url) <|> tryAll tail url\n\nrouter : Router\nrouter = tryAll [\n pathRouter [] returnTodos,\n pathRouter [\"edit\"] editTodo,\n pathRouter [\"save\"] saveTodo,\n pathRouter [\"new\"] newTodo,\n pathRouter [\"delete\"] deleteTodo]\n\ncomputeState : ProgramMsg State Msg -> JS_IO (Maybe (State))\n\ncomputeState (ProgramStart cb) = do\n maybeConn <- connection\n (case maybeConn of\n Nothing => \n putStrLn' \"Please pass database name, username and password as command line arguments\"\n *> pure Nothing\n Just conn => \n (let ev = map NewRequest $ Http.listen (httpServer 3001)\n in listen ev cb)\n *> putStrLn' \"Listening on localhost:3001\"\n *> pure (Just (cb, conn)))\n\ncomputeState (ProgramNext st (NewRequest (req, res))) =\n Just <$> \n case router . getUrl $ req of\n Just route => route st (req, res)\n Nothing => notFound st (req, res)\n \n\nmain : JS_IO ()\nmain = run computeState\n\n","avg_line_length":27.5282051282,"max_line_length":94,"alphanum_fraction":0.6700819672} +{"size":1666,"ext":"idr","lang":"Idris","max_stars_count":128.0,"content":"module Parser.Source\n\nimport public Parser.Lexer.Source\nimport public Parser.Rule.Source\nimport public Parser.Unlit\n\nimport Core.Core\nimport Core.Name\nimport Core.Metadata\nimport Core.FC\n\nimport System.File\n\n%default total\n\nexport\nrunParserTo : {e : _} ->\n (origin : OriginDesc) ->\n Maybe LiterateStyle -> Lexer ->\n String -> Grammar State Token e ty ->\n Either Error (List Warning, State, ty)\nrunParserTo origin lit reject str p\n = do str <- mapFst (fromLitError origin) $ unlit lit str\n (cs, toks) <- mapFst (fromLexError origin) $ lexTo reject str\n (decs, ws, (parsed, _)) <- mapFst (fromParsingErrors origin) $ parseWith p toks\n let cs : SemanticDecorations\n = cs <&> \\ c => ((origin, start c, end c), Comment, Nothing)\n let ws = ws <&> \\ (mb, warn) =>\n let mkFC = \\ b => MkFC origin (startBounds b) (endBounds b)\n in ParserWarning (maybe EmptyFC mkFC mb) warn\n Right (ws, { decorations $= (cs ++) } decs, parsed)\n\nexport\nrunParser : {e : _} ->\n (origin : OriginDesc) -> Maybe LiterateStyle -> String ->\n Grammar State Token e ty ->\n Either Error (List Warning, State, ty)\nrunParser origin lit = runParserTo origin lit (pred $ const False)\n\nexport covering\nparseFile : (fname : String)\n -> (origin : OriginDesc)\n -> Rule ty\n -> IO (Either Error (List Warning, State, ty))\nparseFile fname origin p\n = do Right str <- readFile fname\n | Left err => pure (Left (FileErr fname err))\n pure (runParser origin (isLitFile fname) str p)\n","avg_line_length":34.0,"max_line_length":88,"alphanum_fraction":0.600240096} +{"size":364,"ext":"idr","lang":"Idris","max_stars_count":396.0,"content":"--- Data declarations ---\n\ndata (.ah) a = Ah (List a)\n\ng : Int .ah -> Int\ng (Ah xs) = sum xs\n\n--- Records ---\n\nrecord (.aah) a where\n constructor Aah\n unaah : List a\n\nh : Num a => a.aah -> a\nh = sum . unaah\n\n--- Interfaces ---\n\ninterface (.defaultable) a where\n defa : a\n\n(.defaultable) Int where\n defa = 0\n\nf : Num a => a.defaultable => a -> a\nf x = x + defa\n","avg_line_length":13.4814814815,"max_line_length":36,"alphanum_fraction":0.5631868132} +{"size":1532,"ext":"idr","lang":"Idris","max_stars_count":396.0,"content":"module Data.Contravariant\n\n%default total\n\ninfixl 4 >$, >$<, >&<, $<\n\n||| Contravariant functors\npublic export\ninterface Contravariant (0 f : Type -> Type) where\n contramap : (a -> b) -> f b -> f a\n\n (>$) : b -> f b -> f a\n v >$ fb = contramap (const v) fb\n\n||| If `f` is both `Functor` and `Contravariant` then by the time you factor in the\n||| laws of each of those classes, it can't actually use its argument in any\n||| meaningful capacity.\npublic export %inline\nphantom : (Functor f, Contravariant f) => f a -> f b\nphantom fa = () >$ (fa $> ())\n\n||| This is an infix alias for `contramap`.\npublic export %inline\n(>$<) : Contravariant f => (a -> b) -> f b -> f a\n(>$<) = contramap\n\n||| This is an infix version of `contramap` with the arguments flipped.\npublic export %inline\n(>&<) : Contravariant f => f b -> (a -> b) -> f a\n(>&<) = flip contramap\n\n||| This is `>$` with its arguments flipped.\npublic export %inline\n($<) : Contravariant f => f b -> b -> f a\n($<) = flip (>$)\n\n||| Composition of `Contravariant` is a `Functor`.\npublic export\n[Compose] (Contravariant f, Contravariant g) => Functor (f . g) where\n map = contramap . contramap\n\n||| Composition of a `Functor` and a `Contravariant` is a `Contravariant`.\npublic export\n[ComposeFC] (Functor f, Contravariant g) => Contravariant (f . g) where\n contramap = map . contramap\n\n||| Composition of a `Contravariant` and a `Functor` is a `Contravariant`.\npublic export\n[ComposeCF] (Contravariant f, Functor g) => Contravariant (f . g) where\n contramap = contramap . map\n","avg_line_length":30.0392156863,"max_line_length":83,"alphanum_fraction":0.6488250653} +{"size":339,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"\ndata InfList : Type -> Type where\n (::) : (value : elem) -> Inf (InfList elem) -> InfList elem\n%name InfList xs, ys, zs\n\n\ncountFrom : Integer -> InfList Integer\ncountFrom x = x :: Delay (countFrom (x + 1))\n\ngetPrefix : (count : Nat) -> InfList a -> List a\ngetPrefix Z xs = []\ngetPrefix (S k) (value :: xs) = value :: getPrefix k xs\n\n\n","avg_line_length":22.6,"max_line_length":64,"alphanum_fraction":0.616519174} +{"size":698,"ext":"idr","lang":"Idris","max_stars_count":47.0,"content":"scoreGame : List Int -> Int\nscoreGame xs = score xs where\n score : List Int -> Int\n score [] = 0\n score (x::y::[]) = x + y \n score (x::y::z::[]) = x + y + z\n score (x::y::z::xs) = \n if x == 10 then x + y + z + (score (y::z::xs)) \n else if x + y == 10 then x + y + z + (score (z::xs)) \n else x + y + (score (z::xs)) \n\n--\n-- TEST CASES:\n--\n\n-- 300 : Int\nperfect : Int\nperfect = scoreGame [10,10,10,10,10,10,10,10,10,10,10,10] \n\n-- 90 : Int\nnines : Int\nnines = scoreGame [9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0,9,0]\n\n-- 150 : Int\nspares : Int\nspares = scoreGame [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5]\n","avg_line_length":25.8518518519,"max_line_length":62,"alphanum_fraction":0.452722063} +{"size":13628,"ext":"idr","lang":"Idris","max_stars_count":3.0,"content":"||| An approach to intrinsically-typed STLC with types as terms.\n|||\n||| We use this razor to demonstrate succintly how Type universes are\n||| used to separate descriptions of how types are formed and their\n||| use to type values.\n|||\n||| Standard constructions are used to represent the language as an\n||| EDSL, together with proof of progress taken from PLFA Part 2.\n|||\n||| This module compliments Appendix 2 of the Functional Pearl.\n|||\n||| Although the code appears to be total, there is a known issues\n||| with Idris2 totality checker that causes it to slow down when\n||| dealing with mutually defined terms.\n|||\nmodule Razor.STLC\n\nimport Razor.Common\n\n%default covering\n\nnamespace Types\n\n ||| Levels at which types and their types are defined in our type\n ||| universes.\n public export\n data Level = TYPE -- Build types here\n | VALUE -- Use types here.\n\n ||| Our types are meta types...\n public export\n data MTy : Level -> Type where\n\n BoolTyDesc : MTy TYPE\n BoolTy : MTy VALUE\n\n FuncTy : MTy level -> MTy level -> MTy level\n\n\n ||| A predicate to type check types against type formers.\n public export\n data TyCheck : (type : MTy TYPE)\n -> (value : MTy VALUE)\n -> Type\n where\n ChkBool : TyCheck BoolTyDesc BoolTy\n\n ChkFunc : TyCheck paramTy paramValue\n -> TyCheck returnTy returnValue\n -> TyCheck (FuncTy paramTy returnTy)\n (FuncTy paramValue returnValue)\n\n ||| A context is a list of types in different universes.\n public export\n Context : List Level -> Type\n Context = DList Level MTy\n\n public export\n Elem : Context lvls -> MTy level -> Type\n Elem g ty = Elem Level MTy ty g\n\nnamespace Terms\n\n public export\n data STLC : Context lvls -> MTy level -> Type where\n -- STLC\n\n Var : Elem Level MTy type ctxt -> STLC ctxt type\n\n Func : {paramTyType : MTy TYPE}\n -> {paramTy, bodyTy : MTy VALUE}\n -> (type : STLC ctxt paramTyType)\n -> (term : STLC (ctxt += paramTy) bodyTy)\n -> (prf : TyCheck paramTyType paramTy)\n -> STLC ctxt (FuncTy paramTy bodyTy)\n\n App : {paramTy, bodyTy : MTy VALUE}\n -> (func : STLC ctxt (FuncTy paramTy bodyTy))\n -> (value : STLC ctxt paramTy)\n -> STLC ctxt bodyTy\n\n -- Type Constructors\n TyBool : STLC ctxt BoolTyDesc\n TyFunc : {paramMTy, returnMTy : MTy TYPE}\n -> (paramTy : STLC ctxt paramMTy)\n -> (returnTy : STLC ctxt returnMTy)\n -> STLC ctxt (FuncTy paramMTy returnMTy)\n\n -- Base Values\n True : STLC ctxt BoolTy\n False : STLC ctxt BoolTy\n\nnamespace Renaming\n\n public export\n weaken : (func : Types.Elem old type\n -> Types.Elem new type)\n -> (Elem (old += type') type\n -> Types.Elem (new += type') type)\n\n weaken func Here = Here\n weaken func (There rest) = There (func rest)\n\n public export\n rename : (f : {level : Level}\n -> {type : MTy level}\n -> Types.Elem old type\n -> Types.Elem new type)\n -> ({level : Level}\n -> {type : MTy level}\n -> STLC old type\n -> STLC new type)\n\n -- STLC\n rename f (Var idx) = Var (f idx)\n\n rename f (Func ty body prf)\n = Func (rename f ty) (rename (weaken f) body) prf\n\n rename f (App func param)\n = App (rename f func) (rename f param)\n\n -- Type Constructors\n rename f TyBool = TyBool\n rename f (TyFunc param body)\n = TyFunc (rename f param) (rename f body)\n\n -- Base Values\n rename f True = True\n rename f False = False\n\nnamespace Substitution\n public export\n weakens : (f : {level : Level}\n -> {type : MTy level}\n -> Types.Elem old type\n -> STLC new type)\n -> ({level : Level}\n -> {type : MTy level}\n -> Types.Elem (old += type') type\n -> STLC (new += type') type)\n weakens f Here = Var Here\n weakens f (There rest) = rename There (f rest)\n\n -- general substitute\n namespace General\n public export\n subst : (f : {level : Level}\n -> {type : MTy level}\n -> Types.Elem old type\n -> STLC new type)\n -> ({level : Level}\n -> {type : MTy level}\n -> STLC old type\n -> STLC new type)\n\n -- STLC\n subst f (Var idx) = f idx\n\n subst f (Func type body prf)\n = Func (subst f type)\n (subst (weakens f) body)\n prf\n\n subst f (App func var)\n = App (subst f func) (subst f var)\n\n -- Types\n subst f TyBool = TyBool\n subst f (TyFunc param return)\n = TyFunc (subst f param) (subst f return)\n\n -- Base Values\n subst f True = True\n subst f False = False\n\n namespace Single\n public export\n apply : {levelA : Level}\n -> {typeA : MTy levelA}\n -> (this : STLC ctxt typeB)\n -> (idx : Elem (ctxt += typeB) typeA)\n -> STLC ctxt typeA\n apply this Here = this\n apply this (There rest) = Var rest\n\n public export\n subst : {levelA,levelB : Level}\n -> {typeA : MTy levelA}\n -> {typeB : MTy levelB}\n -> (this : STLC ctxt typeB)\n -> (inThis : STLC (ctxt += typeB) typeA)\n -> STLC ctxt typeA\n subst {ctxt} {typeA} {typeB} {levelA} {levelB} this inThis\n = General.subst (apply this) inThis\n\n\nnamespace Values\n\n public export\n data Value : STLC ctxt type -> Type where\n TrueV : Value True\n FalseV : Value False\n FuncV : {body : STLC (ctxt += paramTy) bodyTy}\n -> Value (Func type body prf)\n\n TyBoolV : Value TyBool\n TyFuncV : {param : STLC ctxt pty}\n -> {return : STLC ctxt rty}\n -> Value param\n -> Value return\n -> Value (TyFunc param return)\n\nnamespace Reduction\n\n public export\n data Redux : (this : STLC ctxt type)\n -> (that : STLC ctxt type)\n -> Type\n where\n -- Functions reduce\n SimplifyFuncAppFunc : (func : Redux this that)\n -> Redux (App this var)\n (App that var)\n\n SimplifyFuncAppVar : {this, that : STLC ctxt type}\n -> {func : STLC ctxt (FuncTy type return)}\n -> (value : Value func)\n -> (var : Redux this that)\n -> Redux (App func this)\n (App func that)\n\n ReduceFuncApp : (value : Value var)\n -> Redux (App (Func type body prf) var)\n (subst var body)\n\n -- Simplify Function Types\n SimplifyTyFuncParam : (param : Redux this that)\n -> Redux (TyFunc this body)\n (TyFunc that body)\n\n SimplifyTyFuncBody : {this, that : STLC ctxt type}\n -> {param : STLC ctxt paramTy}\n -> (value : Value param)\n -> (body : Redux this that)\n -> Redux (TyFunc param this)\n (TyFunc param that)\n\n\nnamespace Progress\n public export\n data Progress : (term : STLC Nil type)\n -> Type\n where\n Done : forall mty . {term : STLC Nil mty}\n -> Value term\n -> Progress term\n Step : {this, that : STLC Nil type}\n -> (prf : Redux this that)\n -> Progress this\n\n public export\n progress : (term : STLC Nil type)\n -> Progress term\n -- STLC\n progress {type} (Var _) impossible\n\n progress (Func type body prf) = Done FuncV\n\n progress (App func var) with (progress func)\n progress (App func var) | (Done prfF) with (progress var)\n progress (App (Func ty b prf) var) | (Done prfF) | (Done prfV)\n = Step (ReduceFuncApp prfV {body=b})\n progress (App func var) | (Done prfF) | (Step prfV)\n = Step (SimplifyFuncAppVar prfF prfV)\n progress (App func var) | (Step prfF)\n = Step (SimplifyFuncAppFunc prfF)\n\n -- Type Constructors\n progress TyBool = Done TyBoolV\n\n progress (TyFunc param return) with (progress param)\n progress (TyFunc param return) | (Done valueP) with (progress return)\n progress (TyFunc param return) | (Done valueP) | (Done valueR)\n = Done (TyFuncV valueP valueR)\n progress (TyFunc param return) | (Done valueP) | (Step prfR)\n = Step (SimplifyTyFuncBody valueP prfR)\n progress (TyFunc param return) | (Step prfP)\n = Step (SimplifyTyFuncParam prfP)\n\n -- Base Values\n progress True = Done TrueV\n progress False = Done FalseV\n\nnamespace Evaluation\n\n public export\n data Reduces : (this : STLC ctxt type)\n -> (that : STLC ctxt type)\n -> Type\n where\n Refl : {this : STLC ctxt type}\n -> Reduces this this\n Trans : {this, that, end : STLC ctxt type}\n -> Redux this that\n -> Reduces that end\n -> Reduces this end\n\n public export\n data Finished : (term : STLC ctxt type)\n -> Type\n where\n Normalised : {term : STLC ctxt type}\n -> Value term\n -> Finished term\n OOF : Finished term\n\n public export\n data Evaluate : (term : STLC Nil type) -> Type where\n RunEval : {this, that : STLC Nil type}\n -> (steps : Inf (Reduces this that))\n -> (result : Finished that)\n -> Evaluate this\n\n public export\n data Fuel = Empty | More (Lazy Fuel)\n\n public export\n covering\n forever : Fuel\n forever = More forever\n\n public export\n compute : forall type\n . (fuel : Fuel)\n -> (term : STLC Nil type)\n -> Evaluate term\n compute Empty term = RunEval Refl OOF\n compute (More fuel) term with (progress term)\n compute (More fuel) term | (Done value) = RunEval Refl (Normalised value)\n compute (More fuel) term | (Step step {that}) with (compute fuel that)\n compute (More fuel) term | (Step step {that = that}) | (RunEval steps result)\n = RunEval (Trans step steps) result\n\npublic export\ncovering\nrun : forall type\n . (this : STLC Nil type)\n -> Maybe (Subset (STLC Nil type) (Reduces this))\nrun this with (compute forever this)\n run this | (RunEval steps (Normalised {term} x))\n = Just (Element term steps)\n run this | (RunEval steps OOF) = Nothing\n\nnamespace Example\n\n export\n example0 : STLC Nil BoolTy\n example0 = App (Func TyBool (Var Here) ChkBool) True\n\n export\n example1 : STLC Nil (FuncTy BoolTy BoolTy)\n example1 = (Func TyBool True ChkBool)\n\n export\n id : STLC Nil (FuncTy BoolTy BoolTy)\n id = (Func TyBool (Var Here) ChkBool)\n\n public export\n CBool : MTy VALUE\n CBool = FuncTy (FuncTy BoolTy BoolTy)\n (FuncTy BoolTy BoolTy)\n\n public export\n TyCBool : STLC ctxt (FuncTy (FuncTy BoolTyDesc BoolTyDesc)\n (FuncTy BoolTyDesc BoolTyDesc))\n TyCBool = TyFunc (TyFunc TyBool TyBool) (TyFunc TyBool TyBool)\n\n export\n zero : STLC ctxt CBool\n zero = Func (TyFunc TyBool TyBool)\n (Func TyBool\n (Var Here)\n ChkBool)\n (ChkFunc ChkBool ChkBool)\n\n export\n one : STLC ctxt CBool\n one = Func (TyFunc TyBool TyBool)\n (Func TyBool\n (App (Var (There Here)) (Var Here))\n ChkBool)\n (ChkFunc ChkBool ChkBool)\n\n export\n two : STLC ctxt CBool\n two = Func (TyFunc TyBool TyBool)\n (Func TyBool\n (App (Var (There Here))\n (App (Var (There Here)) (Var Here)))\n ChkBool)\n (ChkFunc ChkBool ChkBool)\n\n export\n succ : STLC ctxt (FuncTy CBool CBool)\n succ = Func TyCBool\n (Func (TyFunc TyBool TyBool)\n (Func TyBool\n ((Var (There Here)) `App`\n (((Var (There (There Here))) `App`\n (Var (There Here))) `App`\n (Var Here)))\n ChkBool)\n (ChkFunc ChkBool ChkBool))\n (ChkFunc (ChkFunc ChkBool ChkBool)\n (ChkFunc ChkBool ChkBool))\n\n export\n plus : STLC Nil (CBool `FuncTy` (CBool `FuncTy` CBool))\n plus = Func TyCBool\n (Func TyCBool\n (Func (TyFunc TyBool TyBool)\n (Func TyBool\n (App (App (Var (There (There (There Here))))\n (Var (There Here)))\n (App (App (Var (There (There Here))) (Var (There Here)))\n (Var Here)))\n ChkBool\n )\n (ChkFunc ChkBool ChkBool)\n )\n\n (ChkFunc (ChkFunc ChkBool ChkBool)\n (ChkFunc ChkBool ChkBool))\n )\n (ChkFunc (ChkFunc ChkBool ChkBool)\n (ChkFunc ChkBool ChkBool))\n\n-- --------------------------------------------------------------------- [ EOF ]\n","avg_line_length":30.9727272727,"max_line_length":93,"alphanum_fraction":0.5216466099} +{"size":15191,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"module Utils.Path\r\n\r\nimport Data.List\r\nimport Data.Maybe\r\nimport Data.Nat\r\nimport Data.Strings\r\nimport Data.String.Extra\r\n\r\nimport System.Info\r\n\r\nimport Text.Token\r\nimport Text.Lexer\r\nimport Text.Parser\r\nimport Text.Quantity\r\n\r\ninfixr 5 <\/>\r\ninfixr 7 <.>\r\n\r\n\r\n||| The character that separates directories in the path.\r\nexport\r\ndirSeparator : Char\r\ndirSeparator = if isWindows then '\\\\' else '\/'\r\n\r\n||| The character that separates multiple paths.\r\nexport\r\npathSeparator : Char\r\npathSeparator = if isWindows then ';' else ':'\r\n\r\n||| Windows' path prefixes of path component.\r\npublic export\r\ndata Volume\r\n = \r\n ||| Windows' Uniform Naming Convention, e.g., a network sharing\r\n ||| directory: `\\\\host\\c$\\Windows\\System32`\r\n UNC String String |\r\n ||| The drive, e.g., \"C:\". The disk character is in upper case\r\n Disk Char\r\n\r\n||| A single body of path component.\r\npublic export\r\ndata Body\r\n = \r\n ||| Represents \".\"\r\n CurDir |\r\n ||| Represents \"..\"\r\n ParentDir |\r\n ||| Common directory or file\r\n Normal String\r\n\r\n||| A parsed cross-platform file system path.\r\n|||\r\n||| The function `parse` constructs a Path component from String,\r\n||| and the function `show` converts in reverse.\r\n|||\r\n||| Trailing separator is only used for display and is ignored while\r\n||| comparing paths.\r\npublic export\r\nrecord Path where\r\n constructor MkPath\r\n ||| Windows' path prefix (only on Windows)\r\n volume : Maybe Volume\r\n ||| Whether the path contains a root\r\n hasRoot : Bool\r\n ||| Path bodies\r\n body : List Body\r\n ||| Whether the path terminates with a separator\r\n hasTrailSep : Bool\r\n\r\nexport\r\nEq Volume where\r\n (==) (UNC l1 l2) (UNC r1 r2) = l1 == r1 && r1 == r2\r\n (==) (Disk l) (Disk r) = l == r\r\n (==) _ _ = False\r\n\r\nexport\r\nEq Body where\r\n (==) CurDir CurDir = True\r\n (==) ParentDir ParentDir = True\r\n (==) (Normal l) (Normal r) = l == r\r\n (==) _ _ = False\r\n\r\nexport\r\nEq Path where\r\n (==) (MkPath l1 l2 l3 _) (MkPath r1 r2 r3 _) = l1 == r1\r\n && l2 == r2\r\n && l3 == r3\r\n\r\n||| An empty path that represents \"\".\r\npublic export\r\nemptyPath : Path\r\nemptyPath = MkPath Nothing False [] False\r\n\r\n--------------------------------------------------------------------------------\r\n-- Show\r\n--------------------------------------------------------------------------------\r\n\r\nexport\r\nShow Body where\r\n show CurDir = \".\"\r\n show ParentDir = \"..\"\r\n show (Normal s) = s\r\n\r\nexport\r\nShow Volume where\r\n show (UNC server share) = \"\\\\\\\\\" ++ server ++ \"\\\\\" ++ share\r\n show (Disk disk) = singleton disk ++ \":\"\r\n\r\n||| Display the path in the format on the platform.\r\nexport\r\nShow Path where\r\n show p = let sep = singleton dirSeparator\r\n volStr = fromMaybe \"\" (map show p.volume)\r\n rootStr = if p.hasRoot then sep else \"\"\r\n bodyStr = join sep $ map show p.body\r\n trailStr = if p.hasTrailSep then sep else \"\" in\r\n volStr ++ rootStr ++ bodyStr ++ trailStr\r\n\r\n--------------------------------------------------------------------------------\r\n-- Parser\r\n--------------------------------------------------------------------------------\r\n\r\ndata PathTokenKind = PTText | PTPunct Char\r\n\r\nEq PathTokenKind where\r\n (==) PTText PTText = True\r\n (==) (PTPunct c1) (PTPunct c2) = c1 == c2\r\n (==) _ _ = False\r\n\r\nPathToken : Type\r\nPathToken = Token PathTokenKind\r\n\r\nTokenKind PathTokenKind where\r\n TokType PTText = String\r\n TokType (PTPunct _) = ()\r\n\r\n tokValue PTText x = x\r\n tokValue (PTPunct _) _ = ()\r\n\r\npathTokenMap : TokenMap PathToken\r\npathTokenMap = toTokenMap $\r\n [ (is '\/', PTPunct '\/')\r\n , (is '\\\\', PTPunct '\\\\')\r\n , (is ':', PTPunct ':')\r\n , (is '?', PTPunct '?')\r\n , (some $ non $ oneOf \"\/\\\\:?\", PTText)\r\n ]\r\n\r\nlexPath : String -> List (WithBounds PathToken)\r\nlexPath str = let (tokens, _, _, _) = lex pathTokenMap str in tokens\r\n\r\n-- match both '\/' and '\\\\' regardless of the platform.\r\nbodySeparator : Grammar PathToken True ()\r\nbodySeparator = (match $ PTPunct '\\\\') <|> (match $ PTPunct '\/')\r\n\r\n-- Example: \\\\?\\\r\n-- Windows can automatically translate '\/' to '\\\\'. The verbatim prefix,\r\n-- i.e., `\\\\?\\`, disables the translation.\r\n-- Here, we simply parse and then ignore it.\r\nverbatim : Grammar PathToken True ()\r\nverbatim = do count (exactly 2) $ match $ PTPunct '\\\\'\r\n match $ PTPunct '?'\r\n match $ PTPunct '\\\\'\r\n pure ()\r\n\r\n-- Example: \\\\server\\share\r\nunc : Grammar PathToken True Volume\r\nunc = do count (exactly 2) $ match $ PTPunct '\\\\'\r\n server <- match PTText\r\n bodySeparator\r\n share <- match PTText\r\n Core.pure $ UNC server share\r\n\r\n-- Example: \\\\?\\server\\share\r\nverbatimUnc : Grammar PathToken True Volume\r\nverbatimUnc = do verbatim\r\n server <- match PTText\r\n bodySeparator\r\n share <- match PTText\r\n Core.pure $ UNC server share\r\n\r\n-- Example: C:\r\ndisk : Grammar PathToken True Volume\r\ndisk = do text <- match PTText\r\n disk <- case unpack text of\r\n (disk :: xs) => pure disk\r\n [] => fail \"Expect Disk\"\r\n match $ PTPunct ':'\r\n pure $ Disk (toUpper disk)\r\n\r\n-- Example: \\\\?\\C:\r\nverbatimDisk : Grammar PathToken True Volume\r\nverbatimDisk = do verbatim\r\n d <- disk\r\n pure d\r\n\r\nparseVolume : Grammar PathToken True Volume\r\nparseVolume = verbatimUnc\r\n <|> verbatimDisk\r\n <|> unc\r\n <|> disk\r\n\r\nparseBody : Grammar PathToken True Body\r\nparseBody = do text <- match PTText\r\n the (Grammar _ False _) $\r\n case text of\r\n \"..\" => pure ParentDir\r\n \".\" => pure CurDir\r\n s => pure (Normal s)\r\n\r\nparsePath : Grammar PathToken False Path\r\nparsePath = do vol <- optional parseVolume\r\n root <- optional (some bodySeparator)\r\n body <- sepBy (some bodySeparator) parseBody\r\n trailSep <- optional (some bodySeparator)\r\n let body = filter (\\case Normal s => ltrim s \/= \"\"\r\n _ => True) body\r\n let body = case body of\r\n [] => []\r\n (x::xs) => x :: delete CurDir xs\r\n pure $ MkPath vol (isJust root) body (isJust trailSep)\r\n\r\n||| Parse a String into Path component.\r\n|||\r\n||| Returns the path parsed as much as possible from left to right, the \r\n||| invalid parts on the right end is ignored.\r\n|||\r\n||| Some kind of invalid path is accepted. Relaxing rules:\r\n|||\r\n||| - Both slash('\/') and backslash('\\\\') are parsed as valid directory\r\n||| separator, regardless of the platform;\r\n||| - Any characters in path body in allowed, e.g., glob like \"\/root\/*\";\r\n||| - Verbatim prefix(`\\\\?\\`) that disables the forward\r\n||| slash (Windows only) is ignored.\r\n||| - Repeated separators are ignored, so \"a\/b\" and \"a\/\/b\" both have \"a\" \r\n||| and \"b\" as bodies.\r\n||| - Occurrences of \".\" are normalized away, except if they are at the\r\n||| beginning of the path. For example, \"a\/.\/b\", \"a\/b\/\", \"a\/b\/\". and \r\n||| \"a\/b\" all have \"a\" and \"b\" as bodies, but \".\/a\/b\" starts with an \r\n||| additional `CurDir` body.\r\n|||\r\n||| ```idris example\r\n||| parse \"C:\\\\Windows\/System32\"\r\n||| ```\r\n||| ```idris example\r\n||| parse \"\/usr\/local\/etc\/*\"\r\n||| ```\r\nexport\r\nparse : String -> Path\r\nparse str = case parse parsePath (lexPath str) of\r\n Right (p, _) => p\r\n _ => emptyPath\r\n\r\n--------------------------------------------------------------------------------\r\n-- Utils\r\n--------------------------------------------------------------------------------\r\n\r\nisAbsolute' : Path -> Bool\r\nisAbsolute' p = if isWindows\r\n then case p.volume of\r\n Just (UNC _ _) => True\r\n Just (Disk _) => p.hasRoot\r\n Nothing => False\r\n else p.hasRoot\r\n\r\nappend' : (left : Path) -> (right : Path) -> Path\r\nappend' l r = if isAbsolute' r || isJust r.volume\r\n then r\r\n else if hasRoot r\r\n then record { volume = l.volume } r\r\n else record { body = l.body ++ r.body,\r\n hasTrailSep = r.hasTrailSep } l\r\n\r\nsplitParent' : Path -> Maybe (Path, Path)\r\nsplitParent' p \r\n = case p.body of\r\n [] => Nothing\r\n (x::xs) => let parentPath = record { body = init (x::xs),\r\n hasTrailSep = False } p\r\n lastPath = MkPath Nothing False [last (x::xs)] p.hasTrailSep in\r\n Just (parentPath, lastPath)\r\n\r\nparent' : Path -> Maybe Path\r\nparent' p = map fst (splitParent' p) \r\n\r\nfileName' : Path -> Maybe String\r\nfileName' p = findNormal (reverse p.body)\r\n where\r\n findNormal : List Body -> Maybe String\r\n findNormal ((Normal s)::xs) = Just s\r\n findNormal (CurDir::xs) = findNormal xs\r\n findNormal _ = Nothing\r\n \r\nsetFileName' : (name : String) -> Path -> Path\r\nsetFileName' name p = if isJust (fileName' p)\r\n then append' (fromMaybe emptyPath $ parent' p) (parse name)\r\n else append' p (parse name)\r\n \r\nsplitFileName : String -> (String, String)\r\nsplitFileName name\r\n = case break (== '.') $ reverse $ unpack name of\r\n (_, []) => (name, \"\")\r\n (_, ['.']) => (name, \"\")\r\n (revExt, (dot :: revStem))\r\n => ((pack $ reverse revStem), (pack $ reverse revExt))\r\n\r\n--------------------------------------------------------------------------------\r\n-- Manipulations\r\n--------------------------------------------------------------------------------\r\n\r\n||| Returns true if the path is absolute.\r\n|||\r\n||| - On Unix, a path is absolute if it starts with the root,\r\n||| so isAbsolute and hasRoot are equivalent.\r\n|||\r\n||| - On Windows, a path is absolute if it has a volume and starts\r\n||| with the root. e.g., `c:\\\\windows` is absolute, while `c:temp`\r\n||| and `\\temp` are not. In addition, a path with UNC volume is absolute.\r\nexport\r\nisAbsolute : String -> Bool\r\nisAbsolute p = isAbsolute' (parse p)\r\n\r\n||| Returns true if the path is relative, i.e., not absolute.\r\nexport\r\nisRelative : String -> Bool\r\nisRelative = not . isAbsolute\r\n\r\n||| Appends the right path to the left one.\r\n|||\r\n||| If the path on the right is absolute, it replaces the left path.\r\n|||\r\n||| On Windows:\r\n|||\r\n||| - If the right path has a root but no volume (e.g., `\\windows`), it\r\n||| replaces everything except for the volume (if any) of left.\r\n||| - If the right path has a volume but no root, it replaces left.\r\n|||\r\n||| ```idris example\r\n||| \"\/usr\" <\/> \"local\/etc\"\r\n||| ```\r\nexport\r\n(<\/>) : (left : String) -> (right : String) -> String\r\n(<\/>) l r = show $ append' (parse l) (parse r)\r\n\r\n||| Join path elements together.\r\n|||\r\n||| ```idris example\r\n||| joinPath [\"\/usr\", \"local\/etc\"] == \"\/usr\/local\/etc\"\r\n||| ```\r\nexport\r\njoinPath : List String -> String\r\njoinPath xs = foldl (<\/>) \"\" xs\r\n\r\n||| Returns the parent and child.\r\n|||\r\n||| ```idris example\r\n||| splitParent \"\/usr\/local\/etc\" == Just (\"\/usr\/local\", \"etc\")\r\n||| ```\r\nexport\r\nsplitParent : String -> Maybe (String, String)\r\nsplitParent p = do (a, b) <- splitParent' (parse p)\r\n pure $ (show a, show b)\r\n\r\n||| Returns the path without its final component, if there is one.\r\n|||\r\n||| Returns Nothing if the path terminates in a root or volume.\r\nexport\r\nparent : String -> Maybe String\r\nparent p = map show $ parent' (parse p)\r\n\r\n||| Returns a list of all the parents of the path, longest first,\r\n||| self included.\r\n|||\r\n||| ```idris example\r\n||| parents \"\/etc\/kernel\" == [\"\/etc\/kernel\", \"\/etc\", \"\/\"]\r\n||| ```\r\nexport\r\nparents : String -> List String\r\nparents p = map show $ iterate parent' (parse p)\r\n\r\n||| Determines whether base is either one of the parents of full.\r\n|||\r\n||| Trailing separator is ignored.\r\nexport\r\nstartWith : (base : String) -> (full : String) -> Bool\r\nstartWith base full = (parse base) `elem` (iterate parent' (parse full))\r\n\r\n||| Returns a path that, when appended onto base, yields full.\r\n|||\r\n||| If base is not a prefix of full (i.e., startWith returns false),\r\n||| returns Nothing.\r\nexport\r\nstripPrefix : (base : String) -> (full : String) -> Maybe String\r\nstripPrefix base full\r\n = do let MkPath vol1 root1 body1 _ = parse base\r\n let MkPath vol2 root2 body2 trialSep = parse full\r\n if vol1 == vol2 && root1 == root2 then Just () else Nothing\r\n body <- stripBody body1 body2\r\n pure $ show $ MkPath Nothing False body trialSep\r\n where\r\n stripBody : (base : List Body) -> (full : List Body) -> Maybe (List Body)\r\n stripBody [] ys = Just ys\r\n stripBody xs [] = Nothing\r\n stripBody (x::xs) (y::ys) = if x == y then stripBody xs ys else Nothing\r\n\r\n||| Returns the final body of the path, if there is one.\r\n|||\r\n||| If the path is a normal file, this is the file name. If it's the\r\n||| path of a directory, this is the directory name.\r\n|||\r\n||| Returns Nothing if the final body is \"..\".\r\nexport\r\nfileName : String -> Maybe String\r\nfileName p = fileName' (parse p)\r\n\r\n||| Extracts the stem (non-extension) portion of the file name of path.\r\n|||\r\n||| The stem is:\r\n|||\r\n||| - Nothing, if there is no file name;\r\n||| - The entire file name if there is no embedded \".\";\r\n||| - The entire file name if the file name begins with \".\" and has\r\n||| no other \".\"s within;\r\n||| - Otherwise, the portion of the file name before the final \".\"\r\nexport\r\nfileStem : String -> Maybe String\r\nfileStem p = pure $ fst $ splitFileName !(fileName p)\r\n\r\n||| Extracts the extension of the file name of path.\r\n|||\r\n||| The extension is:\r\n|||\r\n||| - Nothing, if there is no file name;\r\n||| - Nothing, if there is no embedded \".\";\r\n||| - Nothing, if the file name begins with \".\" and has no other \".\"s within;\r\n||| - Otherwise, the portion of the file name after the final \".\"\r\nexport\r\nextension : String -> Maybe String\r\nextension p = pure $ snd $ splitFileName !(fileName p)\r\n\r\n||| Updates the file name of the path.\r\n|||\r\n||| If no file name, this is equivalent to appending the name;\r\n||| Otherwise it is equivalent to appending the name to the parent.\r\nexport\r\nsetFileName : (name : String) -> String -> String\r\nsetFileName name p = show $ setFileName' name (parse p)\r\n\r\n||| Append a extension to the path.\r\n|||\r\n||| Returns the path as it is if no file name.\r\n|||\r\n||| If `extension` of the path is Nothing, the extension is added; otherwise\r\n||| it is replaced.\r\n||| \r\n||| If the ext is empty, the extension is dropped.\r\nexport\r\n(<.>) : String -> (ext : String) -> String\r\n(<.>) p ext = let p' = parse p \r\n ext = pack $ dropWhile (== '.') (unpack ext)\r\n ext = if ltrim ext == \"\" then \"\" else \".\" ++ ext in\r\n case fileName' p' of\r\n Just name => let (stem, _) = splitFileName name in\r\n show $ setFileName' (stem ++ ext) p'\r\n Nothing => p\r\n","avg_line_length":32.5987124464,"max_line_length":88,"alphanum_fraction":0.5472319136} +{"size":3660,"ext":"idr","lang":"Idris","max_stars_count":1.0,"content":"-- ---------------------------------------------------------------- [ Effs.idr ]\n-- Module : Effs.idr\n-- Copyright : (c) Jan de Muijnck-Hughes\n-- License : see LICENSE\n-- --------------------------------------------------------------------- [ EOH ]\nmodule Sif.Effs\n\nimport public Effects\nimport public Effect.System\nimport public Effect.State\nimport public Effect.Exception\nimport public Effect.File\nimport public Effect.StdIO\nimport public Effect.Logging.Default\nimport public Effect.Perf\n\nimport ArgParse\n\nimport Sif.Types\nimport Sif.DSL.State\nimport Sif.Error\nimport Sif.Pattern\nimport Sif.Builder.AbsInterp\nimport Sif.Builder.DirectRep\nimport Sif.Library\nimport Sif.Options\n\n-- -------------------------------------------------------------- [ Directives ]\n%access export\n\n-- -------------------------------------------------------------- [ State Defs ]\npublic export\nrecord SifState where\n constructor MkSifState\n opts : SifOpts\n lib : SifLib\n bends : List SifBackend\n builder : SifBackend\n\nDefault SifState where\n default = MkSifState\n defOpts\n defaultLib\n [backendAbsInterp,backendDirectRep]\n backendAbsInterp\n\n-- -------------------------------------------------------------------- [ Effs ]\npublic export\nSifEffs : List EFFECT\nSifEffs = [ FILE_IO ()\n , SYSTEM\n , STDIO\n , LOG\n , PERF\n , 'sif ::: EXCEPTION SifError\n , 'bstate ::: STATE BuildState\n , 'sstate ::: STATE SifState\n ]\n\npublic export\nSif : Type -> Type\nSif rTy = Eff rTy SifEffs\n\n-- ----------------------------------------------------------------- [ Options ]\n\ngetOptions : Eff SifOpts ['sstate ::: STATE SifState]\ngetOptions = pure $ opts !('sstate :- get)\n\nputOptions : SifOpts -> Eff () ['sstate ::: STATE SifState]\nputOptions o = 'sstate :- update (\\st => record {opts = o} st)\n\nupdateOptions : (SifOpts -> SifOpts) -> Eff () ['sstate ::: STATE SifState]\nupdateOptions f = 'sstate :- update (\\st => record {opts = f (opts st)} st)\n\n\n-- ----------------------------------------------------------------- [ Library ]\ngetLibrary : Eff SifLib ['sstate ::: STATE SifState]\ngetLibrary = pure $ lib !('sstate :- get)\n\nputLibrary : SifLib -> Eff () ['sstate ::: STATE SifState]\nputLibrary l = 'sstate :- update (\\st => record {lib = l} st)\n\nupdateLibrary : (SifLib -> SifLib) -> Eff () ['sstate ::: STATE SifState]\nupdateLibrary u = 'sstate :- update (\\st => record {lib = u (lib st)} st)\n\n\n-- ---------------------------------------------------------------- [ Backends ]\n\ngetSifBackend : Eff SifBackend ['sstate ::: STATE SifState]\ngetSifBackend = pure $ (builder !('sstate :- get))\n\nsetSifBackend : Maybe String -> Eff () SifEffs\nsetSifBackend Nothing = do\n putStrLn $ unwords [\"Using Default Backend\"]\n 'sstate :- update (\\st => record {builder = backendAbsInterp} st)\nsetSifBackend (Just n) = do\n st <- 'sstate :- get\n case find (\\x => name x == n) (bends st) of\n Nothing => do\n printLn (NoSuchBackend n)\n setSifBackend Nothing\n Just x => do\n putStrLn $ unwords [\"Using backend\", show n]\n 'sstate :- update (\\st => record {builder = x} st)\n\naddSifBackend : SifBackend -> Eff () ['sstate ::: STATE SifState]\naddSifBackend b = 'sstate :- update (\\st => record {bends = (b::bends st)} st)\n\n-- ----------------------------------------------------------------- [ Options ]\n\nparseOptions : Sif SifOpts\nparseOptions =\n case parseArgs defOpts convOpts !getArgs of\n Left err => Sif.raise $ GeneralError (show err)\n Right o => pure o\n\n-- --------------------------------------------------------------------- [ EOF ]\n","avg_line_length":31.0169491525,"max_line_length":80,"alphanum_fraction":0.5292349727} +{"size":1133,"ext":"idr","lang":"Idris","max_stars_count":1.0,"content":"-- Copyright 2017, the blau.io contributors\n--\n-- Licensed under the Apache License, Version 2.0 (the \"License\");\n-- you may not use this file except in compliance with the License.\n-- You may obtain a copy of the License at\n--\n-- http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n--\n-- Unless required by applicable law or agreed to in writing, software\n-- distributed under the License is distributed on an \"AS IS\" BASIS,\n-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n-- See the License for the specific language governing permissions and\n-- limitations under the License.\n\n||| The original specification can be found at\n||| https:\/\/infra.spec.whatwg.org\/#namespaces\nmodule API.Web.Infra.Namespaces\n\n%access public export\n%default total\n\nhtml : String\nhtml = \"http:\/\/www.w3.org\/1999\/xhtml\"\n\nmathML : String\nmathML = \"http:\/\/www.w3.org\/1998\/Math\/MathML\"\n\nsvg : String\nsvg = \"http:\/\/www.w3.org\/2000\/svg\"\n\nxLink : String\nxLink = \"http:\/\/www.w3.org\/1999\/xlink\"\n\nxml : String\nxml = \"http:\/\/www.w3.org\/XML\/1998\/namespace\"\n\nxmlns : String\nxmlns = \"http:\/\/www.w3.org\/2000\/xmlns\/\"\n\n\n","avg_line_length":27.6341463415,"max_line_length":78,"alphanum_fraction":0.7060900265} +{"size":186,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"module AOC.Main\n\nimport AOC.Day\nimport AOC.Solution\nimport AOC.Solution.IO\n\nimport Data.List\n\nmain : IO ()\nmain = do\n sequence_ $ intersperse (putStrLn \"\") $ map printSolutionDP $ days\n","avg_line_length":15.5,"max_line_length":68,"alphanum_fraction":0.7365591398} +{"size":2389,"ext":"idr","lang":"Idris","max_stars_count":9.0,"content":"module Libgit.Examples\n\nimport Control.Monad.Managed\n\nimport Libgit\n\n-- Clone a repository and print some information about the success of the\n-- operation.\nexport\ntestClone : String -> String -> String -> IO ()\ntestClone url localPath branch = do\n res <- withGit $ runManaged $ do\n eRes <- repository (GitRepositoryClone (MkCloneOpts False branch) url localPath)\n let result = case eRes of\n Left res => \"Error: \" ++ show res\n Right _ => \"Cloned repository\"\n liftIO $ putStrLn result\n case res of\n Left err => putStrLn (\"Error initializing: \" ++ show err)\n Right _ => putStrLn \"Success\"\n\n-- Open a repository and reset its head to a given commit\/tag\nexport\nresetRepo : (path : String) -> (rev : String) -> IO ()\nresetRepo path rev = do\n withGit $ runManaged $ do\n Right repo <- repository (GitRepositoryOpen path)\n | Left err => putStrLn (\"Error opening repo: \" ++ show err)\n Right (objTyp ** obj) <- revParse repo rev\n | Left err => putStrLn (\"Error parsing revision: \" ++ show err)\n case objTyp of\n GitObjectCommit => liftIO resetRepo\n GitObjectTag => liftIO resetRepo\n _ => liftIO (putStrLn \"Wrong object type\")\n pure ()\n where\n resetRepo : {auto repo : GitRepository}\n -> {auto typ : GitObjectType}\n -> {auto obj : GitObject typ}\n -> {auto 0 prf : IsCommitish typ}\n -> IO ()\n resetRepo {repo} {obj} = do\n 0 <- liftIO (resetRepository repo obj GitResetHard)\n | err => putStrLn (\"Error resetting repo: \" ++ show err)\n putStrLn \"Successfully reset repo\"\n\n-- Open a repository and fetch a remote\nexport\nfetchRemote : (path : String) -> (remote : String) -> IO ()\nfetchRemote path rev = do\n withGit $ runManaged $ do\n Right repo <- repository (GitRepositoryOpen path)\n | Left err => putError (\"Error opening repo: \" ++ show err)\n Right remote <- remote repo \"origin\"\n | Left err => putError (\"Error looking up remote: \" ++ show err)\n 0 <- liftIO (remoteFetch' remote \"Fetched from Idris\")\n | err => putError (\"Error fetching remote: \" ++ show err)\n putStrLn \"Fetch successful.\"\n pure ()\n where\n putError : HasIO io => String -> io ()\n putError msg = liftIO $ do\n putStrLn msg\n case lastError of\n Just (msg, _) => putStrLn msg\n Nothing => putStrLn \"No git error present\"","avg_line_length":36.196969697,"max_line_length":84,"alphanum_fraction":0.629970699} +{"size":268,"ext":"idr","lang":"Idris","max_stars_count":40.0,"content":"module Sanity.Hello\nimport Effects\nimport Effect.StdIO\n||| Defining this in another file using the STDIO effect is not that practical,\n||| but it should help illustrate the project structure.\npublic export\nsayHello : Eff () [STDIO]\nsayHello = putStrLn \"Hello, world!\"\n","avg_line_length":29.7777777778,"max_line_length":79,"alphanum_fraction":0.7723880597} +{"size":11564,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"module ZZUtils\nimport ZZ\nimport NatUtils\n%access public export\n%default total\n\ndata IsNonNegative : ZZ->Type where\n NonNegative :(IsNonNegative (Pos k))\n\n\ndata NotBothZeroZ :ZZ->ZZ->Type where\n LeftPositive :NotBothZeroZ (Pos (S k)) m\n LeftNegative :NotBothZeroZ (NegS k) m\n RightPositive :NotBothZeroZ m (Pos (S k))\n RightNegative :NotBothZeroZ m (NegS k)\n\ndata NotZero:ZZ->Type where\n PositiveZ:NotZero (Pos (S k))\n NegativeZ:NotZero (NegS k)\n\ndata IsNegative:ZZ->Type where\n Negative: IsNegative (NegS k)\n\n|||Zero is not positive\nzeroNotPos:IsPositive (Pos Z)->Void\nzeroNotPos Positive impossible\n\n|||Proof that NotBothZeroZ 0 0 is uninhabited\nzeroZeroBothZero:NotBothZeroZ (Pos Z) (Pos Z) ->Void\nzeroZeroBothZero LeftPositive impossible\nzeroZeroBothZero LeftNegative impossible\nzeroZeroBothZero RightPositive impossible\nzeroZeroBothZero RightNegative impossible\n\n|||Decides whther two numbers are not both zero or not.\ndecNotBothZero : (a:ZZ)->(b:ZZ)->Dec (NotBothZeroZ a b)\ndecNotBothZero (Pos Z) (Pos Z) = No ( zeroZeroBothZero)\ndecNotBothZero (Pos Z) (Pos (S k)) = Yes RightPositive\ndecNotBothZero (Pos Z) (NegS k) = Yes RightNegative\ndecNotBothZero (Pos (S k)) b = Yes LeftPositive\ndecNotBothZero (NegS k) b = Yes LeftNegative\n\n|||Checks 2 numbers and produces a proof of either (a=0,b=0) or (NotBothZeroZ a b)\ncheckNotBothZero : (a:ZZ)->(b:ZZ)->Either ((a=0),(b=0)) (NotBothZeroZ a b)\ncheckNotBothZero (Pos Z) (Pos Z) = Left (Refl, Refl)\ncheckNotBothZero (Pos Z) (Pos (S k)) = Right RightPositive\ncheckNotBothZero (Pos Z) (NegS k) = Right RightNegative\ncheckNotBothZero (Pos (S k)) b = Right LeftPositive\ncheckNotBothZero (NegS k) b = Right LeftNegative\n\n|||Proof that positive numbers are not zero\nposThenNotZero:{a:ZZ}->(IsPositive a)->(NotZero a)\nposThenNotZero {a = (Pos (S k))} Positive = PositiveZ\n\nNegSThenNotZero:{a:ZZ}->(IsNegative a)->(NotZero a)\nNegSThenNotZero {a = (NegS k)} ZZUtils.Negative = NegativeZ\n\n|||Rewrites a=b as a=1*b\nrewriteRightAsOneTimesRight: {a:ZZ}->{b:ZZ}->(a=b)->(a=(1*b))\nrewriteRightAsOneTimesRight {a}{b}prf = rewrite ( (multOneLeftNeutralZ b)) in prf\n|||Rewrites a=b as 1*a=b\nrewriteLeftAsOneTimesLeft: {a:ZZ}->{b:ZZ}->(a=b)->(1*a=b)\nrewriteLeftAsOneTimesLeft {a}{b}prf = rewrite ( (multOneLeftNeutralZ a)) in prf\n|||Rewrites 1*a = b as a=b\nrewriteOneTimesLeftAsLeft:{a:ZZ}->{b:ZZ}->((1*a) = b)->(a=b)\nrewriteOneTimesLeftAsLeft {a}{b}prf =\n rewrite ( sym $(multOneLeftNeutralZ a)) in prf\n|||Rewrites (a*1)=b as a=b\nrewriteLeftTimesOneAsLeft : {a:ZZ}->{b:ZZ}->((a*1)=b)->(a=b)\nrewriteLeftTimesOneAsLeft {a}{b}prf =\n rewrite ( sym $(multOneRightNeutralZ a)) in prf\n\n|||Proof that negative integers are not non negative\nnegsAreNotNonNegs:(IsNonNegative (NegS k))->Void\nnegsAreNotNonNegs NonNegative impossible\n|||A function that checks whether an integer is non negative and returns a\n|||proof or a contradiction\ndecideIsNonNeg:(a: ZZ) -> Dec (IsNonNegative a)\ndecideIsNonNeg (Pos k) = Yes NonNegative\ndecideIsNonNeg (NegS k) = No (negsAreNotNonNegs)\n|||Proof that natural numbers are non negative\nnaturalsNonNegative: (x:Nat)->IsNonNegative (Pos x)\nnaturalsNonNegative x = NonNegative\n\n|||The less than type for ZZ\nLTZ :ZZ->ZZ->Type\nLTZ a b = LTEZ (1+a) b\n\n|||Theorem that if a and b are natural numbers and a{b:Nat}->(LT a b)->(LTZ (Pos a) (Pos b))\nltNatToZZ (LTESucc x) = PositiveLTE (LTESucc x)\n|||Proves that a<= a for any integer a\nlteReflZ:{a:ZZ}->LTEZ a a\nlteReflZ {a =(Pos k)} = PositiveLTE (lteRefl {n=k})\nlteReflZ {a= (NegS k)} = NegativeLte (lteRefl {n=k})\n|||Proof that a number is less than its successor\nnumLtSucc:(a:ZZ)->LTZ a (1+a)\nnumLtSucc a = lteReflZ\n|||Proof that one is not less than zero\noneNotLTEZero:(LTEZ (Pos (S Z)) (Pos Z))->Void\noneNotLTEZero (PositiveLTE LTEZero) impossible\noneNotLTEZero (PositiveLTE (LTESucc _)) impossible\n|||Proof that a number greater than or equal to 1 is positive\ngteOnePositive:(a:ZZ)->(LTEZ 1 a)->(IsPositive a)\ngteOnePositive (Pos Z) (PositiveLTE LTEZero) impossible\ngteOnePositive (Pos Z) (PositiveLTE (LTESucc _)) impossible\ngteOnePositive (Pos (S k)) x = Positive\ngteOnePositive (NegS _) (PositiveLTE _) impossible\ngteOnePositive (NegS _) NegLessPositive impossible\ngteOnePositive (NegS _) (NegativeLte _) impossible\n\n|||Proof that it is impossible that (1+a)<=a\nsuccNotLteNumZ:(a:ZZ)->(LTEZ (1+a) a) ->Void\nsuccNotLteNumZ (Pos k) y =\n impliesContrapositive (LTEZ (Pos (S k)) (Pos k)) (LTE (S k) k)\n LTEZZtoNat (succNotLTEnum k) y\nsuccNotLteNumZ (NegS Z) (PositiveLTE _) impossible\nsuccNotLteNumZ (NegS Z) NegLessPositive impossible\nsuccNotLteNumZ (NegS Z) (NegativeLte _) impossible\nsuccNotLteNumZ (NegS (S k)) y =\n impliesContrapositive (LTEZ (NegS k) (NegS (S k))) (LTE (S k) k)\n LTEZZtoNatNeg (succNotLTEnum k) y\n\n|||Multiplying positive numbers gives a positive number.\nposMultPosIsPos: (IsPositive m)->(IsPositive d)->(IsPositive (m*d))\nposMultPosIsPos{m = (Pos (S k))}{d = (Pos (S j))} Positive Positive = Positive\n|||The theorem that (-a)*(-b)=a*b\nnegateMultNegateNeutralZ: {a:ZZ}->{b:ZZ}->((-a)*(-b)=a*b)\nnegateMultNegateNeutralZ{a}{b} =\n rewrite (multNegateRightZ (-a) b) in\n rewrite (multNegateLeftZ a b ) in\n rewrite (doubleNegElim (a*b)) in Refl\n|||Proof that zero times an integer is not positive\nposIsNotZeroTimesInteger:((Pos (S k))=(Pos Z)*a)->Void\nposIsNotZeroTimesInteger{a = (Pos _)} Refl impossible\nposIsNotZeroTimesInteger{a = (NegS _)} Refl impossible\n|||Proof that Zero times an integer is not negative\nnegSIsNotZeroTimesInteger :((NegS k)=(Pos Z)*a)->Void\nnegSIsNotZeroTimesInteger {a = (Pos _)} Refl impossible\nnegSIsNotZeroTimesInteger {a = (NegS _)} Refl impossible\n|||Converts a nonNegative integer into the corresponding Natural number\nnonNegIntegerToNat:(a:ZZ)->(IsNonNegative a)->Nat\nnonNegIntegerToNat (Pos k) NonNegative = k\n|||Proof that a positive number is not zero times a negative number\nzeroTimesNegIsNotPos:(Pos (S k)) = (Pos Z)*(NegS j)->Void\nzeroTimesNegIsNotPos Refl impossible\n|||Proof that a positive number is not a negative number times zero\nnegTimesZeroIsNotPos :(Pos (S k)) = (NegS j)*(Pos Z)->Void\nnegTimesZeroIsNotPos {k}{j}prf =\n zeroTimesNegIsNotPos{k=k}{j=j}\n (rewrite (sym(multCommutativeZ (NegS j) (Pos Z))) in prf)\n\n|||Lemma that (c*d)*n = (c*n)*d\nmultCommuAndAssocZ1: {c:ZZ}->{d:ZZ}->{n:ZZ}->(c*d)*n = (c*n)*d\nmultCommuAndAssocZ1 {c}{d}{n}= rewrite (sym(multAssociativeZ c n d)) in\n rewrite (multCommutativeZ n d ) in\n rewrite( (multAssociativeZ c d n))in\n Refl\n\n\n\n|||Proof that if (a*b=1) then either (a=1,b=1) or (a=-1,b=-1)\nproductOneThenNumbersOne: (a:ZZ)->(b:ZZ)->(a*b=1) ->Either (a=1,b=1) (a=(-1),b=(-1))\nproductOneThenNumbersOne (Pos Z) (Pos _) Refl impossible\nproductOneThenNumbersOne (Pos Z) (NegS _) Refl impossible\nproductOneThenNumbersOne (Pos (S Z)) (Pos Z) prf = void (posIsNotPosMultZero {k=Z} (sym prf))\nproductOneThenNumbersOne (Pos (S Z)) (Pos (S Z)) prf = Left (Refl, Refl)\nproductOneThenNumbersOne (Pos (S Z)) (Pos (S (S _))) Refl impossible\nproductOneThenNumbersOne (Pos (S Z)) (NegS _) Refl impossible\nproductOneThenNumbersOne (Pos (S (S k))) (Pos Z) prf = void (posIsNotPosMultZero (sym prf))\nproductOneThenNumbersOne (Pos (S (S _))) (Pos (S Z)) Refl impossible\nproductOneThenNumbersOne (Pos (S (S _))) (Pos (S (S _))) Refl impossible\nproductOneThenNumbersOne (Pos (S (S _))) (NegS _) Refl impossible\nproductOneThenNumbersOne (NegS Z) (Pos Z) Refl impossible\nproductOneThenNumbersOne (NegS Z) (Pos (S _)) Refl impossible\nproductOneThenNumbersOne (NegS Z) (NegS Z) prf = Right (Refl,Refl)\nproductOneThenNumbersOne (NegS Z) (NegS (S _)) Refl impossible\nproductOneThenNumbersOne (NegS (S k)) (Pos Z) prf = void (negTimesZeroIsNotPos{k=Z} (sym prf))\nproductOneThenNumbersOne (NegS (S _)) (Pos (S _)) Refl impossible\nproductOneThenNumbersOne (NegS (S _)) (NegS Z) Refl impossible\nproductOneThenNumbersOne (NegS (S _)) (NegS (S _)) Refl impossible\n\n|||Right cancellation law for multiplication when right is positive\nmultRightCancelPosZ:(left1:ZZ)->(left2:ZZ)->(right:ZZ)->\n IsPositive right->(left1*right=left2*right)->(left1 = left2)\nmultRightCancelPosZ (Pos j) (Pos i) (Pos (S k)) Positive prf =\n cong (multRightCancel j i (S k) SIsNotZ expression) where\n expression = posInjective prf\nmultRightCancelPosZ (Pos _) (NegS _) (Pos (S _)) Positive Refl impossible\nmultRightCancelPosZ (NegS _) (Pos _) (Pos (S _)) Positive Refl impossible\nmultRightCancelPosZ (NegS j) (NegS i) (Pos (S k)) Positive prf =\n cong (succInjective j i (multRightCancel (S j) (S i) (S k) SIsNotZ expression)) where\n expression = posInjective (negativesSameNumbersSame prf)\n\n\n|||Right cancellation law for multiplication given a proof that right is not zero\nmultRightCancelZ:(left1:ZZ)->(left2:ZZ)->(right:ZZ)->\n NotZero right->(left1*right=left2*right)->(left1 = left2)\nmultRightCancelZ left1 left2 (Pos (S k)) PositiveZ prf =\n multRightCancelPosZ left1 left2 (Pos (S k)) Positive prf\nmultRightCancelZ left1 left2 (NegS k) NegativeZ prf =\n multRightCancelPosZ left1 left2 (-(NegS k)) Positive expression where\n expression = rewrite (multNegateRightZ left1 (NegS k)) in\n rewrite (multNegateRightZ left2 (NegS k)) in\n (numbersSameNegativesSame prf)\n|||Left Cancellation law for multiplication given a proof that left is not zero\nmultLeftCancelZ :(left : ZZ) -> (right1 : ZZ) -> (right2 : ZZ) ->\n NotZero left -> (left*right1 = left*right2) -> (right1 = right2)\nmultLeftCancelZ left right1 right2 x prf =\n multRightCancelZ right1 right2 left x expression where\n expression = rewrite (multCommutativeZ right1 left) in\n rewrite (multCommutativeZ right2 left) in\n prf\n\n|||Proof that (-a)*(-b) = a*b\nmultNegNegNeutralZ: (a:ZZ)->(b:ZZ)->(-a)*(-b)=a*b\nmultNegNegNeutralZ a b =\n rewrite multNegateRightZ (-a) b in\n rewrite multNegateLeftZ a b in\n rewrite doubleNegElim (a*b) in\n Refl\n\n|||The theorem that if a =r+q*b and g = (m1*b)+(n1*rem)\n|||Then g = (n1*a) + ((m1+n1*(-quot))*b)\nbezoutReplace:{a:ZZ}->{b:ZZ}->{m1:ZZ}->{rem:ZZ}->\n {quot:ZZ}->{n1:ZZ}->{g:ZZ}-> (a = rem + (quot *b))->\n (g=(m1*b)+(n1*rem))->(g = (n1*a) + ((m1+n1*(-quot))*b))\nbezoutReplace {a}{b}{m1}{rem}{quot}{n1}{g}prf prf1 =\n rewrite multDistributesOverPlusLeftZ m1 (n1*(-quot)) b in\n rewrite prf in\n rewrite multDistributesOverPlusRightZ n1 rem (quot*b) in\n rewrite (sym (plusAssociativeZ (n1*rem) (n1*((quot)*b)) ((m1*b)+((n1*(-quot))*b)))) in\n rewrite (plusCommutativeZ (m1*b) ((n1*(-quot))*b)) in\n rewrite (plusAssociativeZ (n1*((quot)*b)) ((n1*(-quot))*b) (m1*b)) in\n rewrite (multAssociativeZ n1 quot b) in\n rewrite (sym (multDistributesOverPlusLeftZ (n1*quot) (n1*(-quot)) b)) in\n rewrite (sym(multDistributesOverPlusRightZ n1 quot (-quot))) in\n rewrite (plusNegateInverseLZ quot) in\n rewrite (multZeroRightZeroZ n1) in\n rewrite (multZeroLeftZeroZ b) in\n rewrite (plusZeroLeftNeutralZ (m1*b)) in\n rewrite (plusCommutativeZ (n1*rem) (m1*b)) in\n prf1\n\n\nzeroNotNonZero: (NotZero (Pos Z)) -> Void\nzeroNotNonZero PositiveZ impossible\nzeroNotNonZero NegativeZ impossible\n\ndecZero: (a: ZZ) -> Dec (NotZero a)\ndecZero (Pos Z) = No zeroNotNonZero\ndecZero (Pos (S k)) = Yes (posThenNotZero Positive)\ndecZero (NegS k) = Yes (NegSThenNotZero Negative)\n\nnonZeroNotZero: (a: ZZ) -> ( (a = (Pos Z) ) -> Void) -> (NotZero a)\nnonZeroNotZero (Pos Z) f = ?nonZeroNotZero_rhs_1\nnonZeroNotZero (Pos (S k)) f = ?nonZeroNotZero_rhs_4\nnonZeroNotZero (NegS k) f = ?nonZeroNotZero_rhs_2\n","avg_line_length":44.4769230769,"max_line_length":94,"alphanum_fraction":0.7099619509} +{"size":419,"ext":"idr","lang":"Idris","max_stars_count":9.0,"content":"module LightClick.IR.Channel.Normalise.Error\n\nimport Data.String\n\n%default total\n\nnamespace Normalise\n public export\n data Error = ModuleInlined | NoModuleInstances\n\n export\n Show Error where\n show ModuleInlined = \"Normalisation Error: Module Inlined\"\n show NoModuleInstances = \"Normalisation Error: No Module instances found\"\n\npublic export\nNormalise : Type -> Type\nNormalise = Either Error\n\n\n-- [ EOF ]\n","avg_line_length":19.0454545455,"max_line_length":77,"alphanum_fraction":0.7565632458} +{"size":380,"ext":"idr","lang":"Idris","max_stars_count":128.0,"content":"Gnu : Type\nGnu = Int\n\nFoo : Type\nFoo = Bool\n\nA : Foo\nA = True\n\nmkFoo : Gnu -> Foo\nmkFoo gnu = A\n\ngnat : {auto startHere : (a : Foo ** a = A)} -> Unit\ngnat = ()\n\npathology : (gnu : Gnu) -> Unit\npathology gnu =\n let %hint foo : Foo\n foo = mkFoo gnu\n %hint bar : Foo -> (ford : arg = A)\n -> (a : Foo ** a = A)\n bar _ Refl = (A ** Refl)\n in gnat\n","avg_line_length":15.8333333333,"max_line_length":52,"alphanum_fraction":0.4868421053} +{"size":1520,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"||| Date difference\n|||\n||| Copyright 2021. HIROKI, Hattori\n||| This file is released under the MIT license, see LICENSE for more detail.\n|||\nmodule Data.Time.Calendar.CalendarDiffDays\n\nimport Generics.Derive\n\n%default total\n%language ElabReflection\n\n-- ---------------------------------------------------------------------------\n\npublic export\nrecord CalendarDiffDays where\n constructor MkCalendarDiffDays\n month : Integer\n day : Integer\n\n%runElab derive \"CalendarDiffDays\" [Generic, Meta, Eq, DecEq]\n\n\npublic export\nShow CalendarDiffDays where\n show x = \"P\" ++ show x.month ++ \"M\" ++ show x.day ++ \"D\"\n\npublic export\nSemigroup CalendarDiffDays where\n x <+> y = MkCalendarDiffDays (x.month + y.month) (x.day + y.day)\n\npublic export\nMonoid CalendarDiffDays where\n neutral = MkCalendarDiffDays 0 0\n\n\n-- ---------------------------------------------------------------------------\n\nexport calendarDay : CalendarDiffDays\ncalendarDay = MkCalendarDiffDays 0 1\n\nexport calendarWeek : CalendarDiffDays\ncalendarWeek = MkCalendarDiffDays 0 7\n\nexport calendarMonth : CalendarDiffDays\ncalendarMonth = MkCalendarDiffDays 1 0\n\nexport calendarYear : CalendarDiffDays\ncalendarYear = MkCalendarDiffDays 12 0\n\n||| Scale by a factor. Note that @scaleCalendarDiffDays (-1)@ will not perfectly invert a duration, due to variable month lengths.\nscaleCalendarDiffDays : Integer -> CalendarDiffDays -> CalendarDiffDays\nscaleCalendarDiffDays k (MkCalendarDiffDays m d) =\n MkCalendarDiffDays (k * m) (k * d)\n\n-- vim: tw=80 sw=2 expandtab :","avg_line_length":27.1428571429,"max_line_length":130,"alphanum_fraction":0.6888157895} +{"size":2391,"ext":"idr","lang":"Idris","max_stars_count":1.0,"content":"-- ----------------------------------------------------------- [ DataTypes.idr ]\n-- Module : Chapter.DataTypes\n-- Description : Definitions from Chapter 4 of Edwin Brady's book,\n-- \"Type-Driven Development with Idris.\"\n-- --------------------------------------------------------------------- [ EOH ]\nmodule Chapter.DataTypes\n\n%access export\n\n-- ------------------------------------------------------- [ 4.1.2 Union Types ]\n\npublic export\ndata Shape = Triangle Double Double\n | Rectangle Double Double\n | Circle Double\n\n%name Shape shape, shape1, shape2\n\nnamespace Shape\n\n ||| Calculate the area of a shape.\n area : Shape -> Double\n area (Triangle base height) = 0.5 * base * height\n area (Rectangle width height) = width * height\n area (Circle radius) = pi * radius * radius\n\n-- --------------------------------------------------- [ 4.1.3 Recursive Types ]\n\npublic export\ndata Picture = ||| A primitive shape.\n Primitive Shape\n | ||| A combination of two other pictures.\n Combine Picture Picture\n | ||| A picture rotated through an angle.\n Rotate Double Picture\n | ||| A picture translated to a different location.\n Translate Double Double Picture\n\n%name Picture pic, pic1, pic2\n\nnamespace Picture\n\n area : Picture -> Double\n area (Primitive shape) = area shape\n area (Combine pic pic1) = area pic + area pic1\n area (Rotate _ pic) = area pic\n area (Translate _ _ pic) = area pic\n\n-- ------------------------------------------------ [ 4.1.4 Generic Data Types ]\n\n||| A binary search tree.\npublic export\ndata Tree elem = ||| A tree with no data.\n Empty\n | ||| A node with a left subtree, a value, and a right subtree.\n Node (Tree elem) elem (Tree elem)\n \n%name Tree tree, tree1\n\n||| Insert a value into a binary search tree.\n||| @ x a value to insert\n||| @ tree a binary search tree to insert into\ninsert : Ord elem => (x : elem) -> (tree : Tree elem) -> Tree elem\ninsert x Empty = Node Empty x Empty\ninsert x orig@(Node left val right)\n = case compare x val of\n LT => Node (insert x left) val right\n EQ => orig\n GT => Node left val (insert x right)\n\n-- --------------------------------------------------------------------- [ EOF ]\n","avg_line_length":33.2083333333,"max_line_length":80,"alphanum_fraction":0.5123379339} +{"size":1237,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"module Language.LSP.Message.Trace\n\nimport Language.JSON\nimport Language.LSP.Message.Derive\nimport Language.LSP.Message.Utils\nimport Language.Reflection\n\n%language ElabReflection\n%default total\n\nnamespace Trace\n ||| Refer to https:\/\/microsoft.github.io\/language-server-protocol\/specification.html#traceValue\n public export\n data Trace = TraceOff | TraceMessages | TraceVerbose\n\nexport\nToJSON Trace where\n toJSON TraceOff = JString \"off\"\n toJSON TraceMessages = JString \"messages\"\n toJSON TraceVerbose = JString \"verbose\"\n\nexport\nFromJSON Trace where\n fromJSON (JString \"off\") = pure TraceOff\n fromJSON (JString \"messages\") = pure TraceMessages\n fromJSON (JString \"verbose\") = pure TraceVerbose\n fromJSON _ = neutral\n\n||| Refer to https:\/\/microsoft.github.io\/language-server-protocol\/specification.html#setTrace\npublic export\nrecord SetTraceParams where\n constructor MkSetTraceParams\n value : Trace\n%runElab deriveJSON defaultOpts `{{SetTraceParams}}\n\n||| Refer to https:\/\/microsoft.github.io\/language-server-protocol\/specification.html#logTrace\npublic export\nrecord LogTraceParams where\n constructor MkLogTraceParams\n message : String\n verbose : Maybe String\n%runElab deriveJSON defaultOpts `{{LogTraceParams}}\n","avg_line_length":28.7674418605,"max_line_length":97,"alphanum_fraction":0.7881972514} +{"size":145,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"module Main\n\nmain : IO ()\nmain = do putStr \"Enter your name: \"\n name <- getLine\n putStrLn $ \"Nice to meet you, \" ++ name ++ \"!\"","avg_line_length":24.1666666667,"max_line_length":56,"alphanum_fraction":0.5310344828} +{"size":233,"ext":"idr","lang":"Idris","max_stars_count":161.0,"content":"module Main\n\ncounts : String -> (Nat, Nat)\ncounts str = (length (words str), length str)\n\nmain : IO ()\nmain = repl \"Enter a string: \" show_counts\n where\n show_counts : String -> String\n show_counts x = show (counts x) ++ \"\\n\"\n","avg_line_length":21.1818181818,"max_line_length":45,"alphanum_fraction":0.6394849785} +{"size":4074,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"module Control.Linear.Network\n\n-- An experimental linear type based API to sockets\n\nimport Control.Linear.LIO\n\nimport public Network.Socket.Data\nimport Network.Socket\n\npublic export\ndata SocketState = Ready | Bound | Listening | Open | Closed\n\nexport\ndata Socket : SocketState -> Type where\n MkSocket : Socket.Data.Socket -> Socket st\n\nexport\nnewSocket : LinearIO io\n => (fam : SocketFamily)\n -> (ty : SocketType)\n -> (pnum : ProtocolNumber)\n -> (success : (1 _ : Socket Ready) -> L io ())\n -> (fail : SocketError -> L io ())\n -> L io ()\nnewSocket fam ty pnum success fail\n = do Right rawsock <- socket fam ty pnum\n | Left err => fail err\n success (MkSocket rawsock)\n\nexport\nclose : LinearIO io => (1 _ : Socket st) -> L io {use=1} (Socket Closed)\nclose (MkSocket sock)\n = do Socket.close sock\n pure1 (MkSocket sock)\n\nexport\ndone : LinearIO io => (1 _ : Socket Closed) -> L io ()\ndone (MkSocket sock) = pure ()\n\nexport\nbind : LinearIO io =>\n (1 _ : Socket Ready) ->\n (addr : Maybe SocketAddress) ->\n (port : Port) ->\n L io {use=1} (Res Bool (\\res => Socket (case res of\n False => Closed\n True => Bound)))\nbind (MkSocket sock) addr port\n = do ok <- Socket.bind sock addr port\n pure1 $ ok == 0 # MkSocket sock\n\nexport\nconnect : LinearIO io =>\n (sock : Socket) ->\n (addr : SocketAddress) ->\n (port : Port) ->\n L io {use=1} (Res Bool (\\res => Socket (case res of\n False => Closed\n True => Open)))\nconnect sock addr port\n = do ok <- Socket.connect sock addr port\n pure1 $ ok == 0 # MkSocket sock\n\nexport\nlisten : LinearIO io =>\n (1 _ : Socket Bound) ->\n L io {use=1} (Res Bool (\\res => Socket (case res of\n False => Closed\n True => Listening)))\nlisten (MkSocket sock)\n = do ok <- Socket.listen sock\n pure1 $ ok == 0 # MkSocket sock\n\nexport\naccept : LinearIO io =>\n (1 _ : Socket Listening) ->\n L io {use=1} (Res Bool (\\case\n False => Socket Listening\n True => (Socket Listening, Socket Open)))\naccept (MkSocket sock)\n = do Right (sock', sockaddr) <- Socket.accept sock\n | Left err => pure1 (False # MkSocket sock)\n pure1 (True # (MkSocket sock, MkSocket sock'))\n\nexport\nsend : LinearIO io =>\n (1 _ : Socket Open) ->\n (msg : String) ->\n L io {use=1} (Res Bool (\\res => Socket (case res of\n False => Closed\n True => Open)))\nsend (MkSocket sock) msg\n = do Right c <- Socket.send sock msg\n | Left err => pure1 (False # MkSocket sock)\n pure1 (True # MkSocket sock)\n\nexport\nrecv : LinearIO io =>\n (1 _ : Socket Open) ->\n (len : ByteLength) ->\n L io {use=1} (Res (Maybe (String, ResultCode))\n (\\res => Socket (case res of\n Nothing => Closed\n Just msg => Open)))\nrecv (MkSocket sock) len\n = do Right msg <- Socket.recv sock len\n | Left err => pure1 (Nothing # MkSocket sock)\n pure1 (Just msg # MkSocket sock)\n\nexport\nrecvAll : LinearIO io =>\n (1 _ : Socket Open) ->\n L io {use=1} (Res (Maybe String)\n (\\res => Socket (case res of\n Nothing => Closed\n Just msg => Open)))\nrecvAll (MkSocket sock)\n = do Right msg <- Socket.recvAll sock\n | Left err => pure1 (Nothing # MkSocket sock)\n pure1 (Just msg # MkSocket sock)\n","avg_line_length":33.6694214876,"max_line_length":77,"alphanum_fraction":0.4818360334} +{"size":868,"ext":"idr","lang":"Idris","max_stars_count":1.0,"content":"-- Copyright 2017, the blau.io contributors\n--\n-- Licensed under the Apache License, Version 2.0 (the \"License\");\n-- you may not use this file except in compliance with the License.\n-- You may obtain a copy of the License at\n--\n-- http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n--\n-- Unless required by applicable law or agreed to in writing, software\n-- distributed under the License is distributed on an \"AS IS\" BASIS,\n-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n-- See the License for the specific language governing permissions and\n-- limitations under the License.\n\nmodule API.WebGL.Shader\n\nimport IdrisScript\n\n%access public export\n%default total\n\nrecord WebGLShader where\n constructor New\n self : JSRef\n\nFRAGMENT_SHADER : Int\nFRAGMENT_SHADER = 0x8B30\n\nVERTEX_SHADER : Int\nVERTEX_SHADER = 0x8B31\n\n\n","avg_line_length":26.303030303,"max_line_length":78,"alphanum_fraction":0.732718894} +{"size":140,"ext":"idr","lang":"Idris","max_stars_count":396.0,"content":"module Another.Fourth\n\nimport A.Path.Of.Dires.Second\nimport Another.One.Third\n\n%default total\n\nexample2 : Tree Nat\nexample2 = map S example\n","avg_line_length":14.0,"max_line_length":29,"alphanum_fraction":0.7857142857} +{"size":407,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"module Demo\n\nimport Data.Vect\n\n-- %default total\n\nisSingleton : Bool -> Type\nisSingleton True = Int\nisSingleton False = List Nat\n\nplus' : Nat -> Nat -> Nat\nplus' Z j = j\nplus' (S k) j = S (plus k j)\n\nappend : Vect n a -> Vect m a -> Vect (n + m) a\nappend [] ys = ys\nappend (x :: xs) ys = ?sd\n\ntake' : (n : Nat) -> Vect (n + m) a -> Vect n a\ntake' = ?rhs\n\ntotal\nhead' : Vect (S n) a -> a\nhead' (x :: xs) = x\n","avg_line_length":16.28,"max_line_length":47,"alphanum_fraction":0.5675675676} +{"size":3413,"ext":"idr","lang":"Idris","max_stars_count":161.0,"content":"VendState : Type\nVendState = (Nat, Nat)\n\ndata Input = COIN \n | VEND \n | CHANGE \n | REFILL Nat\n\nstrToInput : String -> Maybe Input\nstrToInput \"insert\" = Just COIN\nstrToInput \"vend\" = Just VEND\nstrToInput \"change\" = Just CHANGE\nstrToInput x = if all isDigit (unpack x)\n then Just (REFILL (cast x))\n else Nothing\n\ndata MachineCmd : Type -> VendState -> VendState -> Type where\n InsertCoin : MachineCmd () (pounds, chocs) (S pounds, chocs)\n Vend : MachineCmd () (S pounds, S chocs) (pounds, chocs)\n GetCoins : MachineCmd () (pounds, chocs) (Z, chocs)\n\n Display : String -> \n MachineCmd () state state\n Refill : (bars : Nat) -> \n MachineCmd () (Z, chocs) (Z, bars + chocs)\n\n GetInput : MachineCmd (Maybe Input) state state \n\n Pure : ty -> MachineCmd ty state state\n (>>=) : MachineCmd a state1 state2 -> (a -> MachineCmd b state2 state3) ->\n MachineCmd b state1 state3\n\ndata MachineIO : VendState -> Type where\n Do : MachineCmd a state1 state2 ->\n (a -> Inf (MachineIO state2)) -> MachineIO state1\n\nrunMachine : MachineCmd ty inState outState -> IO ty\nrunMachine InsertCoin = putStrLn \"Coin inserted\"\nrunMachine Vend = putStrLn \"Please take your chocolate\"\nrunMachine {inState = (pounds, _)} GetCoins \n = putStrLn (show pounds ++ \" coins returned\")\nrunMachine (Display str) = putStrLn str\nrunMachine (Refill bars)\n = putStrLn (\"Chocolate remaining: \" ++ show bars)\nrunMachine {inState = (pounds, chocs)} GetInput\n = do putStrLn (\"Coins: \" ++ show pounds ++ \"; \" ++\n \"Stock: \" ++ show chocs)\n putStr \"> \"\n x <- getLine\n pure (strToInput x)\nrunMachine (Pure x) = pure x\nrunMachine (cmd >>= prog) = do x <- runMachine cmd\n runMachine (prog x)\n\ndata Fuel = Dry | More (Lazy Fuel)\n\npartial\nforever : Fuel\nforever = More forever\n\nrun : Fuel -> MachineIO state -> IO ()\nrun (More fuel) (Do c f) \n = do res <- runMachine c\n run fuel (f res)\nrun Dry p = pure ()\n\n\nnamespace MachineDo\n (>>=) : MachineCmd a state1 state2 ->\n (a -> Inf (MachineIO state2)) -> MachineIO state1\n (>>=) = Do\n\nmutual\n vend : MachineIO (pounds, chocs)\n vend {pounds = S p} {chocs = S c} = do Vend\n Display \"Enjoy!\"\n machineLoop\n vend {pounds = Z} = do Display \"Insert a coin\"\n machineLoop\n vend {chocs = Z} = do Display \"Out of stock\"\n machineLoop\n\n refill : (num : Nat) -> MachineIO (pounds, chocs)\n refill {pounds = Z} num = do Refill num\n machineLoop\n refill _ = do Display \"Can't refill: Coins in machine\"\n machineLoop\n\n machineLoop : MachineIO (pounds, chocs)\n machineLoop =\n do Just x <- GetInput | Nothig => do Display \"Invalid input\"\n machineLoop\n case x of\n COIN => do InsertCoin\n machineLoop\n VEND => vend\n CHANGE => do GetCoins\n Display \"Change returned\"\n machineLoop\n REFILL num => refill num\n\nmain : IO ()\nmain = run forever (machineLoop {pounds = 0} {chocs = 1})\n\n","avg_line_length":32.5047619048,"max_line_length":79,"alphanum_fraction":0.5458540873} +{"size":18589,"ext":"idr","lang":"Idris","max_stars_count":22.0,"content":"module Hedgehog.Internal.Report\n\nimport Data.List1\nimport Data.Nat\nimport Data.SortedMap\nimport Generics.Derive\nimport Hedgehog.Internal.Config\nimport Hedgehog.Internal.Property\nimport Hedgehog.Internal.Range\nimport Hedgehog.Internal.Seed\nimport Hedgehog.Internal.Util\nimport Text.Show.Diff\nimport Text.PrettyPrint.Prettyprinter\nimport Text.PrettyPrint.Prettyprinter.Render.Terminal as Term\nimport Text.PrettyPrint.Prettyprinter.Render.String as Str\n\n%default total\n\n%language ElabReflection\n\n--------------------------------------------------------------------------------\n-- Reporting\n--------------------------------------------------------------------------------\n\npublic export\nrecord FailedAnnotation where\n constructor MkFailedAnnotation\n failedValue : String\n\n%runElab derive \"FailedAnnotation\" [Generic,Meta,Show,Eq]\n\npublic export\nrecord FailureReport where\n constructor MkFailureReport\n size : Size\n seed : Seed\n shrinks : ShrinkCount\n coverage : Maybe (Coverage CoverCount)\n annotations : List FailedAnnotation\n message : String\n diff : Maybe Diff\n footnotes : List String\n\n%runElab derive \"FailureReport\" [Generic,Meta,Show,Eq]\n\n||| The status of a running property test.\npublic export\ndata Progress = Running | Shrinking FailureReport\n\n%runElab derive \"Progress\" [Generic,Meta,Show,Eq]\n\n||| The status of a completed property test.\n|||\n||| In the case of a failure it provides the seed used for the test, the\n||| number of shrinks, and the execution log.\npublic export\ndata Result = Failed FailureReport | OK\n\n%runElab derive \"Result\" [Generic,Meta,Show,Eq]\n\npublic export\nisFailure : Result -> Bool\nisFailure (Failed _) = True\nisFailure OK = False\n\npublic export\nisSuccess : Result -> Bool\nisSuccess = not . isFailure\n\n||| A report on a running or completed property test.\npublic export\nrecord Report a where\n constructor MkReport\n tests : TestCount\n coverage : Coverage CoverCount\n status : a\n\n%runElab derive \"Report\" [Generic,Meta,Show,Eq]\n\nexport\nFunctor Report where\n map f = {status $= f}\n\nexport\nFoldable Report where\n foldl f acc = f acc . status\n foldr f acc r = f r.status acc\n null _ = False\n\nexport\nTraversable Report where\n traverse f (MkReport t c a) = MkReport t c <$> f a\n\n||| A summary of all the properties executed.\npublic export\nrecord Summary where\n constructor MkSummary\n waiting : PropertyCount\n running : PropertyCount\n failed : PropertyCount\n ok : PropertyCount\n\n%runElab derive \"Summary\" [Generic,Meta,Show,Eq,Semigroup,Monoid]\n\nrecord ColumnWidth where\n constructor MkColumnWidth\n widthPercentage : Nat\n widthMinimum : Nat\n widthName : Nat\n widthNameFail : Nat\n\nSemigroup ColumnWidth where\n MkColumnWidth p0 m0 n0 f0 <+> MkColumnWidth p1 m1 n1 f1 =\n MkColumnWidth (max p0 p1) (max m0 m1) (max n0 n1) (max f0 f1)\n\nMonoid ColumnWidth where\n neutral = MkColumnWidth 0 0 0 0\n\n||| Construct a summary from a single result.\nexport\nfromResult : Result -> Summary\nfromResult (Failed _) = { failed := 1} neutral\nfromResult OK = { ok := 1} neutral\n\nexport\nsummaryCompleted : Summary -> PropertyCount\nsummaryCompleted (MkSummary _ _ x3 x4) = x3 + x4\n\nexport\nsummaryTotal : Summary -> PropertyCount\nsummaryTotal (MkSummary x1 x2 x3 x4) = x1 + x2 + x3 + x4\n\nexport\ntakeAnnotation : Lazy Log -> Maybe FailedAnnotation\ntakeAnnotation (Annotation x) = Just $ MkFailedAnnotation x\ntakeAnnotation (Footnote _ ) = Nothing\ntakeAnnotation (LogLabel _ ) = Nothing\n\nexport\ntakeFootnote : Lazy Log -> Maybe String\ntakeFootnote (Footnote x) = Just x\ntakeFootnote (Annotation _) = Nothing\ntakeFootnote (LogLabel _) = Nothing\n\nexport\nmkFailure : Size\n -> Seed\n -> ShrinkCount\n -> Maybe (Coverage CoverCount)\n -> String\n -> Maybe Diff\n -> List (Lazy Log)\n -> FailureReport\nmkFailure size seed shrinks mcoverage message diff logs =\n let inputs = mapMaybe takeAnnotation logs\n footnotes = mapMaybe takeFootnote logs\n in MkFailureReport size seed shrinks mcoverage inputs message diff footnotes\n\n--------------------------------------------------------------------------------\n-- Pretty Printing\n--------------------------------------------------------------------------------\n\npublic export\ndata MarkupStyle = StyleDefault | StyleAnnotation | StyleFailure\n\nexport\nSemigroup MarkupStyle where\n StyleFailure <+> _ = StyleFailure\n _ <+> StyleFailure = StyleFailure\n StyleAnnotation <+> _ = StyleAnnotation\n _ <+> StyleAnnotation = StyleAnnotation\n StyleDefault <+> _ = StyleDefault\n\n%runElab derive \"MarkupStyle\" [Generic,Meta,Show,Eq]\n\npublic export\ndata Markup =\n WaitingIcon\n | WaitingHeader\n | RunningIcon\n | RunningHeader\n | ShrinkingIcon\n | ShrinkingHeader\n | FailedIcon\n | FailedText\n | SuccessIcon\n | SuccessText\n | CoverageIcon\n | CoverageText\n | CoverageFill\n | StyledBorder MarkupStyle\n | AnnotationValue\n | DiffPrefix\n | DiffInfix\n | DiffSuffix\n | DiffSame\n | DiffRemoved\n | DiffAdded\n | ReproduceHeader\n | ReproduceGutter\n | ReproduceSource\n\nppShow : Show x => x -> Doc ann\nppShow = pretty . show\n\nmarkup : Markup -> Doc Markup -> Doc Markup\nmarkup = annotate\n\ngutter : Markup -> Doc Markup -> Doc Markup\ngutter m x = markup m \">\" <++> x\n\nicon : Markup -> Char -> Doc Markup -> Doc Markup\nicon m i x = markup m (pretty i) <++> x\n\nppTestCount : TestCount -> Doc ann\nppTestCount (MkTagged 1) = \"1 test\"\nppTestCount (MkTagged n) = ppShow n <++> \"tests\"\n\nppShrinkCount : ShrinkCount -> Doc ann\nppShrinkCount (MkTagged 1) = \"1 shrink\"\nppShrinkCount (MkTagged n) = ppShow n <++> \"shrinks\"\n\nppRawPropertyCount : PropertyCount -> Doc ann\nppRawPropertyCount (MkTagged n) = ppShow n\n\nppLineDiff : LineDiff -> Doc Markup\nppLineDiff (LineSame x) = markup DiffSame $ \" \" <+> pretty x\nppLineDiff (LineRemoved x) = markup DiffRemoved $ \"- \" <+> pretty x\nppLineDiff (LineAdded x) = markup DiffAdded $ \"+ \" <+> pretty x\n\nppDiff : Diff -> List (Doc Markup)\nppDiff (MkDiff pre removed inf added suffix diff) =\n ( markup DiffPrefix (pretty pre) <+>\n markup DiffRemoved (pretty removed) <+>\n markup DiffInfix (pretty inf) <+>\n markup DiffAdded (pretty added) <+>\n markup DiffSuffix (pretty suffix)\n ) :: map ppLineDiff (toLineDiff diff)\n\nppLabelName : LabelName -> Doc ann\nppLabelName = pretty . unTag\n\nrenderCoverPercentage : CoverPercentage -> String\nrenderCoverPercentage (MkTagged p) =\n show (round {a = Double} (p * 10.0) \/ 10.0) <+> \"%\"\n\nppCoverPercentage : CoverPercentage -> Doc Markup\nppCoverPercentage = pretty . renderCoverPercentage\n\nppReproduce : Maybe PropertyName -> Size -> Seed -> Doc Markup\nppReproduce name size seed =\n vsep [\n markup ReproduceHeader \"This failure can be reproduced by running:\"\n , gutter ReproduceGutter . markup ReproduceSource $\n \"recheck\" <++>\n pretty (showPrec App size) <++>\n pretty (showPrec App seed) <++>\n maybe \"\" (pretty . unTag) name\n ]\n\nppTextLines : String -> List (Doc Markup)\nppTextLines = map pretty . lines\n\nppFailedInput : Nat -> FailedAnnotation -> Doc Markup\nppFailedInput ix (MkFailedAnnotation val) =\n vsep [\n \"forAll\" <++> ppShow ix <++> \"=\"\n , indent 2 . vsep . map (markup AnnotationValue . pretty) $ lines val\n ]\n\nppFailureReport : Maybe PropertyName\n -> TestCount\n -> FailureReport\n -> List (Doc Markup)\nppFailureReport nm tests (MkFailureReport si se _ mcover inputs msg mdiff msgs0) =\n whenSome (neutral ::) .\n whenSome (++ [neutral]) .\n punctuate line .\n map (vsep . map (indent 2)) .\n filter (\\xs => not $ null xs) $\n [punctuate line args, coverage, docs, bottom]\n\n where whenSome : Foldable t => (t a -> t a) -> t a -> t a\n whenSome f xs = if null xs then xs else f xs\n\n bottom : List (Doc Markup)\n bottom = maybe [ppReproduce nm si se] (const Nil) mcover\n\n docs : List (Doc Markup)\n docs = concatMap ppTextLines (msgs0 ++ if msg == \"\" then [] else [msg])\n <+> maybe [] ppDiff mdiff\n\n args : List (Doc Markup)\n args = zipWith ppFailedInput [0 .. length inputs] (reverse inputs)\n\n coverage : List (Doc Markup)\n coverage =\n case mcover of\n Nothing => []\n Just c => do MkLabel _ _ count <- coverageFailures tests c\n pure $\n cat [ \"Failed (\"\n , annotate CoverageText $\n ppCoverPercentage (coverPercentage tests count)\n <+> \" coverage\"\n , \")\"\n ]\n\nppName : Maybe PropertyName -> Doc ann\nppName Nothing = \"\"\nppName (Just $ MkTagged name) = pretty name\n\nlabelWidth : TestCount -> Label CoverCount -> ColumnWidth\nlabelWidth tests x =\n let percentage = length .\n renderCoverPercentage $\n coverPercentage tests x.labelAnnotation\n\n minimum = if x.labelMinimum == 0\n then the Nat 0\n else length .\n renderCoverPercentage $\n x.labelMinimum\n\n name = length . unTag $ x.labelName\n\n nameFail = if labelCovered tests x then the Nat 0 else name\n\n in MkColumnWidth percentage minimum name nameFail\n\ncoverageWidth : TestCount -> Coverage CoverCount -> ColumnWidth\ncoverageWidth tests (MkCoverage labels) = concatMap (labelWidth tests) labels\n\nppLeftPad : Nat -> Doc ann -> Doc ann\nppLeftPad n doc =\n let ndoc = length (show doc)\n pad = pretty . pack $ replicate (n `minus` ndoc) ' '\n in pad <+> doc\n\nppCoverBar : CoverPercentage -> CoverPercentage -> Doc Markup\nppCoverBar (MkTagged percentage) (MkTagged minimum) =\n let barWidth = the Nat 20\n coverageRatio = percentage \/ 100.0\n coverageWidth = toNat . floor $ coverageRatio * cast barWidth\n minimumRatio = minimum \/ 100.0\n minimumWidth = toNat . floor $ minimumRatio * cast barWidth\n fillWidth = pred $ barWidth `minus` coverageWidth\n fillErrorWidth = pred $ minimumWidth `minus` coverageWidth\n fillSurplusWidth = fillWidth `minus` fillErrorWidth\n full = '\u2588'\n parts1 = '\u00b7' ::: ['\u258f','\u258e','\u258d','\u258c','\u258b','\u258a','\u2589']\n parts = forget parts1\n\n ix = toNat . floor $\n ((coverageRatio * cast barWidth) - cast coverageWidth)\n * cast (length parts)\n\n part = case inBounds ix parts of\n Yes ib => index ix parts\n No _ => head parts1\n\n in hcat [ pretty . pack $ replicate coverageWidth full\n , if coverageWidth < barWidth then\n if ix == 0 then\n if fillErrorWidth > 0 then annotate FailedText $ pretty part\n else annotate CoverageFill $ pretty part\n else pretty part\n else \"\"\n , annotate FailedText . pretty . pack $\n replicate fillErrorWidth (head parts1)\n , annotate CoverageFill . pretty . pack $\n replicate fillSurplusWidth (head parts1)\n ]\n\nppLabel : TestCount -> ColumnWidth -> Label CoverCount -> Doc Markup\nppLabel tests w x@(MkLabel name minimum count) =\n let covered = labelCovered tests x\n ltext = if not covered then annotate CoverageText else id\n lborder = annotate (StyledBorder StyleDefault)\n licon = if not covered then annotate CoverageText \"\u26a0 \" else \" \"\n lname = fill (cast w.widthName) (ppLabelName name)\n wminimum = ppLeftPad w.widthMinimum $ ppCoverPercentage minimum\n lcover = wcover \"\"\n\n lminimum =\n if w.widthMinimum == 0 then neutral\n else if not covered then \" \u2717 \" <+> wminimum\n else if minimum == 0 then \" \" <+> ppLeftPad w.widthMinimum \"\"\n else \" \u2713 \" <+> wminimum\n\n\n in hcat [ licon\n , ltext lname\n , lborder \" \"\n , ltext lcover\n , lborder \" \"\n , ltext $ ppCoverBar (coverPercentage tests count) minimum\n , lborder \"\"\n , ltext lminimum\n ]\n\n\n where wcover : String -> Doc Markup\n wcover i = ppLeftPad (w.widthPercentage + length i) $\n pretty i <+>\n ppCoverPercentage (coverPercentage tests count)\n\nppCoverage : TestCount -> Coverage CoverCount -> List (Doc Markup)\nppCoverage tests x =\n map (ppLabel tests (coverageWidth tests x)) $\n values x.coverageLabels\n\nppWhenNonZero : Doc ann -> PropertyCount -> Maybe (Doc ann)\nppWhenNonZero _ 0 = Nothing\nppWhenNonZero suffix n = Just $ ppRawPropertyCount n <++> suffix\n\nexport\nppProgress : Maybe PropertyName -> Report Progress -> Doc Markup\nppProgress name (MkReport tests coverage status) =\n case status of\n Running =>\n vsep $ [ icon RunningIcon '\u25cf' . annotate RunningHeader $\n ppName name <++>\n \"passed\" <++>\n ppTestCount tests <+> \"(running)\"\n ] ++ ppCoverage tests coverage\n\n Shrinking failure =>\n icon ShrinkingIcon '\u21af' . annotate ShrinkingHeader $\n ppName name <++> \"failed after\" <++> ppTestCount tests\n\nannotateSummary : Summary -> Doc Markup -> Doc Markup\nannotateSummary summary =\n if summary.failed > 0 then\n icon FailedIcon '\u2717' . annotate FailedText\n else if summary.waiting > 0 || summary.running > 0 then\n icon WaitingIcon '\u25cb' . annotate WaitingHeader\n else\n icon SuccessIcon '\u2713' . annotate SuccessText\n\nppResult : Maybe PropertyName -> Report Result -> Doc Markup\nppResult name (MkReport tests coverage result) =\n case result of\n Failed failure =>\n vsep $ [ icon FailedIcon '\u2717' . align . annotate FailedText $\n ppName name <++>\n \"failed after\" <++>\n ppTestCount tests <+>\n \".\"\n ] ++\n ppCoverage tests coverage ++\n ppFailureReport name tests failure\n\n OK => vsep $ [ icon SuccessIcon '\u2713' . annotate SuccessText $\n ppName name <++>\n \"passed\" <++>\n ppTestCount tests <+>\n \".\"\n ] ++\n ppCoverage tests coverage\n\nexport\nppSummary : Summary -> Doc Markup\nppSummary summary =\n let complete = summaryCompleted summary == summaryTotal summary\n suffix = if complete then the (Doc Markup) \".\" else \" (running)\"\n\n in annotateSummary summary .\n (<+> suffix) .\n hcat .\n addPrefix complete .\n punctuate \", \" $\n catMaybes [\n ppWhenNonZero \"failed\" summary.failed\n , if complete then\n ppWhenNonZero \"succeeded\" summary.ok\n else\n Nothing\n ]\n\n where doPrefix : Bool -> Doc Markup -> Doc Markup\n doPrefix True _ = neutral\n doPrefix False end =\n ppRawPropertyCount (summaryCompleted summary) <+>\n \"\/\" <+>\n ppRawPropertyCount (summaryTotal summary) <++>\n \"complete\" <+> end\n\n addPrefix : Bool -> List (Doc Markup) -> List (Doc Markup)\n addPrefix complete [] = [doPrefix complete neutral]\n addPrefix complete xs = doPrefix complete \": \" :: xs\n\ntoAnsi : Markup -> AnsiStyle\ntoAnsi (StyledBorder StyleAnnotation) = []\ntoAnsi (StyledBorder StyleDefault) = []\ntoAnsi (StyledBorder StyleFailure) = []\ntoAnsi AnnotationValue = color Magenta\ntoAnsi CoverageFill = color BrightBlack\ntoAnsi CoverageIcon = color Yellow\ntoAnsi CoverageText = color Yellow\ntoAnsi DiffAdded = color Green\ntoAnsi DiffInfix = []\ntoAnsi DiffPrefix = []\ntoAnsi DiffRemoved = color Red\ntoAnsi DiffSame = []\ntoAnsi DiffSuffix = []\ntoAnsi FailedIcon = color BrightRed\ntoAnsi FailedText = color BrightRed\ntoAnsi ReproduceGutter = []\ntoAnsi ReproduceHeader = []\ntoAnsi ReproduceSource = []\ntoAnsi RunningHeader = []\ntoAnsi RunningIcon = []\ntoAnsi ShrinkingHeader = color BrightRed\ntoAnsi ShrinkingIcon = color BrightRed\ntoAnsi SuccessIcon = color Green\ntoAnsi SuccessText = color Green\ntoAnsi WaitingHeader = []\ntoAnsi WaitingIcon = []\n\nexport\nrenderDoc : UseColor -> Doc Markup -> String\nrenderDoc usecol doc =\n let stream = layoutSmart defaultLayoutOptions\n $ indent 2 doc\n\n in case usecol of\n DisableColor => Str.renderString stream\n EnableColor => Term.renderString $ reAnnotateS toAnsi stream\n\nexport\nrenderProgress : UseColor -> Maybe PropertyName -> Report Progress -> String\nrenderProgress color name = renderDoc color . ppProgress name\n\nexport\nrenderResult : UseColor -> Maybe PropertyName -> Report Result -> String\nrenderResult color name = renderDoc color . ppResult name\n\nexport\nrenderSummary : UseColor -> Summary -> String\nrenderSummary color = renderDoc color . ppSummary\n\n--------------------------------------------------------------------------------\n-- Test Report\n--------------------------------------------------------------------------------\n\nexport\nreport : (aborted : Bool)\n -> TestCount\n -> Size\n -> Seed\n -> Coverage CoverCount\n -> Maybe Confidence\n -> Report Result\nreport aborted tests size seed cover conf =\n let failureReport = \\msg =>\n MkReport tests cover . Failed $\n mkFailure size seed 0 (Just cover) msg Nothing []\n\n coverageReached = successVerified tests cover conf\n\n labelsCovered = coverageSuccess tests cover\n\n successReport = MkReport tests cover OK\n\n confidenceReport =\n if coverageReached && labelsCovered\n then successReport\n else failureReport $\n \"Test coverage cannot be reached after \" <+>\n show tests <+>\n \" tests\"\n\n in if aborted then confidenceReport\n else if labelsCovered then successReport\n else failureReport $\n \"Labels not sufficently covered after \" <+>\n show tests <+>\n \" tests\"\n","avg_line_length":32.05,"max_line_length":83,"alphanum_fraction":0.6058421647} +{"size":4147,"ext":"idr","lang":"Idris","max_stars_count":1.0,"content":"-- -------------------------------------------------------------- [ PModel.idr ]\n-- Module : PModel.idr\n-- Copyright : (c) Jan de Muijnck-Hughes\n-- License : see LICENSE\n-- --------------------------------------------------------------------- [ EOH ]\n\nmodule Sif.PModel\n\nimport public GRL.Common\nimport public GRL.IR\nimport public GRL.Model\nimport public GRL.Builder\nimport public GRL.Pretty\n\n%access export\n%default total\n\n-- ------------------------------------------------------------------- [ Types ]\n\npublic export\ndata FTy = FuncTy | UsabTy | ReliTy | PerfTy | SuppTy\n\npublic export\ndata ATy = CodeTy | ControlTy | ActionTy\n\npublic export\ndata LTy = ActLink | AffLink\n\npublic export\ndata PMTy = Req FTy | Act ATy | Link LTy | Sub GStructTy\n\n-- ------------------------------------------------------- [ Meta Typing Rules ]\n\npublic export\ndata ValidLink : LTy -> PMTy -> PMTy -> Type where\n RAct : ValidLink ty (Req x) (Req y)\n MAct : ValidLink ty (Act x) (Req y)\n AAct : ValidLink ty (Act y) (Act y)\n\npublic export\ndata ValidDecomp : PMTy -> PMTy -> Type where\n SubR : ValidDecomp (Req x) (Req y)\n SubM : ValidDecomp (Act x) (Act y)\n\npublic export\ndata ValidDecomps : PMTy -> List PMTy -> Type where\n Nil : ValidDecomps x Nil\n (::) : (x : PMTy)\n -> (y : PMTy)\n -> {auto prf : ValidDecomp x y}\n -> ValidDecomps x ys\n -> ValidDecomps z (y::ys)\n\n-- ------------------------------------------ [ Abstract Syntax & Typing Rules ]\n\npublic export\ndata PModel : PMTy -> GTy -> Type where\n MkReq : (ty : FTy) -> String -> PModel (Req ty) ELEM\n MkAction : (ty : ATy) -> String -> Maybe SValue -> PModel (Act ty) ELEM\n MkLink : (ty : LTy)\n -> CValue\n -> PModel x ELEM\n -> PModel y ELEM\n -> {auto prf : ValidLink ty x y}\n -> PModel (Link ty) INTENT\n MkSub : (ty : GStructTy)\n -> PModel x ELEM\n -> DList PMTy (\\y => PModel y ELEM) ys\n -> {auto prf : ValidDecomps x ys}\n -> PModel (Sub ty) STRUCT\n\n-- ----------------------------------------------------- [ Typing Type-Aliases ]\n\npublic export\nFUNCTIONAL : Type\nFUNCTIONAL = PModel (Req FuncTy) ELEM\n\npublic export\nUSABILITY : Type\nUSABILITY = PModel (Req UsabTy) ELEM\n\npublic export\nRELIABILITY : Type\nRELIABILITY = PModel (Req ReliTy) ELEM\n\npublic export\nPERFORMANCE : Type\nPERFORMANCE = PModel (Req PerfTy) ELEM\n\npublic export\nSUPPORTABILITY : Type\nSUPPORTABILITY = PModel (Req SuppTy) ELEM\n\npublic export\nCODEACTION : Type\nCODEACTION = PModel (Act CodeTy) ELEM\n\npublic export\nCONTROL : Type\nCONTROL = PModel (Act ControlTy) ELEM\n\npublic export\nACTION : Type\nACTION = PModel (Act ActionTy) ELEM\n\n-- ---------------------------------------------------- [ Element Constructors ]\n\nmkFunctional : String -> FUNCTIONAL\nmkFunctional = MkReq FuncTy\n\nmkUsability : String -> USABILITY\nmkUsability = MkReq UsabTy\n\nmkReliability : String -> RELIABILITY\nmkReliability = MkReq ReliTy\n\nmkPerformance : String -> PERFORMANCE\nmkPerformance = MkReq PerfTy\n\nmkSupportability : String -> SUPPORTABILITY\nmkSupportability = MkReq SuppTy\n\nmkControl : String -> Maybe SValue -> CONTROL\nmkControl = MkAction ControlTy\n\nmkCode : String -> Maybe SValue -> CODEACTION\nmkCode = MkAction CodeTy\n\nmkAction : String -> Maybe SValue -> ACTION\nmkAction = MkAction ActionTy\n\n-- -------------------------------------------------------- [ Operator Aliases ]\n\nsyntax [a] \"==>\" [b] \"|\" [c] = MkLink ActLink c a b\nsyntax [a] \"~~>\" [b] \"|\" [c] = MkLink AffLink c a b\nsyntax [a] \"&=\" [bs] = MkSub ANDty a bs\nsyntax [a] \"X=\" [bs] = MkSub XORty a bs\nsyntax [a] \"|=\" [bs] = MkSub IORty a bs\n\n-- ------------------------------------------------------------- [ Interpreter ]\n\nGRL (\\ty => PModel x ty) where\n mkElem (MkReq ty t) = Elem GOALty t Nothing\n mkElem (MkAction ty t sval) = Elem TASKty t sval\n\n mkIntent (MkLink AffLink c a b) = ILink AFFECTSty c (mkElem a) (mkElem b)\n mkIntent (MkLink ActLink c a b) = ILink IMPACTSty c (mkElem a) (mkElem b)\n\n mkStruct (MkSub ty x ys) = SLink ty (mkElem x) (mapDList (mkElem) ys)\n\n\n-- --------------------------------------------------------------------- [ EOF ]\n","avg_line_length":27.1045751634,"max_line_length":80,"alphanum_fraction":0.5657101519} +{"size":645,"ext":"idr","lang":"Idris","max_stars_count":6.0,"content":"import Data.String\n\nsubtract : Neg a => a -> a -> a\nsubtract x y = y - x\n\nparse : List Char -> Integer -> Integer\nparse (x::xs) =\n case parseInteger (pack xs) of\n Nothing => id\n Just num =>\n case x of\n '+' => (+num)\n '-' => subtract num\n\nloop : Integer -> List (List Char) -> Integer\nloop acc lst = foldl (\\x, f => f x) acc (map parse lst)\n\nmain : IO ()\nmain = do\n args <- getArgs\n case args of\n (_::arg::_) => do\n file <- readFile arg\n case file of\n Right res => print $ loop 0 $ map unpack (lines res)\n Left _ => putStrLn \"File not found\"\n _ => putStrLn \"Usage: .\/appositum input.txt\"\n","avg_line_length":23.0357142857,"max_line_length":60,"alphanum_fraction":0.5550387597} +{"size":2335,"ext":"idr","lang":"Idris","max_stars_count":133.0,"content":"module IR.Event\n\nimport IR.Lens\n\nKeyCode : Type\nKeyCode = Int\n\nrecord Key : Type where\n MkKey : (keyCode : KeyCode) ->\n (keyHasAlt : Bool) ->\n (keyHasCmd : Bool) ->\n (keyHasCtrl : Bool) ->\n (keyHasShift : Bool) ->\n Key\n\ninstance Eq Key where\n (==) (MkKey a b c d e) (MkKey a' b' c' d' e') = a == a' && b == b' && c == c' && d == d' && e == e'\n\n-- Should be the Monoid instance:\ninfixl 3 \n() : Ordering -> Ordering -> Ordering\n() EQ r = r\n() l r = l\n\n-- Should be the Ord instance:\ncompareBool : Bool -> Bool -> Ordering\ncompareBool False False = EQ\ncompareBool False True = LT\ncompareBool True False = GT\ncompareBool True True = EQ\n\ninstance Ord Key where\n compare (MkKey a b c d e) (MkKey a' b' c' d' e') = compare a a'\n compareBool b b'\n compareBool c c'\n compareBool d d'\n compareBool e e'\n\nkeyCode' : Lens Key KeyCode\nkeyCode' = lens (\\(MkKey x _ _ _ _) => x) (\\x, (MkKey _ a b c d) => MkKey x a b c d)\n\nkeyHasAlt' : Lens Key Bool\nkeyHasAlt' = lens (\\(MkKey _ x _ _ _) => x) (\\x, (MkKey a _ b c d) => MkKey a x b c d)\n\nkeyHasCmd' : Lens Key Bool\nkeyHasCmd' = lens (\\(MkKey _ _ x _ _) => x) (\\x, (MkKey a b _ c d) => MkKey a b x c d)\n\nkeyHasCtrl' : Lens Key Bool\nkeyHasCtrl' = lens (\\(MkKey _ _ _ x _) => x) (\\x, (MkKey a b c _ d) => MkKey a b c x d)\n\nkeyHasShift' : Lens Key Bool\nkeyHasShift' = lens (\\(MkKey _ _ _ _ x) => x) (\\x, (MkKey a b c d _) => MkKey a b c d x)\n\ndata Event = KeyEvent Key\n | RefreshEvent\n | IgnoredEvent\n\neventFromPtr : Ptr -> IO Event\neventFromPtr p = do\n t <- mkForeign (FFun \"irEventType\" [FPtr] FInt) p\n c <- mkForeign (FFun \"irEventKeyCode\" [FPtr] FInt) p\n alt <- map (\/= 0) (mkForeign (FFun \"irEventKeyAlternate\" [FPtr] FInt) p)\n cmd <- map (\/= 0) (mkForeign (FFun \"irEventKeyCommand\" [FPtr] FInt) p)\n ctrl <- map (\/= 0) (mkForeign (FFun \"irEventKeyControl\" [FPtr] FInt) p)\n shift <- map (\/= 0) (mkForeign (FFun \"irEventKeyShift\" [FPtr] FInt) p)\n mkForeign (FFun \"irEventFree\" [FPtr] FUnit) p\n return (case t of\n 0 => KeyEvent (MkKey c alt cmd ctrl shift)\n 1 => RefreshEvent\n _ => IgnoredEvent)\n","avg_line_length":32.8873239437,"max_line_length":101,"alphanum_fraction":0.5430406852} +{"size":62,"ext":"idr","lang":"Idris","max_stars_count":1.0,"content":"module Main\n\nmain : IO ()\nmain = do\n printLn \"Hello, world!\"\n","avg_line_length":10.3333333333,"max_line_length":25,"alphanum_fraction":0.6290322581} +{"size":4638,"ext":"idr","lang":"Idris","max_stars_count":13.0,"content":"module Idris.Codegen.ExtSTG.Representation\n\nimport Idris.Codegen.ExtSTG.Prelude\n\npublic export\ndata PrimElemRep\n = Int8ElemRep\n | Int16ElemRep\n | Int32ElemRep\n | Int64ElemRep\n | Word8ElemRep\n | Word16ElemRep\n | Word32ElemRep\n | Word64ElemRep\n | FloatElemRep\n | DoubleElemRep\n\nexport\nSemiDecEq PrimElemRep where\n semiDecEq Int8ElemRep Int8ElemRep = Just Refl\n semiDecEq Int16ElemRep Int16ElemRep = Just Refl\n semiDecEq Int32ElemRep Int32ElemRep = Just Refl\n semiDecEq Int64ElemRep Int64ElemRep = Just Refl\n semiDecEq Word8ElemRep Word8ElemRep = Just Refl\n semiDecEq Word16ElemRep Word16ElemRep = Just Refl\n semiDecEq Word32ElemRep Word32ElemRep = Just Refl\n semiDecEq Word64ElemRep Word64ElemRep = Just Refl\n semiDecEq FloatElemRep FloatElemRep = Just Refl\n semiDecEq DoubleElemRep DoubleElemRep = Just Refl\n semiDecEq _ _ = Nothing\n\nShow PrimElemRep where\n show Int8ElemRep = \"Int8ElemRep\"\n show Int16ElemRep = \"Int16ElemRep\"\n show Int32ElemRep = \"Int32ElemRep\"\n show Int64ElemRep = \"Int64ElemRep\"\n show Word8ElemRep = \"Word8ElemRep\"\n show Word16ElemRep = \"Word16ElemRep\"\n show Word32ElemRep = \"Word32ElemRep\"\n show Word64ElemRep = \"Word64ElemRep\"\n show FloatElemRep = \"FloatElemRep\"\n show DoubleElemRep = \"DoubleElemRep\"\n\npublic export\ndata PrimRep\n = VoidRep\n | LiftedRep -- Boxed, in thunk or WHNF\n | UnliftedRep -- Boxed, in WHNF\n | Int8Rep -- Unboxed, Signed, 8 bits value\n | Int16Rep -- Unboxed, Signed, 16 bits value\n | Int32Rep -- Unboxed, Signed, 32 bits value\n | Int64Rep -- Unboxed, Signed, 64 bits value (with 32 bits words only)\n | IntRep -- Unboxed, Signed, word-sized value\n | Word8Rep -- Unboxed, Unsigned, 8 bits value\n | Word16Rep -- Unboxed, Unsigned, 16 bits value\n | Word32Rep -- Unboxed, Unsigned, 32 bits value\n | Word64Rep -- Unboxed, Unisgned, 64 bits value (with 32 bits words only)\n | WordRep -- Unboxed, Unisgned, word-sized value\n | AddrRep -- A pointer, but *not* a Haskell value. Use (Un)liftedRep\n | FloatRep\n | DoubleRep\n | VecRep Nat PrimElemRep -- A vector\n\n-- MutableByteArray has its own tag in GHC.\n\npublic export\nByteArrayRep : PrimRep\nByteArrayRep = UnliftedRep\n\npublic export\nMutableByteArrayRep : PrimRep\nMutableByteArrayRep = UnliftedRep\n\nexport\nSemiDecEq PrimRep where\n semiDecEq VoidRep VoidRep = Just Refl\n semiDecEq LiftedRep LiftedRep = Just Refl\n semiDecEq UnliftedRep UnliftedRep = Just Refl\n semiDecEq Int8Rep Int8Rep = Just Refl\n semiDecEq Int16Rep Int16Rep = Just Refl\n semiDecEq Int32Rep Int32Rep = Just Refl\n semiDecEq Int64Rep Int64Rep = Just Refl\n semiDecEq IntRep IntRep = Just Refl\n semiDecEq Word8Rep Word8Rep = Just Refl\n semiDecEq Word16Rep Word16Rep = Just Refl\n semiDecEq Word32Rep Word32Rep = Just Refl\n semiDecEq Word64Rep Word64Rep = Just Refl\n semiDecEq WordRep WordRep = Just Refl\n semiDecEq AddrRep AddrRep = Just Refl\n semiDecEq FloatRep FloatRep = Just Refl\n semiDecEq DoubleRep DoubleRep = Just Refl\n semiDecEq (VecRep n1 p1) (VecRep n2 p2) = do\n Refl <- semiDecEq p1 p2\n Refl <- semiDecEq n1 n2\n Just Refl\n semiDecEq _ _ = Nothing\n\nexport\nShow PrimRep where\n showPrec d VoidRep = \"VoidRep\"\n showPrec d LiftedRep = \"LiftedRep\"\n showPrec d UnliftedRep = \"UnliftedRep\"\n showPrec d Int8Rep = \"Int8Rep\"\n showPrec d Int16Rep = \"Int16Rep\"\n showPrec d Int32Rep = \"Int32Rep\"\n showPrec d Int64Rep = \"Int64Rep\"\n showPrec d IntRep = \"IntRep\"\n showPrec d Word8Rep = \"Word8Rep\"\n showPrec d Word16Rep = \"Word16Rep\"\n showPrec d Word32Rep = \"Word32Rep\"\n showPrec d Word64Rep = \"Word64Rep\"\n showPrec d WordRep = \"WordRep\"\n showPrec d AddrRep = \"AddrRep\"\n showPrec d FloatRep = \"FloatRep\"\n showPrec d DoubleRep = \"DoubleRep\"\n showPrec d (VecRep n p) = showCon d \"VecRep\" $ showArg n ++ \" \" ++ showArg p\n\n||| SingeValue LiftedRep = Simple Algebraic value\npublic export\ndata RepType\n = SingleValue PrimRep\n | UnboxedTuple (List PrimRep)\n | PolymorphicRep\n\nexport\nShow RepType where\n showPrec d (SingleValue p) = showCon d \"SingleValue\" $ showArg p\n showPrec d (UnboxedTuple ps) = showCon d \"UnboxedTuple\" $ showArg ps\n showPrec d PolymorphicRep = \"PolymorphicRep\"\n\nexport\nSemiDecEq RepType where\n semiDecEq (SingleValue p1) (SingleValue p2) = do\n Refl <- semiDecEq p1 p2\n Just Refl\n semiDecEq (UnboxedTuple p1) (UnboxedTuple p2) = do\n Refl <- semiDecEq p1 p2\n Just Refl\n semiDecEq PolymorphicRep PolymorphicRep = Just Refl\n semiDecEq _ _ = Nothing\n\n","avg_line_length":32.661971831,"max_line_length":78,"alphanum_fraction":0.7119448038} +{"size":5679,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"module Generics.SOP\n\nimport Decidable.Equality\n\nimport public Data.List.Elem\nimport public Data.SOP\n\n%default total\n\n||| Interface for converting a data type from and to\n||| its generic representation as a sum of products.\n|||\n||| Additional Idris coolness: This comes with proofs\n||| that `from . to = id` and `to . from = id` and\n||| thus, that `t` and `SOP code` are indeed isomorphic.\npublic export\ninterface Generic (0 t : Type) (0 code : List $ List Type) | t where\n constructor MkGeneric\n ||| Converts the data type to its generic representation.\n from : (v : t) -> SOP I code\n\n ||| Converts the generic representation back to the original\n ||| value.\n to : (v : SOP I code) -> t\n\n ||| Proof that `to . from = id`.\n fromToId : (v : t) -> to (from v) = v\n\n ||| Proof that `from . to = id`.\n toFromId : (v : SOP I code) -> from (to v) = v\n\nexport\nfromInjective : Generic t code =>\n (0 x : t) -> (0 y : t) -> (from x = from y) -> x = y\nfromInjective x y prf = rewrite sym $ fromToId y in lemma2\n where lemma1 : to {t = t} (from x) = to {t = t} (from y)\n lemma1 = cong to prf\n\n lemma2 : x = to {t = t} (from y)\n lemma2 = rewrite sym $ fromToId x in lemma1\n\npublic export\n0 Code : (t : Type) -> Generic t code => List $ List Type\nCode _ = code\n\n||| Tries to extract the arguments of a single constructor\n||| from a value's generic representation.\npublic export\ngenExtract : (0 ts : List Type)\n -> (v : t)\n -> Generic t code\n => {auto prf : Elem ts code}\n -> Maybe (NP I ts)\ngenExtract ts v = extractSOP ts $ from v\n\n||| Tries to extract the value of a single one argument\n||| constructor from a value's generic representation.\npublic export\ngenExtract1 : (0 t' : Type)\n -> (v : t)\n -> Generic t code\n => {auto prf : Elem [t'] code}\n -> Maybe t'\ngenExtract1 t' v = hd <$> genExtract [t'] v\n\n||| Returns all value from a generic enum type\n||| (all nullary constructors) wrapped in homogeneous n-ary product.\npublic export\nvaluesNP : Generic t code => (et : EnumType code) =>\n NP_ (List Type) (K t) code\nvaluesNP = hmap (to . MkSOP) (run et)\n where run : EnumType kss -> NP_ (List k) (K (NS_ (List k) (NP f) kss)) kss\n run EZ = []\n run (ES x) = Z [] :: mapNP (\\ns => S ns) (run x)\n\n||| Returns all value from a generic enum type\n||| (all nullary constructors) wrapped in a list.\npublic export %inline\nvalues : Generic t code => (et : EnumType code) => List t\nvalues = collapseNP valuesNP\n\n||| Like `valuesNP` but takes the erased value type as an\n||| explicit argument to help with type inference.\npublic export %inline\nvaluesForNP : (0 t: Type) -> Generic t code => (et : EnumType code) =>\n NP_ (List Type) (K t) code\nvaluesForNP _ = valuesNP\n\n||| Like `values` but takes the erased value type as an\n||| explicit argument to help with type inference.\npublic export %inline\nvaluesFor : (0 t : Type) -> Generic t code => (et : EnumType code) => List t\nvaluesFor _ = values\n\n--------------------------------------------------------------------------------\n-- Generic Implementation Functions\n--------------------------------------------------------------------------------\n\n||| Default `(==)` implementation for data types with a `Generic`\n||| instance.\npublic export\ngenEq : Generic t code => POP Eq code => t -> t -> Bool\ngenEq x y = from x == from y\n\n||| Default `compare` implementation for data types with a `Generic`\n||| instance.\npublic export\ngenCompare : Generic t code => POP Ord code => t -> t -> Ordering\ngenCompare x y = compare (from x) (from y)\n\n||| Default `decEq` implementation for data types with a `Generic`\n||| instance.\npublic export\ngenDecEq : Generic t code => POP DecEq code\n => (x : t) -> (y : t) -> Dec (x = y)\ngenDecEq x y = case decEq (from x) (from y) of\n (Yes prf) => Yes $ fromInjective x y prf\n (No contra) => No $ \\h => contra (cong from h)\n\n||| Default `(<+>)` implementation for data types with a `Generic`\n||| instance.\npublic export\ngenAppend : Generic t [ts]\n => POP Semigroup [ts]\n => t -> t -> t\ngenAppend x y = to $ from x <+> from y\n\n||| Default `neutral` implementation for data types with a `Generic`\n||| instance.\npublic export\ngenNeutral : Generic t [ts] => POP Monoid [ts] => t\ngenNeutral = to neutral\n\n--------------------------------------------------------------------------------\n-- Prelude Implementations\n--------------------------------------------------------------------------------\n\n-- I wrote the implementations below manually to get a feel for\n-- their general structure before starting with deriving\n-- them via elaborator reflection.\n\npublic export\nGeneric () [[]] where\n from () = MkSOP $ Z []\n\n to (MkSOP $ Z []) = ()\n to (MkSOP $ S _) impossible\n\n fromToId () = Refl\n\n toFromId (MkSOP $ Z []) = Refl\n\npublic export\nGeneric (a,b) [[a,b]] where\n from (a,b) = MkSOP $ Z [a,b]\n\n to (MkSOP $ Z [a,b]) = (a,b)\n to (MkSOP $ S _) impossible\n\n fromToId (a,b) = Refl\n\n toFromId (MkSOP $ Z [a,b]) = Refl\n\npublic export\nGeneric (LPair a b) [[a,b]] where\n from (a # b) = MkSOP $ Z [a,b]\n\n to (MkSOP $ Z [a,b]) = (a # b)\n to (MkSOP $ S _) impossible\n\n fromToId (a # b) = Refl\n\n toFromId (MkSOP $ Z [a, b]) = Refl\n\npublic export\nGeneric Void [] where\n from v impossible\n\n to (MkSOP v) impossible\n\n fromToId v impossible\n\n toFromId (MkSOP v) impossible\n\npublic export\nGeneric (Stream a) [[a, Inf (Stream a)]] where\n from (h :: t) = MkSOP $ Z [h,t]\n\n to (MkSOP $ Z [h,t]) = h :: t\n\n fromToId (h :: t) = Refl\n\n toFromId (MkSOP $ Z [h,t]) = Refl\n","avg_line_length":29.2731958763,"max_line_length":80,"alphanum_fraction":0.578622997} +{"size":297,"ext":"idr","lang":"Idris","max_stars_count":1.0,"content":"import Data.List.Views\n\ntotal\nmerge_sort : Ord a => List a -> List a\nmerge_sort xs with (splitRec xs)\n merge_sort [] | SplitRecNil = []\n merge_sort [x] | SplitRecOne = [x]\n merge_sort (lefts ++ rights) | (SplitRecPair lrec rrec)\n = merge (merge_sort lefts | lrec) (merge_sort rights | rrec)\n","avg_line_length":29.7,"max_line_length":64,"alphanum_fraction":0.6835016835} +{"size":1466,"ext":"idr","lang":"Idris","max_stars_count":128.0,"content":"import Data.Primitives.Views\nimport Data.Bits\nimport System\n\n%default total\n\ndata InfIO : Type where\n Do : IO a -> (a -> Inf InfIO) -> InfIO\n Seq : IO () -> Inf InfIO -> InfIO\n\n(>>=) : IO a -> (a -> Inf InfIO) -> InfIO\n(>>=) = Do\n\n(>>) : IO () -> Inf InfIO -> InfIO\n(>>) = Seq\n\ndata Fuel = Dry | More (Lazy Fuel)\n\nrun : Fuel -> InfIO -> IO ()\nrun (More fuel) (Do c f) = do res <- c\n run fuel (f res)\nrun (More fuel) (Seq c d) = do c; run fuel d\nrun Dry p = putStrLn \"Out of fuel\"\n\nrandoms : Int -> Stream Int\nrandoms seed = let seed' = 1664525 * seed + 1013904223 in\n (seed' `shiftR` 2) :: randoms seed'\n\narithInputs : Int -> Stream Int\narithInputs seed = map bound (randoms seed)\n where\n bound : Int -> Int\n bound x with (divides x 12)\n bound ((12 * div) + rem) | (DivBy div rem prf) = abs rem + 1\n\nquiz : Stream Int -> (score : Nat) -> InfIO\nquiz (num1 :: num2 :: nums) score\n = do putStrLn (\"Score so far: \" ++ show score)\n putStr (show num1 ++ \" * \" ++ show num2 ++ \"? \")\n answer <- getLine\n if (cast answer == num1 * num2)\n then do putStrLn \"Correct!\"\n quiz nums (score + 1)\n else do putStrLn (\"Wrong, the answer is \" ++ show (num1 * num2))\n quiz nums score\n\npartial\nforever : Fuel\nforever = More forever\n\npartial\nmain : IO ()\nmain = do seed <- time\n run forever (quiz (arithInputs (fromInteger seed)) 0)\n","avg_line_length":26.6545454545,"max_line_length":75,"alphanum_fraction":0.5518417462} +{"size":527,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"data DoorState = DoorOpen | DoorClosed\n\ndata DoorCmd : Type ->\n DoorState -> DoorState ->\n Type where\n Open : DoorCmd () DoorClosed DoorOpen\n Close : DoorCmd () DoorOpen DoorClosed\n RingBell : DoorCmd () DoorClosed DoorClosed\n\n Pure : ty -> DoorCmd ty state state\n (>>=) : DoorCmd a state1 state2 ->\n (a -> DoorCmd b state2 state3) ->\n DoorCmd b state1 state3\n\ndoorProg : DoorCmd () DoorClosed DoorClosed\ndoorProg = do RingBell\n Open\n Close\n","avg_line_length":27.7368421053,"max_line_length":45,"alphanum_fraction":0.5977229602} +{"size":341422,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"module Web.Raw.Html\n \nimport JS\nimport Web.Internal.HtmlPrim\nimport Web.Internal.Types\n\n--------------------------------------------------------------------------------\n-- Interfaces\n--------------------------------------------------------------------------------\n\nnamespace AudioTrack\n \n export\n enabled : AudioTrack -> Attribute True I Bool\n enabled v = fromPrim \"AudioTrack.getenabled\" prim__enabled prim__setEnabled v\n \n export\n id : (obj : AudioTrack) -> JSIO String\n id a = primJS $ AudioTrack.prim__id a\n \n export\n kind : (obj : AudioTrack) -> JSIO String\n kind a = primJS $ AudioTrack.prim__kind a\n \n export\n label : (obj : AudioTrack) -> JSIO String\n label a = primJS $ AudioTrack.prim__label a\n \n export\n language : (obj : AudioTrack) -> JSIO String\n language a = primJS $ AudioTrack.prim__language a\n \n export\n sourceBuffer : (obj : AudioTrack) -> JSIO (Maybe SourceBuffer)\n sourceBuffer a = tryJS \"AudioTrack.sourceBuffer\"\n $ AudioTrack.prim__sourceBuffer a\n\n\nnamespace AudioTrackList\n \n export\n get : (obj : AudioTrackList) -> (index : Bits32) -> JSIO AudioTrack\n get a b = primJS $ AudioTrackList.prim__get a b\n \n export\n length : (obj : AudioTrackList) -> JSIO Bits32\n length a = primJS $ AudioTrackList.prim__length a\n \n export\n onaddtrack : AudioTrackList -> Attribute False Maybe EventHandlerNonNull\n onaddtrack v = fromNullablePrim \"AudioTrackList.getonaddtrack\"\n prim__onaddtrack\n prim__setOnaddtrack\n v\n \n export\n onchange : AudioTrackList -> Attribute False Maybe EventHandlerNonNull\n onchange v = fromNullablePrim \"AudioTrackList.getonchange\"\n prim__onchange\n prim__setOnchange\n v\n \n export\n onremovetrack : AudioTrackList -> Attribute False Maybe EventHandlerNonNull\n onremovetrack v = fromNullablePrim \"AudioTrackList.getonremovetrack\"\n prim__onremovetrack\n prim__setOnremovetrack\n v\n \n export\n getTrackById : (obj : AudioTrackList)\n -> (id : String)\n -> JSIO (Maybe AudioTrack)\n getTrackById a b = tryJS \"AudioTrackList.getTrackById\"\n $ AudioTrackList.prim__getTrackById a b\n\n\nnamespace BarProp\n \n export\n visible : (obj : BarProp) -> JSIO Bool\n visible a = tryJS \"BarProp.visible\" $ BarProp.prim__visible a\n\n\nnamespace BeforeUnloadEvent\n \n export\n returnValue : BeforeUnloadEvent -> Attribute True I String\n returnValue v = fromPrim \"BeforeUnloadEvent.getreturnValue\"\n prim__returnValue\n prim__setReturnValue\n v\n\n\nnamespace BroadcastChannel\n \n export\n new : (name : String) -> JSIO BroadcastChannel\n new a = primJS $ BroadcastChannel.prim__new a\n \n export\n name : (obj : BroadcastChannel) -> JSIO String\n name a = primJS $ BroadcastChannel.prim__name a\n \n export\n onmessage : BroadcastChannel -> Attribute False Maybe EventHandlerNonNull\n onmessage v = fromNullablePrim \"BroadcastChannel.getonmessage\"\n prim__onmessage\n prim__setOnmessage\n v\n \n export\n onmessageerror : BroadcastChannel -> Attribute False Maybe EventHandlerNonNull\n onmessageerror v = fromNullablePrim \"BroadcastChannel.getonmessageerror\"\n prim__onmessageerror\n prim__setOnmessageerror\n v\n \n export\n close : (obj : BroadcastChannel) -> JSIO ()\n close a = primJS $ BroadcastChannel.prim__close a\n \n export\n postMessage : (obj : BroadcastChannel) -> (message : Any) -> JSIO ()\n postMessage a b = primJS $ BroadcastChannel.prim__postMessage a (toFFI b)\n\n\nnamespace CanvasGradient\n \n export\n addColorStop : (obj : CanvasGradient)\n -> (offset : Double)\n -> (color : String)\n -> JSIO ()\n addColorStop a b c = primJS $ CanvasGradient.prim__addColorStop a b c\n\n\nnamespace CanvasPattern\n \n export\n setTransform : (0 _ : JSType t1)\n => {auto 0 _ : Elem DOMMatrix2DInit (Types t1)}\n -> (obj : CanvasPattern)\n -> (transform : Optional t1)\n -> JSIO ()\n setTransform a b = primJS $ CanvasPattern.prim__setTransform a (optUp b)\n\n export\n setTransform' : (obj : CanvasPattern) -> JSIO ()\n setTransform' a = primJS $ CanvasPattern.prim__setTransform a undef\n\n\nnamespace CanvasRenderingContext2D\n \n export\n canvas : (obj : CanvasRenderingContext2D) -> JSIO HTMLCanvasElement\n canvas a = primJS $ CanvasRenderingContext2D.prim__canvas a\n \n export\n getContextAttributes : (obj : CanvasRenderingContext2D)\n -> JSIO CanvasRenderingContext2DSettings\n getContextAttributes a = primJS\n $ CanvasRenderingContext2D.prim__getContextAttributes a\n\n\nnamespace CloseEvent\n \n export\n new : (0 _ : JSType t1)\n => {auto 0 _ : Elem CloseEventInit (Types t1)}\n -> (type : String)\n -> (eventInitDict : Optional t1)\n -> JSIO CloseEvent\n new a b = primJS $ CloseEvent.prim__new a (optUp b)\n\n export\n new' : (type : String) -> JSIO CloseEvent\n new' a = primJS $ CloseEvent.prim__new a undef\n \n export\n code : (obj : CloseEvent) -> JSIO Bits16\n code a = primJS $ CloseEvent.prim__code a\n \n export\n reason : (obj : CloseEvent) -> JSIO String\n reason a = primJS $ CloseEvent.prim__reason a\n \n export\n wasClean : (obj : CloseEvent) -> JSIO Bool\n wasClean a = tryJS \"CloseEvent.wasClean\" $ CloseEvent.prim__wasClean a\n\n\nnamespace CustomElementRegistry\n \n export\n define : (0 _ : JSType t1)\n => {auto 0 _ : Elem ElementDefinitionOptions (Types t1)}\n -> (obj : CustomElementRegistry)\n -> (name : String)\n -> (constructor : CustomElementConstructor)\n -> (options : Optional t1)\n -> JSIO ()\n define a b c d = primJS $ CustomElementRegistry.prim__define a b c (optUp d)\n\n export\n define' : (obj : CustomElementRegistry)\n -> (name : String)\n -> (constructor : CustomElementConstructor)\n -> JSIO ()\n define' a b c = primJS $ CustomElementRegistry.prim__define a b c undef\n \n export\n get : (obj : CustomElementRegistry)\n -> (name : String)\n -> JSIO (Union2 CustomElementConstructor Undefined)\n get a b = primJS $ CustomElementRegistry.prim__get a b\n \n export\n upgrade : (0 _ : JSType t1)\n => {auto 0 _ : Elem Node (Types t1)}\n -> (obj : CustomElementRegistry)\n -> (root : t1)\n -> JSIO ()\n upgrade a b = primJS $ CustomElementRegistry.prim__upgrade a (up b)\n \n export\n whenDefined : (obj : CustomElementRegistry)\n -> (name : String)\n -> JSIO (Promise CustomElementConstructor)\n whenDefined a b = primJS $ CustomElementRegistry.prim__whenDefined a b\n\n\nnamespace DOMParser\n \n export\n new : JSIO DOMParser\n new = primJS $ DOMParser.prim__new \n \n export\n parseFromString : (obj : DOMParser)\n -> (string : String)\n -> (type : DOMParserSupportedType)\n -> JSIO Document\n parseFromString a b c = primJS $ DOMParser.prim__parseFromString a b (toFFI c)\n\n\nnamespace DOMStringList\n \n export\n length : (obj : DOMStringList) -> JSIO Bits32\n length a = primJS $ DOMStringList.prim__length a\n \n export\n contains : (obj : DOMStringList) -> (string : String) -> JSIO Bool\n contains a b = tryJS \"DOMStringList.contains\"\n $ DOMStringList.prim__contains a b\n \n export\n item : (obj : DOMStringList) -> (index : Bits32) -> JSIO (Maybe String)\n item a b = tryJS \"DOMStringList.item\" $ DOMStringList.prim__item a b\n\n\nnamespace DOMStringMap\n \n export\n get : (obj : DOMStringMap) -> (name : String) -> JSIO String\n get a b = primJS $ DOMStringMap.prim__get a b\n \n export\n set : (obj : DOMStringMap) -> (name : String) -> (value : String) -> JSIO ()\n set a b c = primJS $ DOMStringMap.prim__set a b c\n\n\nnamespace DataTransfer\n \n export\n new : JSIO DataTransfer\n new = primJS $ DataTransfer.prim__new \n \n export\n dropEffect : DataTransfer -> Attribute True I String\n dropEffect v = fromPrim \"DataTransfer.getdropEffect\"\n prim__dropEffect\n prim__setDropEffect\n v\n \n export\n effectAllowed : DataTransfer -> Attribute True I String\n effectAllowed v = fromPrim \"DataTransfer.geteffectAllowed\"\n prim__effectAllowed\n prim__setEffectAllowed\n v\n \n export\n files : (obj : DataTransfer) -> JSIO FileList\n files a = primJS $ DataTransfer.prim__files a\n \n export\n items : (obj : DataTransfer) -> JSIO DataTransferItemList\n items a = primJS $ DataTransfer.prim__items a\n \n export\n types : (obj : DataTransfer) -> JSIO (Array String)\n types a = primJS $ DataTransfer.prim__types a\n \n export\n clearData : (obj : DataTransfer) -> (format : Optional String) -> JSIO ()\n clearData a b = primJS $ DataTransfer.prim__clearData a (toFFI b)\n\n export\n clearData' : (obj : DataTransfer) -> JSIO ()\n clearData' a = primJS $ DataTransfer.prim__clearData a undef\n \n export\n getData : (obj : DataTransfer) -> (format : String) -> JSIO String\n getData a b = primJS $ DataTransfer.prim__getData a b\n \n export\n setData : (obj : DataTransfer)\n -> (format : String)\n -> (data_ : String)\n -> JSIO ()\n setData a b c = primJS $ DataTransfer.prim__setData a b c\n \n export\n setDragImage : (0 _ : JSType t1)\n => {auto 0 _ : Elem Element (Types t1)}\n -> (obj : DataTransfer)\n -> (image : t1)\n -> (x : Int32)\n -> (y : Int32)\n -> JSIO ()\n setDragImage a b c d = primJS $ DataTransfer.prim__setDragImage a (up b) c d\n\n\nnamespace DataTransferItem\n \n export\n kind : (obj : DataTransferItem) -> JSIO String\n kind a = primJS $ DataTransferItem.prim__kind a\n \n export\n type : (obj : DataTransferItem) -> JSIO String\n type a = primJS $ DataTransferItem.prim__type a\n \n export\n getAsFile : (obj : DataTransferItem) -> JSIO (Maybe File)\n getAsFile a = tryJS \"DataTransferItem.getAsFile\"\n $ DataTransferItem.prim__getAsFile a\n \n export\n getAsString : (obj : DataTransferItem)\n -> (callback : Maybe FunctionStringCallback)\n -> JSIO ()\n getAsString a b = primJS $ DataTransferItem.prim__getAsString a (toFFI b)\n\n\nnamespace DataTransferItemList\n \n export\n get : (obj : DataTransferItemList)\n -> (index : Bits32)\n -> JSIO DataTransferItem\n get a b = primJS $ DataTransferItemList.prim__get a b\n \n export\n length : (obj : DataTransferItemList) -> JSIO Bits32\n length a = primJS $ DataTransferItemList.prim__length a\n \n export\n add : (obj : DataTransferItemList)\n -> (data_ : String)\n -> (type : String)\n -> JSIO (Maybe DataTransferItem)\n add a b c = tryJS \"DataTransferItemList.add\"\n $ DataTransferItemList.prim__add a b c\n \n export\n add1 : (obj : DataTransferItemList)\n -> (data_ : File)\n -> JSIO (Maybe DataTransferItem)\n add1 a b = tryJS \"DataTransferItemList.add1\"\n $ DataTransferItemList.prim__add1 a b\n \n export\n clear : (obj : DataTransferItemList) -> JSIO ()\n clear a = primJS $ DataTransferItemList.prim__clear a\n \n export\n remove : (obj : DataTransferItemList) -> (index : Bits32) -> JSIO ()\n remove a b = primJS $ DataTransferItemList.prim__remove a b\n\n\nnamespace DedicatedWorkerGlobalScope\n \n export\n name : (obj : DedicatedWorkerGlobalScope) -> JSIO String\n name a = primJS $ DedicatedWorkerGlobalScope.prim__name a\n \n export\n onmessage : DedicatedWorkerGlobalScope\n -> Attribute False Maybe EventHandlerNonNull\n onmessage v = fromNullablePrim \"DedicatedWorkerGlobalScope.getonmessage\"\n prim__onmessage\n prim__setOnmessage\n v\n \n export\n onmessageerror : DedicatedWorkerGlobalScope\n -> Attribute False Maybe EventHandlerNonNull\n onmessageerror v = fromNullablePrim \"DedicatedWorkerGlobalScope.getonmessageerror\"\n prim__onmessageerror\n prim__setOnmessageerror\n v\n \n export\n close : (obj : DedicatedWorkerGlobalScope) -> JSIO ()\n close a = primJS $ DedicatedWorkerGlobalScope.prim__close a\n \n export\n postMessage : (obj : DedicatedWorkerGlobalScope)\n -> (message : Any)\n -> (transfer : Array Object)\n -> JSIO ()\n postMessage a b c = primJS\n $ DedicatedWorkerGlobalScope.prim__postMessage a (toFFI b) c\n \n export\n postMessage1 : (0 _ : JSType t1)\n => {auto 0 _ : Elem PostMessageOptions (Types t1)}\n -> (obj : DedicatedWorkerGlobalScope)\n -> (message : Any)\n -> (options : Optional t1)\n -> JSIO ()\n postMessage1 a b c = primJS\n $ DedicatedWorkerGlobalScope.prim__postMessage1 a\n (toFFI b)\n (optUp c)\n\n export\n postMessage1' : (obj : DedicatedWorkerGlobalScope)\n -> (message : Any)\n -> JSIO ()\n postMessage1' a b = primJS\n $ DedicatedWorkerGlobalScope.prim__postMessage1 a\n (toFFI b)\n undef\n\n\nnamespace DragEvent\n \n export\n new : (0 _ : JSType t1)\n => {auto 0 _ : Elem DragEventInit (Types t1)}\n -> (type : String)\n -> (eventInitDict : Optional t1)\n -> JSIO DragEvent\n new a b = primJS $ DragEvent.prim__new a (optUp b)\n\n export\n new' : (type : String) -> JSIO DragEvent\n new' a = primJS $ DragEvent.prim__new a undef\n \n export\n dataTransfer : (obj : DragEvent) -> JSIO (Maybe DataTransfer)\n dataTransfer a = tryJS \"DragEvent.dataTransfer\"\n $ DragEvent.prim__dataTransfer a\n\n\nnamespace ElementInternals\n \n export\n form : (obj : ElementInternals) -> JSIO (Maybe HTMLFormElement)\n form a = tryJS \"ElementInternals.form\" $ ElementInternals.prim__form a\n \n export\n labels : (obj : ElementInternals) -> JSIO NodeList\n labels a = primJS $ ElementInternals.prim__labels a\n \n export\n shadowRoot : (obj : ElementInternals) -> JSIO (Maybe ShadowRoot)\n shadowRoot a = tryJS \"ElementInternals.shadowRoot\"\n $ ElementInternals.prim__shadowRoot a\n \n export\n validationMessage : (obj : ElementInternals) -> JSIO String\n validationMessage a = primJS $ ElementInternals.prim__validationMessage a\n \n export\n validity : (obj : ElementInternals) -> JSIO ValidityState\n validity a = primJS $ ElementInternals.prim__validity a\n \n export\n willValidate : (obj : ElementInternals) -> JSIO Bool\n willValidate a = tryJS \"ElementInternals.willValidate\"\n $ ElementInternals.prim__willValidate a\n \n export\n checkValidity : (obj : ElementInternals) -> JSIO Bool\n checkValidity a = tryJS \"ElementInternals.checkValidity\"\n $ ElementInternals.prim__checkValidity a\n \n export\n reportValidity : (obj : ElementInternals) -> JSIO Bool\n reportValidity a = tryJS \"ElementInternals.reportValidity\"\n $ ElementInternals.prim__reportValidity a\n \n export\n setFormValue : (obj : ElementInternals)\n -> (value : Maybe (NS I [ File , String , FormData ]))\n -> (state : Optional (Maybe (NS I [ File , String , FormData ])))\n -> JSIO ()\n setFormValue a b c = primJS\n $ ElementInternals.prim__setFormValue a (toFFI b) (toFFI c)\n\n export\n setFormValue' : (obj : ElementInternals)\n -> (value : Maybe (NS I [ File , String , FormData ]))\n -> JSIO ()\n setFormValue' a b = primJS\n $ ElementInternals.prim__setFormValue a (toFFI b) undef\n \n export\n setValidity : (0 _ : JSType t1)\n => (0 _ : JSType t2)\n => {auto 0 _ : Elem ValidityStateFlags (Types t1)}\n -> {auto 0 _ : Elem HTMLElement (Types t2)}\n -> (obj : ElementInternals)\n -> (flags : Optional t1)\n -> (message : Optional String)\n -> (anchor : Optional t2)\n -> JSIO ()\n setValidity a b c d = primJS\n $ ElementInternals.prim__setValidity a\n (optUp b)\n (toFFI c)\n (optUp d)\n\n export\n setValidity' : (obj : ElementInternals) -> JSIO ()\n setValidity' a = primJS\n $ ElementInternals.prim__setValidity a undef undef undef\n\n\nnamespace ErrorEvent\n \n export\n new : (0 _ : JSType t1)\n => {auto 0 _ : Elem ErrorEventInit (Types t1)}\n -> (type : String)\n -> (eventInitDict : Optional t1)\n -> JSIO ErrorEvent\n new a b = primJS $ ErrorEvent.prim__new a (optUp b)\n\n export\n new' : (type : String) -> JSIO ErrorEvent\n new' a = primJS $ ErrorEvent.prim__new a undef\n \n export\n colno : (obj : ErrorEvent) -> JSIO Bits32\n colno a = primJS $ ErrorEvent.prim__colno a\n \n export\n error : (obj : ErrorEvent) -> JSIO Any\n error a = tryJS \"ErrorEvent.error\" $ ErrorEvent.prim__error a\n \n export\n filename : (obj : ErrorEvent) -> JSIO String\n filename a = primJS $ ErrorEvent.prim__filename a\n \n export\n lineno : (obj : ErrorEvent) -> JSIO Bits32\n lineno a = primJS $ ErrorEvent.prim__lineno a\n \n export\n message : (obj : ErrorEvent) -> JSIO String\n message a = primJS $ ErrorEvent.prim__message a\n\n\nnamespace EventSource\n \n public export\n CLOSED : Bits16\n CLOSED = 2\n \n public export\n CONNECTING : Bits16\n CONNECTING = 0\n \n public export\n OPEN : Bits16\n OPEN = 1\n \n export\n new : (0 _ : JSType t1)\n => {auto 0 _ : Elem EventSourceInit (Types t1)}\n -> (url : String)\n -> (eventSourceInitDict : Optional t1)\n -> JSIO EventSource\n new a b = primJS $ EventSource.prim__new a (optUp b)\n\n export\n new' : (url : String) -> JSIO EventSource\n new' a = primJS $ EventSource.prim__new a undef\n \n export\n onerror : EventSource -> Attribute False Maybe EventHandlerNonNull\n onerror v = fromNullablePrim \"EventSource.getonerror\"\n prim__onerror\n prim__setOnerror\n v\n \n export\n onmessage : EventSource -> Attribute False Maybe EventHandlerNonNull\n onmessage v = fromNullablePrim \"EventSource.getonmessage\"\n prim__onmessage\n prim__setOnmessage\n v\n \n export\n onopen : EventSource -> Attribute False Maybe EventHandlerNonNull\n onopen v = fromNullablePrim \"EventSource.getonopen\"\n prim__onopen\n prim__setOnopen\n v\n \n export\n readyState : (obj : EventSource) -> JSIO Bits16\n readyState a = primJS $ EventSource.prim__readyState a\n \n export\n url : (obj : EventSource) -> JSIO String\n url a = primJS $ EventSource.prim__url a\n \n export\n withCredentials : (obj : EventSource) -> JSIO Bool\n withCredentials a = tryJS \"EventSource.withCredentials\"\n $ EventSource.prim__withCredentials a\n \n export\n close : (obj : EventSource) -> JSIO ()\n close a = primJS $ EventSource.prim__close a\n\n\nnamespace External\n \n export\n AddSearchProvider : (obj : External) -> JSIO ()\n AddSearchProvider a = primJS $ External.prim__AddSearchProvider a\n \n export\n IsSearchProviderInstalled : (obj : External) -> JSIO ()\n IsSearchProviderInstalled a = primJS\n $ External.prim__IsSearchProviderInstalled a\n\n\nnamespace FormDataEvent\n \n export\n new : (0 _ : JSType t1)\n => {auto 0 _ : Elem FormDataEventInit (Types t1)}\n -> (type : String)\n -> (eventInitDict : t1)\n -> JSIO FormDataEvent\n new a b = primJS $ FormDataEvent.prim__new a (up b)\n \n export\n formData : (obj : FormDataEvent) -> JSIO FormData\n formData a = primJS $ FormDataEvent.prim__formData a\n\n\nnamespace HTMLAllCollection\n \n export\n get : (obj : HTMLAllCollection) -> (index : Bits32) -> JSIO Element\n get a b = primJS $ HTMLAllCollection.prim__get a b\n \n export\n length : (obj : HTMLAllCollection) -> JSIO Bits32\n length a = primJS $ HTMLAllCollection.prim__length a\n \n export\n item : (obj : HTMLAllCollection)\n -> (nameOrIndex : Optional String)\n -> JSIO (Maybe (NS I [ HTMLCollection , Element ]))\n item a b = tryJS \"HTMLAllCollection.item\"\n $ HTMLAllCollection.prim__item a (toFFI b)\n\n export\n item' : (obj : HTMLAllCollection)\n -> JSIO (Maybe (NS I [ HTMLCollection , Element ]))\n item' a = tryJS \"HTMLAllCollection.item'\"\n $ HTMLAllCollection.prim__item a undef\n \n export\n namedItem : (obj : HTMLAllCollection)\n -> (name : String)\n -> JSIO (Maybe (NS I [ HTMLCollection , Element ]))\n namedItem a b = tryJS \"HTMLAllCollection.namedItem\"\n $ HTMLAllCollection.prim__namedItem a b\n\n\nnamespace HTMLAnchorElement\n \n export\n new : JSIO HTMLAnchorElement\n new = primJS $ HTMLAnchorElement.prim__new \n \n export\n charset : HTMLAnchorElement -> Attribute True I String\n charset v = fromPrim \"HTMLAnchorElement.getcharset\"\n prim__charset\n prim__setCharset\n v\n \n export\n coords : HTMLAnchorElement -> Attribute True I String\n coords v = fromPrim \"HTMLAnchorElement.getcoords\"\n prim__coords\n prim__setCoords\n v\n \n export\n download : HTMLAnchorElement -> Attribute True I String\n download v = fromPrim \"HTMLAnchorElement.getdownload\"\n prim__download\n prim__setDownload\n v\n \n export\n hreflang : HTMLAnchorElement -> Attribute True I String\n hreflang v = fromPrim \"HTMLAnchorElement.gethreflang\"\n prim__hreflang\n prim__setHreflang\n v\n \n export\n name : HTMLAnchorElement -> Attribute True I String\n name v = fromPrim \"HTMLAnchorElement.getname\" prim__name prim__setName v\n \n export\n ping : HTMLAnchorElement -> Attribute True I String\n ping v = fromPrim \"HTMLAnchorElement.getping\" prim__ping prim__setPing v\n \n export\n referrerPolicy : HTMLAnchorElement -> Attribute True I String\n referrerPolicy v = fromPrim \"HTMLAnchorElement.getreferrerPolicy\"\n prim__referrerPolicy\n prim__setReferrerPolicy\n v\n \n export\n rel : HTMLAnchorElement -> Attribute True I String\n rel v = fromPrim \"HTMLAnchorElement.getrel\" prim__rel prim__setRel v\n \n export\n relList : (obj : HTMLAnchorElement) -> JSIO DOMTokenList\n relList a = primJS $ HTMLAnchorElement.prim__relList a\n \n export\n rev : HTMLAnchorElement -> Attribute True I String\n rev v = fromPrim \"HTMLAnchorElement.getrev\" prim__rev prim__setRev v\n \n export\n shape : HTMLAnchorElement -> Attribute True I String\n shape v = fromPrim \"HTMLAnchorElement.getshape\" prim__shape prim__setShape v\n \n export\n target : HTMLAnchorElement -> Attribute True I String\n target v = fromPrim \"HTMLAnchorElement.gettarget\"\n prim__target\n prim__setTarget\n v\n \n export\n text : HTMLAnchorElement -> Attribute True I String\n text v = fromPrim \"HTMLAnchorElement.gettext\" prim__text prim__setText v\n \n export\n type : HTMLAnchorElement -> Attribute True I String\n type v = fromPrim \"HTMLAnchorElement.gettype\" prim__type prim__setType v\n\n\nnamespace HTMLAreaElement\n \n export\n new : JSIO HTMLAreaElement\n new = primJS $ HTMLAreaElement.prim__new \n \n export\n alt : HTMLAreaElement -> Attribute True I String\n alt v = fromPrim \"HTMLAreaElement.getalt\" prim__alt prim__setAlt v\n \n export\n coords : HTMLAreaElement -> Attribute True I String\n coords v = fromPrim \"HTMLAreaElement.getcoords\" prim__coords prim__setCoords v\n \n export\n download : HTMLAreaElement -> Attribute True I String\n download v = fromPrim \"HTMLAreaElement.getdownload\"\n prim__download\n prim__setDownload\n v\n \n export\n noHref : HTMLAreaElement -> Attribute True I Bool\n noHref v = fromPrim \"HTMLAreaElement.getnoHref\" prim__noHref prim__setNoHref v\n \n export\n ping : HTMLAreaElement -> Attribute True I String\n ping v = fromPrim \"HTMLAreaElement.getping\" prim__ping prim__setPing v\n \n export\n referrerPolicy : HTMLAreaElement -> Attribute True I String\n referrerPolicy v = fromPrim \"HTMLAreaElement.getreferrerPolicy\"\n prim__referrerPolicy\n prim__setReferrerPolicy\n v\n \n export\n rel : HTMLAreaElement -> Attribute True I String\n rel v = fromPrim \"HTMLAreaElement.getrel\" prim__rel prim__setRel v\n \n export\n relList : (obj : HTMLAreaElement) -> JSIO DOMTokenList\n relList a = primJS $ HTMLAreaElement.prim__relList a\n \n export\n shape : HTMLAreaElement -> Attribute True I String\n shape v = fromPrim \"HTMLAreaElement.getshape\" prim__shape prim__setShape v\n \n export\n target : HTMLAreaElement -> Attribute True I String\n target v = fromPrim \"HTMLAreaElement.gettarget\" prim__target prim__setTarget v\n\n\nnamespace HTMLAudioElement\n \n export\n new : JSIO HTMLAudioElement\n new = primJS $ HTMLAudioElement.prim__new \n\n\nnamespace HTMLBRElement\n \n export\n new : JSIO HTMLBRElement\n new = primJS $ HTMLBRElement.prim__new \n \n export\n clear : HTMLBRElement -> Attribute True I String\n clear v = fromPrim \"HTMLBRElement.getclear\" prim__clear prim__setClear v\n\n\nnamespace HTMLBaseElement\n \n export\n new : JSIO HTMLBaseElement\n new = primJS $ HTMLBaseElement.prim__new \n \n export\n href : HTMLBaseElement -> Attribute True I String\n href v = fromPrim \"HTMLBaseElement.gethref\" prim__href prim__setHref v\n \n export\n target : HTMLBaseElement -> Attribute True I String\n target v = fromPrim \"HTMLBaseElement.gettarget\" prim__target prim__setTarget v\n\n\nnamespace HTMLBodyElement\n \n export\n new : JSIO HTMLBodyElement\n new = primJS $ HTMLBodyElement.prim__new \n \n export\n aLink : HTMLBodyElement -> Attribute True I String\n aLink v = fromPrim \"HTMLBodyElement.getaLink\" prim__aLink prim__setALink v\n \n export\n background : HTMLBodyElement -> Attribute True I String\n background v = fromPrim \"HTMLBodyElement.getbackground\"\n prim__background\n prim__setBackground\n v\n \n export\n bgColor : HTMLBodyElement -> Attribute True I String\n bgColor v = fromPrim \"HTMLBodyElement.getbgColor\"\n prim__bgColor\n prim__setBgColor\n v\n \n export\n link : HTMLBodyElement -> Attribute True I String\n link v = fromPrim \"HTMLBodyElement.getlink\" prim__link prim__setLink v\n \n export\n text : HTMLBodyElement -> Attribute True I String\n text v = fromPrim \"HTMLBodyElement.gettext\" prim__text prim__setText v\n \n export\n vLink : HTMLBodyElement -> Attribute True I String\n vLink v = fromPrim \"HTMLBodyElement.getvLink\" prim__vLink prim__setVLink v\n\n\nnamespace HTMLButtonElement\n \n export\n new : JSIO HTMLButtonElement\n new = primJS $ HTMLButtonElement.prim__new \n \n export\n disabled : HTMLButtonElement -> Attribute True I Bool\n disabled v = fromPrim \"HTMLButtonElement.getdisabled\"\n prim__disabled\n prim__setDisabled\n v\n \n export\n form : (obj : HTMLButtonElement) -> JSIO (Maybe HTMLFormElement)\n form a = tryJS \"HTMLButtonElement.form\" $ HTMLButtonElement.prim__form a\n \n export\n formAction : HTMLButtonElement -> Attribute True I String\n formAction v = fromPrim \"HTMLButtonElement.getformAction\"\n prim__formAction\n prim__setFormAction\n v\n \n export\n formEnctype : HTMLButtonElement -> Attribute True I String\n formEnctype v = fromPrim \"HTMLButtonElement.getformEnctype\"\n prim__formEnctype\n prim__setFormEnctype\n v\n \n export\n formMethod : HTMLButtonElement -> Attribute True I String\n formMethod v = fromPrim \"HTMLButtonElement.getformMethod\"\n prim__formMethod\n prim__setFormMethod\n v\n \n export\n formNoValidate : HTMLButtonElement -> Attribute True I Bool\n formNoValidate v = fromPrim \"HTMLButtonElement.getformNoValidate\"\n prim__formNoValidate\n prim__setFormNoValidate\n v\n \n export\n formTarget : HTMLButtonElement -> Attribute True I String\n formTarget v = fromPrim \"HTMLButtonElement.getformTarget\"\n prim__formTarget\n prim__setFormTarget\n v\n \n export\n labels : (obj : HTMLButtonElement) -> JSIO NodeList\n labels a = primJS $ HTMLButtonElement.prim__labels a\n \n export\n name : HTMLButtonElement -> Attribute True I String\n name v = fromPrim \"HTMLButtonElement.getname\" prim__name prim__setName v\n \n export\n type : HTMLButtonElement -> Attribute True I String\n type v = fromPrim \"HTMLButtonElement.gettype\" prim__type prim__setType v\n \n export\n validationMessage : (obj : HTMLButtonElement) -> JSIO String\n validationMessage a = primJS $ HTMLButtonElement.prim__validationMessage a\n \n export\n validity : (obj : HTMLButtonElement) -> JSIO ValidityState\n validity a = primJS $ HTMLButtonElement.prim__validity a\n \n export\n value : HTMLButtonElement -> Attribute True I String\n value v = fromPrim \"HTMLButtonElement.getvalue\" prim__value prim__setValue v\n \n export\n willValidate : (obj : HTMLButtonElement) -> JSIO Bool\n willValidate a = tryJS \"HTMLButtonElement.willValidate\"\n $ HTMLButtonElement.prim__willValidate a\n \n export\n checkValidity : (obj : HTMLButtonElement) -> JSIO Bool\n checkValidity a = tryJS \"HTMLButtonElement.checkValidity\"\n $ HTMLButtonElement.prim__checkValidity a\n \n export\n reportValidity : (obj : HTMLButtonElement) -> JSIO Bool\n reportValidity a = tryJS \"HTMLButtonElement.reportValidity\"\n $ HTMLButtonElement.prim__reportValidity a\n \n export\n setCustomValidity : (obj : HTMLButtonElement) -> (error : String) -> JSIO ()\n setCustomValidity a b = primJS $ HTMLButtonElement.prim__setCustomValidity a b\n\n\nnamespace HTMLCanvasElement\n \n export\n new : JSIO HTMLCanvasElement\n new = primJS $ HTMLCanvasElement.prim__new \n \n export\n height : HTMLCanvasElement -> Attribute True I Bits32\n height v = fromPrim \"HTMLCanvasElement.getheight\"\n prim__height\n prim__setHeight\n v\n \n export\n width : HTMLCanvasElement -> Attribute True I Bits32\n width v = fromPrim \"HTMLCanvasElement.getwidth\" prim__width prim__setWidth v\n \n export\n getContext : (obj : HTMLCanvasElement)\n -> (contextId : String)\n -> (options : Optional Any)\n -> JSIO (Maybe (NS I [ CanvasRenderingContext2D\n , ImageBitmapRenderingContext\n , WebGLRenderingContext\n , WebGL2RenderingContext\n ]))\n getContext a b c = tryJS \"HTMLCanvasElement.getContext\"\n $ HTMLCanvasElement.prim__getContext a b (toFFI c)\n\n export\n getContext' : (obj : HTMLCanvasElement)\n -> (contextId : String)\n -> JSIO (Maybe (NS I [ CanvasRenderingContext2D\n , ImageBitmapRenderingContext\n , WebGLRenderingContext\n , WebGL2RenderingContext\n ]))\n getContext' a b = tryJS \"HTMLCanvasElement.getContext'\"\n $ HTMLCanvasElement.prim__getContext a b undef\n \n export\n toBlob : (obj : HTMLCanvasElement)\n -> (callback : BlobCallback)\n -> (type : Optional String)\n -> (quality : Optional Any)\n -> JSIO ()\n toBlob a b c d = primJS\n $ HTMLCanvasElement.prim__toBlob a b (toFFI c) (toFFI d)\n\n export\n toBlob' : (obj : HTMLCanvasElement) -> (callback : BlobCallback) -> JSIO ()\n toBlob' a b = primJS $ HTMLCanvasElement.prim__toBlob a b undef undef\n \n export\n toDataURL : (obj : HTMLCanvasElement)\n -> (type : Optional String)\n -> (quality : Optional Any)\n -> JSIO String\n toDataURL a b c = primJS\n $ HTMLCanvasElement.prim__toDataURL a (toFFI b) (toFFI c)\n\n export\n toDataURL' : (obj : HTMLCanvasElement) -> JSIO String\n toDataURL' a = primJS $ HTMLCanvasElement.prim__toDataURL a undef undef\n \n export\n transferControlToOffscreen : (obj : HTMLCanvasElement) -> JSIO OffscreenCanvas\n transferControlToOffscreen a = primJS\n $ HTMLCanvasElement.prim__transferControlToOffscreen a\n\n\nnamespace HTMLDListElement\n \n export\n new : JSIO HTMLDListElement\n new = primJS $ HTMLDListElement.prim__new \n \n export\n compact : HTMLDListElement -> Attribute True I Bool\n compact v = fromPrim \"HTMLDListElement.getcompact\"\n prim__compact\n prim__setCompact\n v\n\n\nnamespace HTMLDataElement\n \n export\n new : JSIO HTMLDataElement\n new = primJS $ HTMLDataElement.prim__new \n \n export\n value : HTMLDataElement -> Attribute True I String\n value v = fromPrim \"HTMLDataElement.getvalue\" prim__value prim__setValue v\n\n\nnamespace HTMLDataListElement\n \n export\n new : JSIO HTMLDataListElement\n new = primJS $ HTMLDataListElement.prim__new \n \n export\n options : (obj : HTMLDataListElement) -> JSIO HTMLCollection\n options a = primJS $ HTMLDataListElement.prim__options a\n\n\nnamespace HTMLDetailsElement\n \n export\n new : JSIO HTMLDetailsElement\n new = primJS $ HTMLDetailsElement.prim__new \n \n export\n open_ : HTMLDetailsElement -> Attribute True I Bool\n open_ v = fromPrim \"HTMLDetailsElement.getopen\" prim__open prim__setOpen v\n\n\nnamespace HTMLDialogElement\n \n export\n new : JSIO HTMLDialogElement\n new = primJS $ HTMLDialogElement.prim__new \n \n export\n open_ : HTMLDialogElement -> Attribute True I Bool\n open_ v = fromPrim \"HTMLDialogElement.getopen\" prim__open prim__setOpen v\n \n export\n returnValue : HTMLDialogElement -> Attribute True I String\n returnValue v = fromPrim \"HTMLDialogElement.getreturnValue\"\n prim__returnValue\n prim__setReturnValue\n v\n \n export\n close : (obj : HTMLDialogElement)\n -> (returnValue : Optional String)\n -> JSIO ()\n close a b = primJS $ HTMLDialogElement.prim__close a (toFFI b)\n\n export\n close' : (obj : HTMLDialogElement) -> JSIO ()\n close' a = primJS $ HTMLDialogElement.prim__close a undef\n \n export\n show : (obj : HTMLDialogElement) -> JSIO ()\n show a = primJS $ HTMLDialogElement.prim__show a\n \n export\n showModal : (obj : HTMLDialogElement) -> JSIO ()\n showModal a = primJS $ HTMLDialogElement.prim__showModal a\n\n\nnamespace HTMLDirectoryElement\n \n export\n new : JSIO HTMLDirectoryElement\n new = primJS $ HTMLDirectoryElement.prim__new \n \n export\n compact : HTMLDirectoryElement -> Attribute True I Bool\n compact v = fromPrim \"HTMLDirectoryElement.getcompact\"\n prim__compact\n prim__setCompact\n v\n\n\nnamespace HTMLDivElement\n \n export\n new : JSIO HTMLDivElement\n new = primJS $ HTMLDivElement.prim__new \n \n export\n align : HTMLDivElement -> Attribute True I String\n align v = fromPrim \"HTMLDivElement.getalign\" prim__align prim__setAlign v\n\n\nnamespace HTMLElement\n \n export\n new : JSIO HTMLElement\n new = primJS $ HTMLElement.prim__new \n \n export\n accessKey : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLElement (Types t)}\n -> t\n -> Attribute True I String\n accessKey v = fromPrim \"HTMLElement.getaccessKey\"\n prim__accessKey\n prim__setAccessKey\n (v :> HTMLElement)\n \n export\n accessKeyLabel : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLElement (Types t1)}\n -> (obj : t1)\n -> JSIO String\n accessKeyLabel a = primJS $ HTMLElement.prim__accessKeyLabel (up a)\n \n export\n autocapitalize : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLElement (Types t)}\n -> t\n -> Attribute True I String\n autocapitalize v = fromPrim \"HTMLElement.getautocapitalize\"\n prim__autocapitalize\n prim__setAutocapitalize\n (v :> HTMLElement)\n \n export\n dir : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLElement (Types t)}\n -> t\n -> Attribute True I String\n dir v = fromPrim \"HTMLElement.getdir\"\n prim__dir\n prim__setDir\n (v :> HTMLElement)\n \n export\n draggable : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLElement (Types t)}\n -> t\n -> Attribute True I Bool\n draggable v = fromPrim \"HTMLElement.getdraggable\"\n prim__draggable\n prim__setDraggable\n (v :> HTMLElement)\n \n export\n hidden : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLElement (Types t)}\n -> t\n -> Attribute True I Bool\n hidden v = fromPrim \"HTMLElement.gethidden\"\n prim__hidden\n prim__setHidden\n (v :> HTMLElement)\n \n export\n innerText : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLElement (Types t)}\n -> t\n -> Attribute True I String\n innerText v = fromPrim \"HTMLElement.getinnerText\"\n prim__innerText\n prim__setInnerText\n (v :> HTMLElement)\n \n export\n lang : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLElement (Types t)}\n -> t\n -> Attribute True I String\n lang v = fromPrim \"HTMLElement.getlang\"\n prim__lang\n prim__setLang\n (v :> HTMLElement)\n \n export\n spellcheck : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLElement (Types t)}\n -> t\n -> Attribute True I Bool\n spellcheck v = fromPrim \"HTMLElement.getspellcheck\"\n prim__spellcheck\n prim__setSpellcheck\n (v :> HTMLElement)\n \n export\n title : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLElement (Types t)}\n -> t\n -> Attribute True I String\n title v = fromPrim \"HTMLElement.gettitle\"\n prim__title\n prim__setTitle\n (v :> HTMLElement)\n \n export\n translate : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLElement (Types t)}\n -> t\n -> Attribute True I Bool\n translate v = fromPrim \"HTMLElement.gettranslate\"\n prim__translate\n prim__setTranslate\n (v :> HTMLElement)\n \n export\n attachInternals : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLElement (Types t1)}\n -> (obj : t1)\n -> JSIO ElementInternals\n attachInternals a = primJS $ HTMLElement.prim__attachInternals (up a)\n \n export\n click : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLElement (Types t1)}\n -> (obj : t1)\n -> JSIO ()\n click a = primJS $ HTMLElement.prim__click (up a)\n\n\nnamespace HTMLEmbedElement\n \n export\n new : JSIO HTMLEmbedElement\n new = primJS $ HTMLEmbedElement.prim__new \n \n export\n align : HTMLEmbedElement -> Attribute True I String\n align v = fromPrim \"HTMLEmbedElement.getalign\" prim__align prim__setAlign v\n \n export\n height : HTMLEmbedElement -> Attribute True I String\n height v = fromPrim \"HTMLEmbedElement.getheight\"\n prim__height\n prim__setHeight\n v\n \n export\n name : HTMLEmbedElement -> Attribute True I String\n name v = fromPrim \"HTMLEmbedElement.getname\" prim__name prim__setName v\n \n export\n src : HTMLEmbedElement -> Attribute True I String\n src v = fromPrim \"HTMLEmbedElement.getsrc\" prim__src prim__setSrc v\n \n export\n type : HTMLEmbedElement -> Attribute True I String\n type v = fromPrim \"HTMLEmbedElement.gettype\" prim__type prim__setType v\n \n export\n width : HTMLEmbedElement -> Attribute True I String\n width v = fromPrim \"HTMLEmbedElement.getwidth\" prim__width prim__setWidth v\n \n export\n getSVGDocument : (obj : HTMLEmbedElement) -> JSIO (Maybe Document)\n getSVGDocument a = tryJS \"HTMLEmbedElement.getSVGDocument\"\n $ HTMLEmbedElement.prim__getSVGDocument a\n\n\nnamespace HTMLFieldSetElement\n \n export\n new : JSIO HTMLFieldSetElement\n new = primJS $ HTMLFieldSetElement.prim__new \n \n export\n disabled : HTMLFieldSetElement -> Attribute True I Bool\n disabled v = fromPrim \"HTMLFieldSetElement.getdisabled\"\n prim__disabled\n prim__setDisabled\n v\n \n export\n elements : (obj : HTMLFieldSetElement) -> JSIO HTMLCollection\n elements a = primJS $ HTMLFieldSetElement.prim__elements a\n \n export\n form : (obj : HTMLFieldSetElement) -> JSIO (Maybe HTMLFormElement)\n form a = tryJS \"HTMLFieldSetElement.form\" $ HTMLFieldSetElement.prim__form a\n \n export\n name : HTMLFieldSetElement -> Attribute True I String\n name v = fromPrim \"HTMLFieldSetElement.getname\" prim__name prim__setName v\n \n export\n type : (obj : HTMLFieldSetElement) -> JSIO String\n type a = primJS $ HTMLFieldSetElement.prim__type a\n \n export\n validationMessage : (obj : HTMLFieldSetElement) -> JSIO String\n validationMessage a = primJS $ HTMLFieldSetElement.prim__validationMessage a\n \n export\n validity : (obj : HTMLFieldSetElement) -> JSIO ValidityState\n validity a = primJS $ HTMLFieldSetElement.prim__validity a\n \n export\n willValidate : (obj : HTMLFieldSetElement) -> JSIO Bool\n willValidate a = tryJS \"HTMLFieldSetElement.willValidate\"\n $ HTMLFieldSetElement.prim__willValidate a\n \n export\n checkValidity : (obj : HTMLFieldSetElement) -> JSIO Bool\n checkValidity a = tryJS \"HTMLFieldSetElement.checkValidity\"\n $ HTMLFieldSetElement.prim__checkValidity a\n \n export\n reportValidity : (obj : HTMLFieldSetElement) -> JSIO Bool\n reportValidity a = tryJS \"HTMLFieldSetElement.reportValidity\"\n $ HTMLFieldSetElement.prim__reportValidity a\n \n export\n setCustomValidity : (obj : HTMLFieldSetElement) -> (error : String) -> JSIO ()\n setCustomValidity a b = primJS\n $ HTMLFieldSetElement.prim__setCustomValidity a b\n\n\nnamespace HTMLFontElement\n \n export\n new : JSIO HTMLFontElement\n new = primJS $ HTMLFontElement.prim__new \n \n export\n color : HTMLFontElement -> Attribute True I String\n color v = fromPrim \"HTMLFontElement.getcolor\" prim__color prim__setColor v\n \n export\n face : HTMLFontElement -> Attribute True I String\n face v = fromPrim \"HTMLFontElement.getface\" prim__face prim__setFace v\n \n export\n size : HTMLFontElement -> Attribute True I String\n size v = fromPrim \"HTMLFontElement.getsize\" prim__size prim__setSize v\n\n\nnamespace HTMLFormControlsCollection\n \n export\n namedItem : (obj : HTMLFormControlsCollection)\n -> (name : String)\n -> JSIO (Maybe (NS I [ RadioNodeList , Element ]))\n namedItem a b = tryJS \"HTMLFormControlsCollection.namedItem\"\n $ HTMLFormControlsCollection.prim__namedItem a b\n\n\nnamespace HTMLFormElement\n \n export\n new : JSIO HTMLFormElement\n new = primJS $ HTMLFormElement.prim__new \n \n export\n get : (obj : HTMLFormElement) -> (index : Bits32) -> JSIO Element\n get a b = primJS $ HTMLFormElement.prim__get a b\n \n export\n get1 : (obj : HTMLFormElement)\n -> (name : String)\n -> JSIO (NS I [ RadioNodeList , Element ])\n get1 a b = tryJS \"HTMLFormElement.get1\" $ HTMLFormElement.prim__get1 a b\n \n export\n acceptCharset : HTMLFormElement -> Attribute True I String\n acceptCharset v = fromPrim \"HTMLFormElement.getacceptCharset\"\n prim__acceptCharset\n prim__setAcceptCharset\n v\n \n export\n action : HTMLFormElement -> Attribute True I String\n action v = fromPrim \"HTMLFormElement.getaction\" prim__action prim__setAction v\n \n export\n autocomplete : HTMLFormElement -> Attribute True I String\n autocomplete v = fromPrim \"HTMLFormElement.getautocomplete\"\n prim__autocomplete\n prim__setAutocomplete\n v\n \n export\n elements : (obj : HTMLFormElement) -> JSIO HTMLFormControlsCollection\n elements a = primJS $ HTMLFormElement.prim__elements a\n \n export\n encoding : HTMLFormElement -> Attribute True I String\n encoding v = fromPrim \"HTMLFormElement.getencoding\"\n prim__encoding\n prim__setEncoding\n v\n \n export\n enctype : HTMLFormElement -> Attribute True I String\n enctype v = fromPrim \"HTMLFormElement.getenctype\"\n prim__enctype\n prim__setEnctype\n v\n \n export\n length : (obj : HTMLFormElement) -> JSIO Bits32\n length a = primJS $ HTMLFormElement.prim__length a\n \n export\n method : HTMLFormElement -> Attribute True I String\n method v = fromPrim \"HTMLFormElement.getmethod\" prim__method prim__setMethod v\n \n export\n name : HTMLFormElement -> Attribute True I String\n name v = fromPrim \"HTMLFormElement.getname\" prim__name prim__setName v\n \n export\n noValidate : HTMLFormElement -> Attribute True I Bool\n noValidate v = fromPrim \"HTMLFormElement.getnoValidate\"\n prim__noValidate\n prim__setNoValidate\n v\n \n export\n rel : HTMLFormElement -> Attribute True I String\n rel v = fromPrim \"HTMLFormElement.getrel\" prim__rel prim__setRel v\n \n export\n relList : (obj : HTMLFormElement) -> JSIO DOMTokenList\n relList a = primJS $ HTMLFormElement.prim__relList a\n \n export\n target : HTMLFormElement -> Attribute True I String\n target v = fromPrim \"HTMLFormElement.gettarget\" prim__target prim__setTarget v\n \n export\n checkValidity : (obj : HTMLFormElement) -> JSIO Bool\n checkValidity a = tryJS \"HTMLFormElement.checkValidity\"\n $ HTMLFormElement.prim__checkValidity a\n \n export\n reportValidity : (obj : HTMLFormElement) -> JSIO Bool\n reportValidity a = tryJS \"HTMLFormElement.reportValidity\"\n $ HTMLFormElement.prim__reportValidity a\n \n export\n requestSubmit : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLElement (Types t1)}\n -> (obj : HTMLFormElement)\n -> (submitter : Optional (Maybe t1))\n -> JSIO ()\n requestSubmit a b = primJS $ HTMLFormElement.prim__requestSubmit a (omyUp b)\n\n export\n requestSubmit' : (obj : HTMLFormElement) -> JSIO ()\n requestSubmit' a = primJS $ HTMLFormElement.prim__requestSubmit a undef\n \n export\n reset : (obj : HTMLFormElement) -> JSIO ()\n reset a = primJS $ HTMLFormElement.prim__reset a\n \n export\n submit : (obj : HTMLFormElement) -> JSIO ()\n submit a = primJS $ HTMLFormElement.prim__submit a\n\n\nnamespace HTMLFrameElement\n \n export\n new : JSIO HTMLFrameElement\n new = primJS $ HTMLFrameElement.prim__new \n \n export\n contentDocument : (obj : HTMLFrameElement) -> JSIO (Maybe Document)\n contentDocument a = tryJS \"HTMLFrameElement.contentDocument\"\n $ HTMLFrameElement.prim__contentDocument a\n \n export\n contentWindow : (obj : HTMLFrameElement) -> JSIO (Maybe WindowProxy)\n contentWindow a = tryJS \"HTMLFrameElement.contentWindow\"\n $ HTMLFrameElement.prim__contentWindow a\n \n export\n frameBorder : HTMLFrameElement -> Attribute True I String\n frameBorder v = fromPrim \"HTMLFrameElement.getframeBorder\"\n prim__frameBorder\n prim__setFrameBorder\n v\n \n export\n longDesc : HTMLFrameElement -> Attribute True I String\n longDesc v = fromPrim \"HTMLFrameElement.getlongDesc\"\n prim__longDesc\n prim__setLongDesc\n v\n \n export\n marginHeight : HTMLFrameElement -> Attribute True I String\n marginHeight v = fromPrim \"HTMLFrameElement.getmarginHeight\"\n prim__marginHeight\n prim__setMarginHeight\n v\n \n export\n marginWidth : HTMLFrameElement -> Attribute True I String\n marginWidth v = fromPrim \"HTMLFrameElement.getmarginWidth\"\n prim__marginWidth\n prim__setMarginWidth\n v\n \n export\n name : HTMLFrameElement -> Attribute True I String\n name v = fromPrim \"HTMLFrameElement.getname\" prim__name prim__setName v\n \n export\n noResize : HTMLFrameElement -> Attribute True I Bool\n noResize v = fromPrim \"HTMLFrameElement.getnoResize\"\n prim__noResize\n prim__setNoResize\n v\n \n export\n scrolling : HTMLFrameElement -> Attribute True I String\n scrolling v = fromPrim \"HTMLFrameElement.getscrolling\"\n prim__scrolling\n prim__setScrolling\n v\n \n export\n src : HTMLFrameElement -> Attribute True I String\n src v = fromPrim \"HTMLFrameElement.getsrc\" prim__src prim__setSrc v\n\n\nnamespace HTMLFrameSetElement\n \n export\n new : JSIO HTMLFrameSetElement\n new = primJS $ HTMLFrameSetElement.prim__new \n \n export\n cols : HTMLFrameSetElement -> Attribute True I String\n cols v = fromPrim \"HTMLFrameSetElement.getcols\" prim__cols prim__setCols v\n \n export\n rows : HTMLFrameSetElement -> Attribute True I String\n rows v = fromPrim \"HTMLFrameSetElement.getrows\" prim__rows prim__setRows v\n\n\nnamespace HTMLHRElement\n \n export\n new : JSIO HTMLHRElement\n new = primJS $ HTMLHRElement.prim__new \n \n export\n align : HTMLHRElement -> Attribute True I String\n align v = fromPrim \"HTMLHRElement.getalign\" prim__align prim__setAlign v\n \n export\n color : HTMLHRElement -> Attribute True I String\n color v = fromPrim \"HTMLHRElement.getcolor\" prim__color prim__setColor v\n \n export\n noShade : HTMLHRElement -> Attribute True I Bool\n noShade v = fromPrim \"HTMLHRElement.getnoShade\"\n prim__noShade\n prim__setNoShade\n v\n \n export\n size : HTMLHRElement -> Attribute True I String\n size v = fromPrim \"HTMLHRElement.getsize\" prim__size prim__setSize v\n \n export\n width : HTMLHRElement -> Attribute True I String\n width v = fromPrim \"HTMLHRElement.getwidth\" prim__width prim__setWidth v\n\n\nnamespace HTMLHeadElement\n \n export\n new : JSIO HTMLHeadElement\n new = primJS $ HTMLHeadElement.prim__new \n\n\nnamespace HTMLHeadingElement\n \n export\n new : JSIO HTMLHeadingElement\n new = primJS $ HTMLHeadingElement.prim__new \n \n export\n align : HTMLHeadingElement -> Attribute True I String\n align v = fromPrim \"HTMLHeadingElement.getalign\" prim__align prim__setAlign v\n\n\nnamespace HTMLHtmlElement\n \n export\n new : JSIO HTMLHtmlElement\n new = primJS $ HTMLHtmlElement.prim__new \n \n export\n version : HTMLHtmlElement -> Attribute True I String\n version v = fromPrim \"HTMLHtmlElement.getversion\"\n prim__version\n prim__setVersion\n v\n\n\nnamespace HTMLIFrameElement\n \n export\n new : JSIO HTMLIFrameElement\n new = primJS $ HTMLIFrameElement.prim__new \n \n export\n align : HTMLIFrameElement -> Attribute True I String\n align v = fromPrim \"HTMLIFrameElement.getalign\" prim__align prim__setAlign v\n \n export\n allow : HTMLIFrameElement -> Attribute True I String\n allow v = fromPrim \"HTMLIFrameElement.getallow\" prim__allow prim__setAllow v\n \n export\n allowFullscreen : HTMLIFrameElement -> Attribute True I Bool\n allowFullscreen v = fromPrim \"HTMLIFrameElement.getallowFullscreen\"\n prim__allowFullscreen\n prim__setAllowFullscreen\n v\n \n export\n contentDocument : (obj : HTMLIFrameElement) -> JSIO (Maybe Document)\n contentDocument a = tryJS \"HTMLIFrameElement.contentDocument\"\n $ HTMLIFrameElement.prim__contentDocument a\n \n export\n contentWindow : (obj : HTMLIFrameElement) -> JSIO (Maybe WindowProxy)\n contentWindow a = tryJS \"HTMLIFrameElement.contentWindow\"\n $ HTMLIFrameElement.prim__contentWindow a\n \n export\n frameBorder : HTMLIFrameElement -> Attribute True I String\n frameBorder v = fromPrim \"HTMLIFrameElement.getframeBorder\"\n prim__frameBorder\n prim__setFrameBorder\n v\n \n export\n height : HTMLIFrameElement -> Attribute True I String\n height v = fromPrim \"HTMLIFrameElement.getheight\"\n prim__height\n prim__setHeight\n v\n \n export\n loading : HTMLIFrameElement -> Attribute True I String\n loading v = fromPrim \"HTMLIFrameElement.getloading\"\n prim__loading\n prim__setLoading\n v\n \n export\n longDesc : HTMLIFrameElement -> Attribute True I String\n longDesc v = fromPrim \"HTMLIFrameElement.getlongDesc\"\n prim__longDesc\n prim__setLongDesc\n v\n \n export\n marginHeight : HTMLIFrameElement -> Attribute True I String\n marginHeight v = fromPrim \"HTMLIFrameElement.getmarginHeight\"\n prim__marginHeight\n prim__setMarginHeight\n v\n \n export\n marginWidth : HTMLIFrameElement -> Attribute True I String\n marginWidth v = fromPrim \"HTMLIFrameElement.getmarginWidth\"\n prim__marginWidth\n prim__setMarginWidth\n v\n \n export\n name : HTMLIFrameElement -> Attribute True I String\n name v = fromPrim \"HTMLIFrameElement.getname\" prim__name prim__setName v\n \n export\n referrerPolicy : HTMLIFrameElement -> Attribute True I String\n referrerPolicy v = fromPrim \"HTMLIFrameElement.getreferrerPolicy\"\n prim__referrerPolicy\n prim__setReferrerPolicy\n v\n \n export\n sandbox : (obj : HTMLIFrameElement) -> JSIO DOMTokenList\n sandbox a = primJS $ HTMLIFrameElement.prim__sandbox a\n \n export\n scrolling : HTMLIFrameElement -> Attribute True I String\n scrolling v = fromPrim \"HTMLIFrameElement.getscrolling\"\n prim__scrolling\n prim__setScrolling\n v\n \n export\n src : HTMLIFrameElement -> Attribute True I String\n src v = fromPrim \"HTMLIFrameElement.getsrc\" prim__src prim__setSrc v\n \n export\n srcdoc : HTMLIFrameElement -> Attribute True I String\n srcdoc v = fromPrim \"HTMLIFrameElement.getsrcdoc\"\n prim__srcdoc\n prim__setSrcdoc\n v\n \n export\n width : HTMLIFrameElement -> Attribute True I String\n width v = fromPrim \"HTMLIFrameElement.getwidth\" prim__width prim__setWidth v\n \n export\n getSVGDocument : (obj : HTMLIFrameElement) -> JSIO (Maybe Document)\n getSVGDocument a = tryJS \"HTMLIFrameElement.getSVGDocument\"\n $ HTMLIFrameElement.prim__getSVGDocument a\n\n\nnamespace HTMLImageElement\n \n export\n new : JSIO HTMLImageElement\n new = primJS $ HTMLImageElement.prim__new \n \n export\n align : HTMLImageElement -> Attribute True I String\n align v = fromPrim \"HTMLImageElement.getalign\" prim__align prim__setAlign v\n \n export\n alt : HTMLImageElement -> Attribute True I String\n alt v = fromPrim \"HTMLImageElement.getalt\" prim__alt prim__setAlt v\n \n export\n border : HTMLImageElement -> Attribute True I String\n border v = fromPrim \"HTMLImageElement.getborder\"\n prim__border\n prim__setBorder\n v\n \n export\n complete : (obj : HTMLImageElement) -> JSIO Bool\n complete a = tryJS \"HTMLImageElement.complete\"\n $ HTMLImageElement.prim__complete a\n \n export\n crossOrigin : HTMLImageElement -> Attribute False Maybe String\n crossOrigin v = fromNullablePrim \"HTMLImageElement.getcrossOrigin\"\n prim__crossOrigin\n prim__setCrossOrigin\n v\n \n export\n currentSrc : (obj : HTMLImageElement) -> JSIO String\n currentSrc a = primJS $ HTMLImageElement.prim__currentSrc a\n \n export\n decoding : HTMLImageElement -> Attribute True I String\n decoding v = fromPrim \"HTMLImageElement.getdecoding\"\n prim__decoding\n prim__setDecoding\n v\n \n export\n height : HTMLImageElement -> Attribute True I Bits32\n height v = fromPrim \"HTMLImageElement.getheight\"\n prim__height\n prim__setHeight\n v\n \n export\n hspace : HTMLImageElement -> Attribute True I Bits32\n hspace v = fromPrim \"HTMLImageElement.gethspace\"\n prim__hspace\n prim__setHspace\n v\n \n export\n isMap : HTMLImageElement -> Attribute True I Bool\n isMap v = fromPrim \"HTMLImageElement.getisMap\" prim__isMap prim__setIsMap v\n \n export\n loading : HTMLImageElement -> Attribute True I String\n loading v = fromPrim \"HTMLImageElement.getloading\"\n prim__loading\n prim__setLoading\n v\n \n export\n longDesc : HTMLImageElement -> Attribute True I String\n longDesc v = fromPrim \"HTMLImageElement.getlongDesc\"\n prim__longDesc\n prim__setLongDesc\n v\n \n export\n lowsrc : HTMLImageElement -> Attribute True I String\n lowsrc v = fromPrim \"HTMLImageElement.getlowsrc\"\n prim__lowsrc\n prim__setLowsrc\n v\n \n export\n name : HTMLImageElement -> Attribute True I String\n name v = fromPrim \"HTMLImageElement.getname\" prim__name prim__setName v\n \n export\n naturalHeight : (obj : HTMLImageElement) -> JSIO Bits32\n naturalHeight a = primJS $ HTMLImageElement.prim__naturalHeight a\n \n export\n naturalWidth : (obj : HTMLImageElement) -> JSIO Bits32\n naturalWidth a = primJS $ HTMLImageElement.prim__naturalWidth a\n \n export\n referrerPolicy : HTMLImageElement -> Attribute True I String\n referrerPolicy v = fromPrim \"HTMLImageElement.getreferrerPolicy\"\n prim__referrerPolicy\n prim__setReferrerPolicy\n v\n \n export\n sizes : HTMLImageElement -> Attribute True I String\n sizes v = fromPrim \"HTMLImageElement.getsizes\" prim__sizes prim__setSizes v\n \n export\n src : HTMLImageElement -> Attribute True I String\n src v = fromPrim \"HTMLImageElement.getsrc\" prim__src prim__setSrc v\n \n export\n srcset : HTMLImageElement -> Attribute True I String\n srcset v = fromPrim \"HTMLImageElement.getsrcset\"\n prim__srcset\n prim__setSrcset\n v\n \n export\n useMap : HTMLImageElement -> Attribute True I String\n useMap v = fromPrim \"HTMLImageElement.getuseMap\"\n prim__useMap\n prim__setUseMap\n v\n \n export\n vspace : HTMLImageElement -> Attribute True I Bits32\n vspace v = fromPrim \"HTMLImageElement.getvspace\"\n prim__vspace\n prim__setVspace\n v\n \n export\n width : HTMLImageElement -> Attribute True I Bits32\n width v = fromPrim \"HTMLImageElement.getwidth\" prim__width prim__setWidth v\n \n export\n decode : (obj : HTMLImageElement) -> JSIO (Promise Undefined)\n decode a = primJS $ HTMLImageElement.prim__decode a\n\n\nnamespace HTMLInputElement\n \n export\n new : JSIO HTMLInputElement\n new = primJS $ HTMLInputElement.prim__new \n \n export\n accept : HTMLInputElement -> Attribute True I String\n accept v = fromPrim \"HTMLInputElement.getaccept\"\n prim__accept\n prim__setAccept\n v\n \n export\n align : HTMLInputElement -> Attribute True I String\n align v = fromPrim \"HTMLInputElement.getalign\" prim__align prim__setAlign v\n \n export\n alt : HTMLInputElement -> Attribute True I String\n alt v = fromPrim \"HTMLInputElement.getalt\" prim__alt prim__setAlt v\n \n export\n autocomplete : HTMLInputElement -> Attribute True I String\n autocomplete v = fromPrim \"HTMLInputElement.getautocomplete\"\n prim__autocomplete\n prim__setAutocomplete\n v\n \n export\n checked : HTMLInputElement -> Attribute True I Bool\n checked v = fromPrim \"HTMLInputElement.getchecked\"\n prim__checked\n prim__setChecked\n v\n \n export\n defaultChecked : HTMLInputElement -> Attribute True I Bool\n defaultChecked v = fromPrim \"HTMLInputElement.getdefaultChecked\"\n prim__defaultChecked\n prim__setDefaultChecked\n v\n \n export\n defaultValue : HTMLInputElement -> Attribute True I String\n defaultValue v = fromPrim \"HTMLInputElement.getdefaultValue\"\n prim__defaultValue\n prim__setDefaultValue\n v\n \n export\n dirName : HTMLInputElement -> Attribute True I String\n dirName v = fromPrim \"HTMLInputElement.getdirName\"\n prim__dirName\n prim__setDirName\n v\n \n export\n disabled : HTMLInputElement -> Attribute True I Bool\n disabled v = fromPrim \"HTMLInputElement.getdisabled\"\n prim__disabled\n prim__setDisabled\n v\n \n export\n files : HTMLInputElement -> Attribute False Maybe FileList\n files v = fromNullablePrim \"HTMLInputElement.getfiles\"\n prim__files\n prim__setFiles\n v\n \n export\n form : (obj : HTMLInputElement) -> JSIO (Maybe HTMLFormElement)\n form a = tryJS \"HTMLInputElement.form\" $ HTMLInputElement.prim__form a\n \n export\n formAction : HTMLInputElement -> Attribute True I String\n formAction v = fromPrim \"HTMLInputElement.getformAction\"\n prim__formAction\n prim__setFormAction\n v\n \n export\n formEnctype : HTMLInputElement -> Attribute True I String\n formEnctype v = fromPrim \"HTMLInputElement.getformEnctype\"\n prim__formEnctype\n prim__setFormEnctype\n v\n \n export\n formMethod : HTMLInputElement -> Attribute True I String\n formMethod v = fromPrim \"HTMLInputElement.getformMethod\"\n prim__formMethod\n prim__setFormMethod\n v\n \n export\n formNoValidate : HTMLInputElement -> Attribute True I Bool\n formNoValidate v = fromPrim \"HTMLInputElement.getformNoValidate\"\n prim__formNoValidate\n prim__setFormNoValidate\n v\n \n export\n formTarget : HTMLInputElement -> Attribute True I String\n formTarget v = fromPrim \"HTMLInputElement.getformTarget\"\n prim__formTarget\n prim__setFormTarget\n v\n \n export\n height : HTMLInputElement -> Attribute True I Bits32\n height v = fromPrim \"HTMLInputElement.getheight\"\n prim__height\n prim__setHeight\n v\n \n export\n indeterminate : HTMLInputElement -> Attribute True I Bool\n indeterminate v = fromPrim \"HTMLInputElement.getindeterminate\"\n prim__indeterminate\n prim__setIndeterminate\n v\n \n export\n labels : (obj : HTMLInputElement) -> JSIO (Maybe NodeList)\n labels a = tryJS \"HTMLInputElement.labels\" $ HTMLInputElement.prim__labels a\n \n export\n list : (obj : HTMLInputElement) -> JSIO (Maybe HTMLElement)\n list a = tryJS \"HTMLInputElement.list\" $ HTMLInputElement.prim__list a\n \n export\n max : HTMLInputElement -> Attribute True I String\n max v = fromPrim \"HTMLInputElement.getmax\" prim__max prim__setMax v\n \n export\n maxLength : HTMLInputElement -> Attribute True I Int32\n maxLength v = fromPrim \"HTMLInputElement.getmaxLength\"\n prim__maxLength\n prim__setMaxLength\n v\n \n export\n min : HTMLInputElement -> Attribute True I String\n min v = fromPrim \"HTMLInputElement.getmin\" prim__min prim__setMin v\n \n export\n minLength : HTMLInputElement -> Attribute True I Int32\n minLength v = fromPrim \"HTMLInputElement.getminLength\"\n prim__minLength\n prim__setMinLength\n v\n \n export\n multiple : HTMLInputElement -> Attribute True I Bool\n multiple v = fromPrim \"HTMLInputElement.getmultiple\"\n prim__multiple\n prim__setMultiple\n v\n \n export\n name : HTMLInputElement -> Attribute True I String\n name v = fromPrim \"HTMLInputElement.getname\" prim__name prim__setName v\n \n export\n pattern : HTMLInputElement -> Attribute True I String\n pattern v = fromPrim \"HTMLInputElement.getpattern\"\n prim__pattern\n prim__setPattern\n v\n \n export\n placeholder : HTMLInputElement -> Attribute True I String\n placeholder v = fromPrim \"HTMLInputElement.getplaceholder\"\n prim__placeholder\n prim__setPlaceholder\n v\n \n export\n readOnly : HTMLInputElement -> Attribute True I Bool\n readOnly v = fromPrim \"HTMLInputElement.getreadOnly\"\n prim__readOnly\n prim__setReadOnly\n v\n \n export\n required : HTMLInputElement -> Attribute True I Bool\n required v = fromPrim \"HTMLInputElement.getrequired\"\n prim__required\n prim__setRequired\n v\n \n export\n selectionDirection : HTMLInputElement -> Attribute False Maybe String\n selectionDirection v = fromNullablePrim \"HTMLInputElement.getselectionDirection\"\n prim__selectionDirection\n prim__setSelectionDirection\n v\n \n export\n selectionEnd : HTMLInputElement -> Attribute False Maybe Bits32\n selectionEnd v = fromNullablePrim \"HTMLInputElement.getselectionEnd\"\n prim__selectionEnd\n prim__setSelectionEnd\n v\n \n export\n selectionStart : HTMLInputElement -> Attribute False Maybe Bits32\n selectionStart v = fromNullablePrim \"HTMLInputElement.getselectionStart\"\n prim__selectionStart\n prim__setSelectionStart\n v\n \n export\n size : HTMLInputElement -> Attribute True I Bits32\n size v = fromPrim \"HTMLInputElement.getsize\" prim__size prim__setSize v\n \n export\n src : HTMLInputElement -> Attribute True I String\n src v = fromPrim \"HTMLInputElement.getsrc\" prim__src prim__setSrc v\n \n export\n step : HTMLInputElement -> Attribute True I String\n step v = fromPrim \"HTMLInputElement.getstep\" prim__step prim__setStep v\n \n export\n type : HTMLInputElement -> Attribute True I String\n type v = fromPrim \"HTMLInputElement.gettype\" prim__type prim__setType v\n \n export\n useMap : HTMLInputElement -> Attribute True I String\n useMap v = fromPrim \"HTMLInputElement.getuseMap\"\n prim__useMap\n prim__setUseMap\n v\n \n export\n validationMessage : (obj : HTMLInputElement) -> JSIO String\n validationMessage a = primJS $ HTMLInputElement.prim__validationMessage a\n \n export\n validity : (obj : HTMLInputElement) -> JSIO ValidityState\n validity a = primJS $ HTMLInputElement.prim__validity a\n \n export\n value : HTMLInputElement -> Attribute True I String\n value v = fromPrim \"HTMLInputElement.getvalue\" prim__value prim__setValue v\n \n export\n valueAsDate : HTMLInputElement -> Attribute False Maybe Object\n valueAsDate v = fromNullablePrim \"HTMLInputElement.getvalueAsDate\"\n prim__valueAsDate\n prim__setValueAsDate\n v\n \n export\n valueAsNumber : HTMLInputElement -> Attribute True I Double\n valueAsNumber v = fromPrim \"HTMLInputElement.getvalueAsNumber\"\n prim__valueAsNumber\n prim__setValueAsNumber\n v\n \n export\n width : HTMLInputElement -> Attribute True I Bits32\n width v = fromPrim \"HTMLInputElement.getwidth\" prim__width prim__setWidth v\n \n export\n willValidate : (obj : HTMLInputElement) -> JSIO Bool\n willValidate a = tryJS \"HTMLInputElement.willValidate\"\n $ HTMLInputElement.prim__willValidate a\n \n export\n checkValidity : (obj : HTMLInputElement) -> JSIO Bool\n checkValidity a = tryJS \"HTMLInputElement.checkValidity\"\n $ HTMLInputElement.prim__checkValidity a\n \n export\n reportValidity : (obj : HTMLInputElement) -> JSIO Bool\n reportValidity a = tryJS \"HTMLInputElement.reportValidity\"\n $ HTMLInputElement.prim__reportValidity a\n \n export\n select : (obj : HTMLInputElement) -> JSIO ()\n select a = primJS $ HTMLInputElement.prim__select a\n \n export\n setCustomValidity : (obj : HTMLInputElement) -> (error : String) -> JSIO ()\n setCustomValidity a b = primJS $ HTMLInputElement.prim__setCustomValidity a b\n \n export\n setRangeText : (obj : HTMLInputElement) -> (replacement : String) -> JSIO ()\n setRangeText a b = primJS $ HTMLInputElement.prim__setRangeText a b\n \n export\n setRangeText1 : (obj : HTMLInputElement)\n -> (replacement : String)\n -> (start : Bits32)\n -> (end : Bits32)\n -> (selectionMode : Optional SelectionMode)\n -> JSIO ()\n setRangeText1 a b c d e = primJS\n $ HTMLInputElement.prim__setRangeText1 a\n b\n c\n d\n (toFFI e)\n\n export\n setRangeText1' : (obj : HTMLInputElement)\n -> (replacement : String)\n -> (start : Bits32)\n -> (end : Bits32)\n -> JSIO ()\n setRangeText1' a b c d = primJS\n $ HTMLInputElement.prim__setRangeText1 a b c d undef\n \n export\n setSelectionRange : (obj : HTMLInputElement)\n -> (start : Bits32)\n -> (end : Bits32)\n -> (direction : Optional String)\n -> JSIO ()\n setSelectionRange a b c d = primJS\n $ HTMLInputElement.prim__setSelectionRange a\n b\n c\n (toFFI d)\n\n export\n setSelectionRange' : (obj : HTMLInputElement)\n -> (start : Bits32)\n -> (end : Bits32)\n -> JSIO ()\n setSelectionRange' a b c = primJS\n $ HTMLInputElement.prim__setSelectionRange a\n b\n c\n undef\n \n export\n stepDown : (obj : HTMLInputElement) -> (n : Optional Int32) -> JSIO ()\n stepDown a b = primJS $ HTMLInputElement.prim__stepDown a (toFFI b)\n\n export\n stepDown' : (obj : HTMLInputElement) -> JSIO ()\n stepDown' a = primJS $ HTMLInputElement.prim__stepDown a undef\n \n export\n stepUp : (obj : HTMLInputElement) -> (n : Optional Int32) -> JSIO ()\n stepUp a b = primJS $ HTMLInputElement.prim__stepUp a (toFFI b)\n\n export\n stepUp' : (obj : HTMLInputElement) -> JSIO ()\n stepUp' a = primJS $ HTMLInputElement.prim__stepUp a undef\n\n\nnamespace HTMLLIElement\n \n export\n new : JSIO HTMLLIElement\n new = primJS $ HTMLLIElement.prim__new \n \n export\n type : HTMLLIElement -> Attribute True I String\n type v = fromPrim \"HTMLLIElement.gettype\" prim__type prim__setType v\n \n export\n value : HTMLLIElement -> Attribute True I Int32\n value v = fromPrim \"HTMLLIElement.getvalue\" prim__value prim__setValue v\n\n\nnamespace HTMLLabelElement\n \n export\n new : JSIO HTMLLabelElement\n new = primJS $ HTMLLabelElement.prim__new \n \n export\n control : (obj : HTMLLabelElement) -> JSIO (Maybe HTMLElement)\n control a = tryJS \"HTMLLabelElement.control\"\n $ HTMLLabelElement.prim__control a\n \n export\n form : (obj : HTMLLabelElement) -> JSIO (Maybe HTMLFormElement)\n form a = tryJS \"HTMLLabelElement.form\" $ HTMLLabelElement.prim__form a\n \n export\n htmlFor : HTMLLabelElement -> Attribute True I String\n htmlFor v = fromPrim \"HTMLLabelElement.gethtmlFor\"\n prim__htmlFor\n prim__setHtmlFor\n v\n\n\nnamespace HTMLLegendElement\n \n export\n new : JSIO HTMLLegendElement\n new = primJS $ HTMLLegendElement.prim__new \n \n export\n align : HTMLLegendElement -> Attribute True I String\n align v = fromPrim \"HTMLLegendElement.getalign\" prim__align prim__setAlign v\n \n export\n form : (obj : HTMLLegendElement) -> JSIO (Maybe HTMLFormElement)\n form a = tryJS \"HTMLLegendElement.form\" $ HTMLLegendElement.prim__form a\n\n\nnamespace HTMLLinkElement\n \n export\n new : JSIO HTMLLinkElement\n new = primJS $ HTMLLinkElement.prim__new \n \n export\n as : HTMLLinkElement -> Attribute True I String\n as v = fromPrim \"HTMLLinkElement.getas\" prim__as prim__setAs v\n \n export\n charset : HTMLLinkElement -> Attribute True I String\n charset v = fromPrim \"HTMLLinkElement.getcharset\"\n prim__charset\n prim__setCharset\n v\n \n export\n crossOrigin : HTMLLinkElement -> Attribute False Maybe String\n crossOrigin v = fromNullablePrim \"HTMLLinkElement.getcrossOrigin\"\n prim__crossOrigin\n prim__setCrossOrigin\n v\n \n export\n disabled : HTMLLinkElement -> Attribute True I Bool\n disabled v = fromPrim \"HTMLLinkElement.getdisabled\"\n prim__disabled\n prim__setDisabled\n v\n \n export\n href : HTMLLinkElement -> Attribute True I String\n href v = fromPrim \"HTMLLinkElement.gethref\" prim__href prim__setHref v\n \n export\n hreflang : HTMLLinkElement -> Attribute True I String\n hreflang v = fromPrim \"HTMLLinkElement.gethreflang\"\n prim__hreflang\n prim__setHreflang\n v\n \n export\n imageSizes : HTMLLinkElement -> Attribute True I String\n imageSizes v = fromPrim \"HTMLLinkElement.getimageSizes\"\n prim__imageSizes\n prim__setImageSizes\n v\n \n export\n imageSrcset : HTMLLinkElement -> Attribute True I String\n imageSrcset v = fromPrim \"HTMLLinkElement.getimageSrcset\"\n prim__imageSrcset\n prim__setImageSrcset\n v\n \n export\n integrity : HTMLLinkElement -> Attribute True I String\n integrity v = fromPrim \"HTMLLinkElement.getintegrity\"\n prim__integrity\n prim__setIntegrity\n v\n \n export\n media : HTMLLinkElement -> Attribute True I String\n media v = fromPrim \"HTMLLinkElement.getmedia\" prim__media prim__setMedia v\n \n export\n referrerPolicy : HTMLLinkElement -> Attribute True I String\n referrerPolicy v = fromPrim \"HTMLLinkElement.getreferrerPolicy\"\n prim__referrerPolicy\n prim__setReferrerPolicy\n v\n \n export\n rel : HTMLLinkElement -> Attribute True I String\n rel v = fromPrim \"HTMLLinkElement.getrel\" prim__rel prim__setRel v\n \n export\n relList : (obj : HTMLLinkElement) -> JSIO DOMTokenList\n relList a = primJS $ HTMLLinkElement.prim__relList a\n \n export\n rev : HTMLLinkElement -> Attribute True I String\n rev v = fromPrim \"HTMLLinkElement.getrev\" prim__rev prim__setRev v\n \n export\n sizes : (obj : HTMLLinkElement) -> JSIO DOMTokenList\n sizes a = primJS $ HTMLLinkElement.prim__sizes a\n \n export\n target : HTMLLinkElement -> Attribute True I String\n target v = fromPrim \"HTMLLinkElement.gettarget\" prim__target prim__setTarget v\n \n export\n type : HTMLLinkElement -> Attribute True I String\n type v = fromPrim \"HTMLLinkElement.gettype\" prim__type prim__setType v\n\n\nnamespace HTMLMapElement\n \n export\n new : JSIO HTMLMapElement\n new = primJS $ HTMLMapElement.prim__new \n \n export\n areas : (obj : HTMLMapElement) -> JSIO HTMLCollection\n areas a = primJS $ HTMLMapElement.prim__areas a\n \n export\n name : HTMLMapElement -> Attribute True I String\n name v = fromPrim \"HTMLMapElement.getname\" prim__name prim__setName v\n\n\nnamespace HTMLMarqueeElement\n \n export\n new : JSIO HTMLMarqueeElement\n new = primJS $ HTMLMarqueeElement.prim__new \n \n export\n behavior : HTMLMarqueeElement -> Attribute True I String\n behavior v = fromPrim \"HTMLMarqueeElement.getbehavior\"\n prim__behavior\n prim__setBehavior\n v\n \n export\n bgColor : HTMLMarqueeElement -> Attribute True I String\n bgColor v = fromPrim \"HTMLMarqueeElement.getbgColor\"\n prim__bgColor\n prim__setBgColor\n v\n \n export\n direction : HTMLMarqueeElement -> Attribute True I String\n direction v = fromPrim \"HTMLMarqueeElement.getdirection\"\n prim__direction\n prim__setDirection\n v\n \n export\n height : HTMLMarqueeElement -> Attribute True I String\n height v = fromPrim \"HTMLMarqueeElement.getheight\"\n prim__height\n prim__setHeight\n v\n \n export\n hspace : HTMLMarqueeElement -> Attribute True I Bits32\n hspace v = fromPrim \"HTMLMarqueeElement.gethspace\"\n prim__hspace\n prim__setHspace\n v\n \n export\n loop : HTMLMarqueeElement -> Attribute True I Int32\n loop v = fromPrim \"HTMLMarqueeElement.getloop\" prim__loop prim__setLoop v\n \n export\n scrollAmount : HTMLMarqueeElement -> Attribute True I Bits32\n scrollAmount v = fromPrim \"HTMLMarqueeElement.getscrollAmount\"\n prim__scrollAmount\n prim__setScrollAmount\n v\n \n export\n scrollDelay : HTMLMarqueeElement -> Attribute True I Bits32\n scrollDelay v = fromPrim \"HTMLMarqueeElement.getscrollDelay\"\n prim__scrollDelay\n prim__setScrollDelay\n v\n \n export\n trueSpeed : HTMLMarqueeElement -> Attribute True I Bool\n trueSpeed v = fromPrim \"HTMLMarqueeElement.gettrueSpeed\"\n prim__trueSpeed\n prim__setTrueSpeed\n v\n \n export\n vspace : HTMLMarqueeElement -> Attribute True I Bits32\n vspace v = fromPrim \"HTMLMarqueeElement.getvspace\"\n prim__vspace\n prim__setVspace\n v\n \n export\n width : HTMLMarqueeElement -> Attribute True I String\n width v = fromPrim \"HTMLMarqueeElement.getwidth\" prim__width prim__setWidth v\n \n export\n start : (obj : HTMLMarqueeElement) -> JSIO ()\n start a = primJS $ HTMLMarqueeElement.prim__start a\n \n export\n stop : (obj : HTMLMarqueeElement) -> JSIO ()\n stop a = primJS $ HTMLMarqueeElement.prim__stop a\n\n\nnamespace HTMLMediaElement\n \n public export\n HAVE_CURRENT_DATA : Bits16\n HAVE_CURRENT_DATA = 2\n \n public export\n HAVE_ENOUGH_DATA : Bits16\n HAVE_ENOUGH_DATA = 4\n \n public export\n HAVE_FUTURE_DATA : Bits16\n HAVE_FUTURE_DATA = 3\n \n public export\n HAVE_METADATA : Bits16\n HAVE_METADATA = 1\n \n public export\n HAVE_NOTHING : Bits16\n HAVE_NOTHING = 0\n \n public export\n NETWORK_EMPTY : Bits16\n NETWORK_EMPTY = 0\n \n public export\n NETWORK_IDLE : Bits16\n NETWORK_IDLE = 1\n \n public export\n NETWORK_LOADING : Bits16\n NETWORK_LOADING = 2\n \n public export\n NETWORK_NO_SOURCE : Bits16\n NETWORK_NO_SOURCE = 3\n \n export\n audioTracks : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLMediaElement (Types t1)}\n -> (obj : t1)\n -> JSIO AudioTrackList\n audioTracks a = primJS $ HTMLMediaElement.prim__audioTracks (up a)\n \n export\n autoplay : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLMediaElement (Types t)}\n -> t\n -> Attribute True I Bool\n autoplay v = fromPrim \"HTMLMediaElement.getautoplay\"\n prim__autoplay\n prim__setAutoplay\n (v :> HTMLMediaElement)\n \n export\n buffered : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLMediaElement (Types t1)}\n -> (obj : t1)\n -> JSIO TimeRanges\n buffered a = primJS $ HTMLMediaElement.prim__buffered (up a)\n \n export\n controls : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLMediaElement (Types t)}\n -> t\n -> Attribute True I Bool\n controls v = fromPrim \"HTMLMediaElement.getcontrols\"\n prim__controls\n prim__setControls\n (v :> HTMLMediaElement)\n \n export\n crossOrigin : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLMediaElement (Types t)}\n -> t\n -> Attribute False Maybe String\n crossOrigin v = fromNullablePrim \"HTMLMediaElement.getcrossOrigin\"\n prim__crossOrigin\n prim__setCrossOrigin\n (v :> HTMLMediaElement)\n \n export\n currentSrc : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLMediaElement (Types t1)}\n -> (obj : t1)\n -> JSIO String\n currentSrc a = primJS $ HTMLMediaElement.prim__currentSrc (up a)\n \n export\n currentTime : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLMediaElement (Types t)}\n -> t\n -> Attribute True I Double\n currentTime v = fromPrim \"HTMLMediaElement.getcurrentTime\"\n prim__currentTime\n prim__setCurrentTime\n (v :> HTMLMediaElement)\n \n export\n defaultMuted : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLMediaElement (Types t)}\n -> t\n -> Attribute True I Bool\n defaultMuted v = fromPrim \"HTMLMediaElement.getdefaultMuted\"\n prim__defaultMuted\n prim__setDefaultMuted\n (v :> HTMLMediaElement)\n \n export\n defaultPlaybackRate : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLMediaElement (Types t)}\n -> t\n -> Attribute True I Double\n defaultPlaybackRate v = fromPrim \"HTMLMediaElement.getdefaultPlaybackRate\"\n prim__defaultPlaybackRate\n prim__setDefaultPlaybackRate\n (v :> HTMLMediaElement)\n \n export\n duration : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLMediaElement (Types t1)}\n -> (obj : t1)\n -> JSIO Double\n duration a = primJS $ HTMLMediaElement.prim__duration (up a)\n \n export\n ended : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLMediaElement (Types t1)}\n -> (obj : t1)\n -> JSIO Bool\n ended a = tryJS \"HTMLMediaElement.ended\" $ HTMLMediaElement.prim__ended (up a)\n \n export\n error : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLMediaElement (Types t1)}\n -> (obj : t1)\n -> JSIO (Maybe MediaError)\n error a = tryJS \"HTMLMediaElement.error\" $ HTMLMediaElement.prim__error (up a)\n \n export\n loop : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLMediaElement (Types t)}\n -> t\n -> Attribute True I Bool\n loop v = fromPrim \"HTMLMediaElement.getloop\"\n prim__loop\n prim__setLoop\n (v :> HTMLMediaElement)\n \n export\n muted : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLMediaElement (Types t)}\n -> t\n -> Attribute True I Bool\n muted v = fromPrim \"HTMLMediaElement.getmuted\"\n prim__muted\n prim__setMuted\n (v :> HTMLMediaElement)\n \n export\n networkState : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLMediaElement (Types t1)}\n -> (obj : t1)\n -> JSIO Bits16\n networkState a = primJS $ HTMLMediaElement.prim__networkState (up a)\n \n export\n paused : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLMediaElement (Types t1)}\n -> (obj : t1)\n -> JSIO Bool\n paused a = tryJS \"HTMLMediaElement.paused\"\n $ HTMLMediaElement.prim__paused (up a)\n \n export\n playbackRate : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLMediaElement (Types t)}\n -> t\n -> Attribute True I Double\n playbackRate v = fromPrim \"HTMLMediaElement.getplaybackRate\"\n prim__playbackRate\n prim__setPlaybackRate\n (v :> HTMLMediaElement)\n \n export\n played : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLMediaElement (Types t1)}\n -> (obj : t1)\n -> JSIO TimeRanges\n played a = primJS $ HTMLMediaElement.prim__played (up a)\n \n export\n preload : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLMediaElement (Types t)}\n -> t\n -> Attribute True I String\n preload v = fromPrim \"HTMLMediaElement.getpreload\"\n prim__preload\n prim__setPreload\n (v :> HTMLMediaElement)\n \n export\n preservesPitch : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLMediaElement (Types t)}\n -> t\n -> Attribute True I Bool\n preservesPitch v = fromPrim \"HTMLMediaElement.getpreservesPitch\"\n prim__preservesPitch\n prim__setPreservesPitch\n (v :> HTMLMediaElement)\n \n export\n readyState : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLMediaElement (Types t1)}\n -> (obj : t1)\n -> JSIO Bits16\n readyState a = primJS $ HTMLMediaElement.prim__readyState (up a)\n \n export\n seekable : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLMediaElement (Types t1)}\n -> (obj : t1)\n -> JSIO TimeRanges\n seekable a = primJS $ HTMLMediaElement.prim__seekable (up a)\n \n export\n seeking : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLMediaElement (Types t1)}\n -> (obj : t1)\n -> JSIO Bool\n seeking a = tryJS \"HTMLMediaElement.seeking\"\n $ HTMLMediaElement.prim__seeking (up a)\n \n export\n src : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLMediaElement (Types t)}\n -> t\n -> Attribute True I String\n src v = fromPrim \"HTMLMediaElement.getsrc\"\n prim__src\n prim__setSrc\n (v :> HTMLMediaElement)\n \n export\n srcObject : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLMediaElement (Types t)}\n -> t\n -> Attribute False Maybe (NS I [ MediaStream , MediaSource , Blob ])\n srcObject v = fromNullablePrim \"HTMLMediaElement.getsrcObject\"\n prim__srcObject\n prim__setSrcObject\n (v :> HTMLMediaElement)\n \n export\n textTracks : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLMediaElement (Types t1)}\n -> (obj : t1)\n -> JSIO TextTrackList\n textTracks a = primJS $ HTMLMediaElement.prim__textTracks (up a)\n \n export\n videoTracks : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLMediaElement (Types t1)}\n -> (obj : t1)\n -> JSIO VideoTrackList\n videoTracks a = primJS $ HTMLMediaElement.prim__videoTracks (up a)\n \n export\n volume : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLMediaElement (Types t)}\n -> t\n -> Attribute True I Double\n volume v = fromPrim \"HTMLMediaElement.getvolume\"\n prim__volume\n prim__setVolume\n (v :> HTMLMediaElement)\n \n export\n addTextTrack : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLMediaElement (Types t1)}\n -> (obj : t1)\n -> (kind : TextTrackKind)\n -> (label : Optional String)\n -> (language : Optional String)\n -> JSIO TextTrack\n addTextTrack a b c d = primJS\n $ HTMLMediaElement.prim__addTextTrack (up a)\n (toFFI b)\n (toFFI c)\n (toFFI d)\n\n export\n addTextTrack' : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLMediaElement (Types t1)}\n -> (obj : t1)\n -> (kind : TextTrackKind)\n -> JSIO TextTrack\n addTextTrack' a b = primJS\n $ HTMLMediaElement.prim__addTextTrack (up a)\n (toFFI b)\n undef\n undef\n \n export\n canPlayType : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLMediaElement (Types t1)}\n -> (obj : t1)\n -> (type : String)\n -> JSIO CanPlayTypeResult\n canPlayType a b = tryJS \"HTMLMediaElement.canPlayType\"\n $ HTMLMediaElement.prim__canPlayType (up a) b\n \n export\n fastSeek : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLMediaElement (Types t1)}\n -> (obj : t1)\n -> (time : Double)\n -> JSIO ()\n fastSeek a b = primJS $ HTMLMediaElement.prim__fastSeek (up a) b\n \n export\n getStartDate : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLMediaElement (Types t1)}\n -> (obj : t1)\n -> JSIO Object\n getStartDate a = primJS $ HTMLMediaElement.prim__getStartDate (up a)\n \n export\n load : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLMediaElement (Types t1)}\n -> (obj : t1)\n -> JSIO ()\n load a = primJS $ HTMLMediaElement.prim__load (up a)\n \n export\n pause : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLMediaElement (Types t1)}\n -> (obj : t1)\n -> JSIO ()\n pause a = primJS $ HTMLMediaElement.prim__pause (up a)\n \n export\n play : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLMediaElement (Types t1)}\n -> (obj : t1)\n -> JSIO (Promise Undefined)\n play a = primJS $ HTMLMediaElement.prim__play (up a)\n\n\nnamespace HTMLMenuElement\n \n export\n new : JSIO HTMLMenuElement\n new = primJS $ HTMLMenuElement.prim__new \n \n export\n compact : HTMLMenuElement -> Attribute True I Bool\n compact v = fromPrim \"HTMLMenuElement.getcompact\"\n prim__compact\n prim__setCompact\n v\n\n\nnamespace HTMLMetaElement\n \n export\n new : JSIO HTMLMetaElement\n new = primJS $ HTMLMetaElement.prim__new \n \n export\n content : HTMLMetaElement -> Attribute True I String\n content v = fromPrim \"HTMLMetaElement.getcontent\"\n prim__content\n prim__setContent\n v\n \n export\n httpEquiv : HTMLMetaElement -> Attribute True I String\n httpEquiv v = fromPrim \"HTMLMetaElement.gethttpEquiv\"\n prim__httpEquiv\n prim__setHttpEquiv\n v\n \n export\n name : HTMLMetaElement -> Attribute True I String\n name v = fromPrim \"HTMLMetaElement.getname\" prim__name prim__setName v\n \n export\n scheme : HTMLMetaElement -> Attribute True I String\n scheme v = fromPrim \"HTMLMetaElement.getscheme\" prim__scheme prim__setScheme v\n\n\nnamespace HTMLMeterElement\n \n export\n new : JSIO HTMLMeterElement\n new = primJS $ HTMLMeterElement.prim__new \n \n export\n high : HTMLMeterElement -> Attribute True I Double\n high v = fromPrim \"HTMLMeterElement.gethigh\" prim__high prim__setHigh v\n \n export\n labels : (obj : HTMLMeterElement) -> JSIO NodeList\n labels a = primJS $ HTMLMeterElement.prim__labels a\n \n export\n low : HTMLMeterElement -> Attribute True I Double\n low v = fromPrim \"HTMLMeterElement.getlow\" prim__low prim__setLow v\n \n export\n max : HTMLMeterElement -> Attribute True I Double\n max v = fromPrim \"HTMLMeterElement.getmax\" prim__max prim__setMax v\n \n export\n min : HTMLMeterElement -> Attribute True I Double\n min v = fromPrim \"HTMLMeterElement.getmin\" prim__min prim__setMin v\n \n export\n optimum : HTMLMeterElement -> Attribute True I Double\n optimum v = fromPrim \"HTMLMeterElement.getoptimum\"\n prim__optimum\n prim__setOptimum\n v\n \n export\n value : HTMLMeterElement -> Attribute True I Double\n value v = fromPrim \"HTMLMeterElement.getvalue\" prim__value prim__setValue v\n\n\nnamespace HTMLModElement\n \n export\n new : JSIO HTMLModElement\n new = primJS $ HTMLModElement.prim__new \n \n export\n cite : HTMLModElement -> Attribute True I String\n cite v = fromPrim \"HTMLModElement.getcite\" prim__cite prim__setCite v\n \n export\n dateTime : HTMLModElement -> Attribute True I String\n dateTime v = fromPrim \"HTMLModElement.getdateTime\"\n prim__dateTime\n prim__setDateTime\n v\n\n\nnamespace HTMLOListElement\n \n export\n new : JSIO HTMLOListElement\n new = primJS $ HTMLOListElement.prim__new \n \n export\n compact : HTMLOListElement -> Attribute True I Bool\n compact v = fromPrim \"HTMLOListElement.getcompact\"\n prim__compact\n prim__setCompact\n v\n \n export\n reversed : HTMLOListElement -> Attribute True I Bool\n reversed v = fromPrim \"HTMLOListElement.getreversed\"\n prim__reversed\n prim__setReversed\n v\n \n export\n start : HTMLOListElement -> Attribute True I Int32\n start v = fromPrim \"HTMLOListElement.getstart\" prim__start prim__setStart v\n \n export\n type : HTMLOListElement -> Attribute True I String\n type v = fromPrim \"HTMLOListElement.gettype\" prim__type prim__setType v\n\n\nnamespace HTMLObjectElement\n \n export\n new : JSIO HTMLObjectElement\n new = primJS $ HTMLObjectElement.prim__new \n \n export\n align : HTMLObjectElement -> Attribute True I String\n align v = fromPrim \"HTMLObjectElement.getalign\" prim__align prim__setAlign v\n \n export\n archive : HTMLObjectElement -> Attribute True I String\n archive v = fromPrim \"HTMLObjectElement.getarchive\"\n prim__archive\n prim__setArchive\n v\n \n export\n border : HTMLObjectElement -> Attribute True I String\n border v = fromPrim \"HTMLObjectElement.getborder\"\n prim__border\n prim__setBorder\n v\n \n export\n code : HTMLObjectElement -> Attribute True I String\n code v = fromPrim \"HTMLObjectElement.getcode\" prim__code prim__setCode v\n \n export\n codeBase : HTMLObjectElement -> Attribute True I String\n codeBase v = fromPrim \"HTMLObjectElement.getcodeBase\"\n prim__codeBase\n prim__setCodeBase\n v\n \n export\n codeType : HTMLObjectElement -> Attribute True I String\n codeType v = fromPrim \"HTMLObjectElement.getcodeType\"\n prim__codeType\n prim__setCodeType\n v\n \n export\n contentDocument : (obj : HTMLObjectElement) -> JSIO (Maybe Document)\n contentDocument a = tryJS \"HTMLObjectElement.contentDocument\"\n $ HTMLObjectElement.prim__contentDocument a\n \n export\n contentWindow : (obj : HTMLObjectElement) -> JSIO (Maybe WindowProxy)\n contentWindow a = tryJS \"HTMLObjectElement.contentWindow\"\n $ HTMLObjectElement.prim__contentWindow a\n \n export\n data_ : HTMLObjectElement -> Attribute True I String\n data_ v = fromPrim \"HTMLObjectElement.getdata\" prim__data prim__setData v\n \n export\n declare : HTMLObjectElement -> Attribute True I Bool\n declare v = fromPrim \"HTMLObjectElement.getdeclare\"\n prim__declare\n prim__setDeclare\n v\n \n export\n form : (obj : HTMLObjectElement) -> JSIO (Maybe HTMLFormElement)\n form a = tryJS \"HTMLObjectElement.form\" $ HTMLObjectElement.prim__form a\n \n export\n height : HTMLObjectElement -> Attribute True I String\n height v = fromPrim \"HTMLObjectElement.getheight\"\n prim__height\n prim__setHeight\n v\n \n export\n hspace : HTMLObjectElement -> Attribute True I Bits32\n hspace v = fromPrim \"HTMLObjectElement.gethspace\"\n prim__hspace\n prim__setHspace\n v\n \n export\n name : HTMLObjectElement -> Attribute True I String\n name v = fromPrim \"HTMLObjectElement.getname\" prim__name prim__setName v\n \n export\n standby : HTMLObjectElement -> Attribute True I String\n standby v = fromPrim \"HTMLObjectElement.getstandby\"\n prim__standby\n prim__setStandby\n v\n \n export\n type : HTMLObjectElement -> Attribute True I String\n type v = fromPrim \"HTMLObjectElement.gettype\" prim__type prim__setType v\n \n export\n useMap : HTMLObjectElement -> Attribute True I String\n useMap v = fromPrim \"HTMLObjectElement.getuseMap\"\n prim__useMap\n prim__setUseMap\n v\n \n export\n validationMessage : (obj : HTMLObjectElement) -> JSIO String\n validationMessage a = primJS $ HTMLObjectElement.prim__validationMessage a\n \n export\n validity : (obj : HTMLObjectElement) -> JSIO ValidityState\n validity a = primJS $ HTMLObjectElement.prim__validity a\n \n export\n vspace : HTMLObjectElement -> Attribute True I Bits32\n vspace v = fromPrim \"HTMLObjectElement.getvspace\"\n prim__vspace\n prim__setVspace\n v\n \n export\n width : HTMLObjectElement -> Attribute True I String\n width v = fromPrim \"HTMLObjectElement.getwidth\" prim__width prim__setWidth v\n \n export\n willValidate : (obj : HTMLObjectElement) -> JSIO Bool\n willValidate a = tryJS \"HTMLObjectElement.willValidate\"\n $ HTMLObjectElement.prim__willValidate a\n \n export\n checkValidity : (obj : HTMLObjectElement) -> JSIO Bool\n checkValidity a = tryJS \"HTMLObjectElement.checkValidity\"\n $ HTMLObjectElement.prim__checkValidity a\n \n export\n getSVGDocument : (obj : HTMLObjectElement) -> JSIO (Maybe Document)\n getSVGDocument a = tryJS \"HTMLObjectElement.getSVGDocument\"\n $ HTMLObjectElement.prim__getSVGDocument a\n \n export\n reportValidity : (obj : HTMLObjectElement) -> JSIO Bool\n reportValidity a = tryJS \"HTMLObjectElement.reportValidity\"\n $ HTMLObjectElement.prim__reportValidity a\n \n export\n setCustomValidity : (obj : HTMLObjectElement) -> (error : String) -> JSIO ()\n setCustomValidity a b = primJS $ HTMLObjectElement.prim__setCustomValidity a b\n\n\nnamespace HTMLOptGroupElement\n \n export\n new : JSIO HTMLOptGroupElement\n new = primJS $ HTMLOptGroupElement.prim__new \n \n export\n disabled : HTMLOptGroupElement -> Attribute True I Bool\n disabled v = fromPrim \"HTMLOptGroupElement.getdisabled\"\n prim__disabled\n prim__setDisabled\n v\n \n export\n label : HTMLOptGroupElement -> Attribute True I String\n label v = fromPrim \"HTMLOptGroupElement.getlabel\" prim__label prim__setLabel v\n\n\nnamespace HTMLOptionElement\n \n export\n new : JSIO HTMLOptionElement\n new = primJS $ HTMLOptionElement.prim__new \n \n export\n defaultSelected : HTMLOptionElement -> Attribute True I Bool\n defaultSelected v = fromPrim \"HTMLOptionElement.getdefaultSelected\"\n prim__defaultSelected\n prim__setDefaultSelected\n v\n \n export\n disabled : HTMLOptionElement -> Attribute True I Bool\n disabled v = fromPrim \"HTMLOptionElement.getdisabled\"\n prim__disabled\n prim__setDisabled\n v\n \n export\n form : (obj : HTMLOptionElement) -> JSIO (Maybe HTMLFormElement)\n form a = tryJS \"HTMLOptionElement.form\" $ HTMLOptionElement.prim__form a\n \n export\n index : (obj : HTMLOptionElement) -> JSIO Int32\n index a = primJS $ HTMLOptionElement.prim__index a\n \n export\n label : HTMLOptionElement -> Attribute True I String\n label v = fromPrim \"HTMLOptionElement.getlabel\" prim__label prim__setLabel v\n \n export\n selected : HTMLOptionElement -> Attribute True I Bool\n selected v = fromPrim \"HTMLOptionElement.getselected\"\n prim__selected\n prim__setSelected\n v\n \n export\n text : HTMLOptionElement -> Attribute True I String\n text v = fromPrim \"HTMLOptionElement.gettext\" prim__text prim__setText v\n \n export\n value : HTMLOptionElement -> Attribute True I String\n value v = fromPrim \"HTMLOptionElement.getvalue\" prim__value prim__setValue v\n\n\nnamespace HTMLOptionsCollection\n \n export\n set : (obj : HTMLOptionsCollection)\n -> (index : Bits32)\n -> (option : Maybe HTMLOptionElement)\n -> JSIO ()\n set a b c = primJS $ HTMLOptionsCollection.prim__set a b (toFFI c)\n \n export\n length : HTMLOptionsCollection -> Attribute True I Bits32\n length v = fromPrim \"HTMLOptionsCollection.getlength\"\n prim__length\n prim__setLength\n v\n \n export\n selectedIndex : HTMLOptionsCollection -> Attribute True I Int32\n selectedIndex v = fromPrim \"HTMLOptionsCollection.getselectedIndex\"\n prim__selectedIndex\n prim__setSelectedIndex\n v\n \n export\n add : (obj : HTMLOptionsCollection)\n -> (element : NS I [ HTMLOptionElement , HTMLOptGroupElement ])\n -> (before : Optional (Maybe (NS I [ HTMLElement , Int32 ])))\n -> JSIO ()\n add a b c = primJS $ HTMLOptionsCollection.prim__add a (toFFI b) (toFFI c)\n\n export\n add' : (obj : HTMLOptionsCollection)\n -> (element : NS I [ HTMLOptionElement , HTMLOptGroupElement ])\n -> JSIO ()\n add' a b = primJS $ HTMLOptionsCollection.prim__add a (toFFI b) undef\n \n export\n remove : (obj : HTMLOptionsCollection) -> (index : Int32) -> JSIO ()\n remove a b = primJS $ HTMLOptionsCollection.prim__remove a b\n\n\nnamespace HTMLOutputElement\n \n export\n new : JSIO HTMLOutputElement\n new = primJS $ HTMLOutputElement.prim__new \n \n export\n defaultValue : HTMLOutputElement -> Attribute True I String\n defaultValue v = fromPrim \"HTMLOutputElement.getdefaultValue\"\n prim__defaultValue\n prim__setDefaultValue\n v\n \n export\n form : (obj : HTMLOutputElement) -> JSIO (Maybe HTMLFormElement)\n form a = tryJS \"HTMLOutputElement.form\" $ HTMLOutputElement.prim__form a\n \n export\n htmlFor : (obj : HTMLOutputElement) -> JSIO DOMTokenList\n htmlFor a = primJS $ HTMLOutputElement.prim__htmlFor a\n \n export\n labels : (obj : HTMLOutputElement) -> JSIO NodeList\n labels a = primJS $ HTMLOutputElement.prim__labels a\n \n export\n name : HTMLOutputElement -> Attribute True I String\n name v = fromPrim \"HTMLOutputElement.getname\" prim__name prim__setName v\n \n export\n type : (obj : HTMLOutputElement) -> JSIO String\n type a = primJS $ HTMLOutputElement.prim__type a\n \n export\n validationMessage : (obj : HTMLOutputElement) -> JSIO String\n validationMessage a = primJS $ HTMLOutputElement.prim__validationMessage a\n \n export\n validity : (obj : HTMLOutputElement) -> JSIO ValidityState\n validity a = primJS $ HTMLOutputElement.prim__validity a\n \n export\n value : HTMLOutputElement -> Attribute True I String\n value v = fromPrim \"HTMLOutputElement.getvalue\" prim__value prim__setValue v\n \n export\n willValidate : (obj : HTMLOutputElement) -> JSIO Bool\n willValidate a = tryJS \"HTMLOutputElement.willValidate\"\n $ HTMLOutputElement.prim__willValidate a\n \n export\n checkValidity : (obj : HTMLOutputElement) -> JSIO Bool\n checkValidity a = tryJS \"HTMLOutputElement.checkValidity\"\n $ HTMLOutputElement.prim__checkValidity a\n \n export\n reportValidity : (obj : HTMLOutputElement) -> JSIO Bool\n reportValidity a = tryJS \"HTMLOutputElement.reportValidity\"\n $ HTMLOutputElement.prim__reportValidity a\n \n export\n setCustomValidity : (obj : HTMLOutputElement) -> (error : String) -> JSIO ()\n setCustomValidity a b = primJS $ HTMLOutputElement.prim__setCustomValidity a b\n\n\nnamespace HTMLParagraphElement\n \n export\n new : JSIO HTMLParagraphElement\n new = primJS $ HTMLParagraphElement.prim__new \n \n export\n align : HTMLParagraphElement -> Attribute True I String\n align v = fromPrim \"HTMLParagraphElement.getalign\"\n prim__align\n prim__setAlign\n v\n\n\nnamespace HTMLParamElement\n \n export\n new : JSIO HTMLParamElement\n new = primJS $ HTMLParamElement.prim__new \n \n export\n name : HTMLParamElement -> Attribute True I String\n name v = fromPrim \"HTMLParamElement.getname\" prim__name prim__setName v\n \n export\n type : HTMLParamElement -> Attribute True I String\n type v = fromPrim \"HTMLParamElement.gettype\" prim__type prim__setType v\n \n export\n value : HTMLParamElement -> Attribute True I String\n value v = fromPrim \"HTMLParamElement.getvalue\" prim__value prim__setValue v\n \n export\n valueType : HTMLParamElement -> Attribute True I String\n valueType v = fromPrim \"HTMLParamElement.getvalueType\"\n prim__valueType\n prim__setValueType\n v\n\n\nnamespace HTMLPictureElement\n \n export\n new : JSIO HTMLPictureElement\n new = primJS $ HTMLPictureElement.prim__new \n\n\nnamespace HTMLPreElement\n \n export\n new : JSIO HTMLPreElement\n new = primJS $ HTMLPreElement.prim__new \n \n export\n width : HTMLPreElement -> Attribute True I Int32\n width v = fromPrim \"HTMLPreElement.getwidth\" prim__width prim__setWidth v\n\n\nnamespace HTMLProgressElement\n \n export\n new : JSIO HTMLProgressElement\n new = primJS $ HTMLProgressElement.prim__new \n \n export\n labels : (obj : HTMLProgressElement) -> JSIO NodeList\n labels a = primJS $ HTMLProgressElement.prim__labels a\n \n export\n max : HTMLProgressElement -> Attribute True I Double\n max v = fromPrim \"HTMLProgressElement.getmax\" prim__max prim__setMax v\n \n export\n position : (obj : HTMLProgressElement) -> JSIO Double\n position a = primJS $ HTMLProgressElement.prim__position a\n \n export\n value : HTMLProgressElement -> Attribute True I Double\n value v = fromPrim \"HTMLProgressElement.getvalue\" prim__value prim__setValue v\n\n\nnamespace HTMLQuoteElement\n \n export\n new : JSIO HTMLQuoteElement\n new = primJS $ HTMLQuoteElement.prim__new \n \n export\n cite : HTMLQuoteElement -> Attribute True I String\n cite v = fromPrim \"HTMLQuoteElement.getcite\" prim__cite prim__setCite v\n\n\nnamespace HTMLScriptElement\n \n export\n new : JSIO HTMLScriptElement\n new = primJS $ HTMLScriptElement.prim__new \n \n export\n async : HTMLScriptElement -> Attribute True I Bool\n async v = fromPrim \"HTMLScriptElement.getasync\" prim__async prim__setAsync v\n \n export\n charset : HTMLScriptElement -> Attribute True I String\n charset v = fromPrim \"HTMLScriptElement.getcharset\"\n prim__charset\n prim__setCharset\n v\n \n export\n crossOrigin : HTMLScriptElement -> Attribute False Maybe String\n crossOrigin v = fromNullablePrim \"HTMLScriptElement.getcrossOrigin\"\n prim__crossOrigin\n prim__setCrossOrigin\n v\n \n export\n defer : HTMLScriptElement -> Attribute True I Bool\n defer v = fromPrim \"HTMLScriptElement.getdefer\" prim__defer prim__setDefer v\n \n export\n event : HTMLScriptElement -> Attribute True I String\n event v = fromPrim \"HTMLScriptElement.getevent\" prim__event prim__setEvent v\n \n export\n htmlFor : HTMLScriptElement -> Attribute True I String\n htmlFor v = fromPrim \"HTMLScriptElement.gethtmlFor\"\n prim__htmlFor\n prim__setHtmlFor\n v\n \n export\n integrity : HTMLScriptElement -> Attribute True I String\n integrity v = fromPrim \"HTMLScriptElement.getintegrity\"\n prim__integrity\n prim__setIntegrity\n v\n \n export\n noModule : HTMLScriptElement -> Attribute True I Bool\n noModule v = fromPrim \"HTMLScriptElement.getnoModule\"\n prim__noModule\n prim__setNoModule\n v\n \n export\n referrerPolicy : HTMLScriptElement -> Attribute True I String\n referrerPolicy v = fromPrim \"HTMLScriptElement.getreferrerPolicy\"\n prim__referrerPolicy\n prim__setReferrerPolicy\n v\n \n export\n src : HTMLScriptElement -> Attribute True I String\n src v = fromPrim \"HTMLScriptElement.getsrc\" prim__src prim__setSrc v\n \n export\n text : HTMLScriptElement -> Attribute True I String\n text v = fromPrim \"HTMLScriptElement.gettext\" prim__text prim__setText v\n \n export\n type : HTMLScriptElement -> Attribute True I String\n type v = fromPrim \"HTMLScriptElement.gettype\" prim__type prim__setType v\n\n\nnamespace HTMLSelectElement\n \n export\n new : JSIO HTMLSelectElement\n new = primJS $ HTMLSelectElement.prim__new \n \n export\n set : (obj : HTMLSelectElement)\n -> (index : Bits32)\n -> (option : Maybe HTMLOptionElement)\n -> JSIO ()\n set a b c = primJS $ HTMLSelectElement.prim__set a b (toFFI c)\n \n export\n autocomplete : HTMLSelectElement -> Attribute True I String\n autocomplete v = fromPrim \"HTMLSelectElement.getautocomplete\"\n prim__autocomplete\n prim__setAutocomplete\n v\n \n export\n disabled : HTMLSelectElement -> Attribute True I Bool\n disabled v = fromPrim \"HTMLSelectElement.getdisabled\"\n prim__disabled\n prim__setDisabled\n v\n \n export\n form : (obj : HTMLSelectElement) -> JSIO (Maybe HTMLFormElement)\n form a = tryJS \"HTMLSelectElement.form\" $ HTMLSelectElement.prim__form a\n \n export\n labels : (obj : HTMLSelectElement) -> JSIO NodeList\n labels a = primJS $ HTMLSelectElement.prim__labels a\n \n export\n length : HTMLSelectElement -> Attribute True I Bits32\n length v = fromPrim \"HTMLSelectElement.getlength\"\n prim__length\n prim__setLength\n v\n \n export\n multiple : HTMLSelectElement -> Attribute True I Bool\n multiple v = fromPrim \"HTMLSelectElement.getmultiple\"\n prim__multiple\n prim__setMultiple\n v\n \n export\n name : HTMLSelectElement -> Attribute True I String\n name v = fromPrim \"HTMLSelectElement.getname\" prim__name prim__setName v\n \n export\n options : (obj : HTMLSelectElement) -> JSIO HTMLOptionsCollection\n options a = primJS $ HTMLSelectElement.prim__options a\n \n export\n required : HTMLSelectElement -> Attribute True I Bool\n required v = fromPrim \"HTMLSelectElement.getrequired\"\n prim__required\n prim__setRequired\n v\n \n export\n selectedIndex : HTMLSelectElement -> Attribute True I Int32\n selectedIndex v = fromPrim \"HTMLSelectElement.getselectedIndex\"\n prim__selectedIndex\n prim__setSelectedIndex\n v\n \n export\n selectedOptions : (obj : HTMLSelectElement) -> JSIO HTMLCollection\n selectedOptions a = primJS $ HTMLSelectElement.prim__selectedOptions a\n \n export\n size : HTMLSelectElement -> Attribute True I Bits32\n size v = fromPrim \"HTMLSelectElement.getsize\" prim__size prim__setSize v\n \n export\n type : (obj : HTMLSelectElement) -> JSIO String\n type a = primJS $ HTMLSelectElement.prim__type a\n \n export\n validationMessage : (obj : HTMLSelectElement) -> JSIO String\n validationMessage a = primJS $ HTMLSelectElement.prim__validationMessage a\n \n export\n validity : (obj : HTMLSelectElement) -> JSIO ValidityState\n validity a = primJS $ HTMLSelectElement.prim__validity a\n \n export\n value : HTMLSelectElement -> Attribute True I String\n value v = fromPrim \"HTMLSelectElement.getvalue\" prim__value prim__setValue v\n \n export\n willValidate : (obj : HTMLSelectElement) -> JSIO Bool\n willValidate a = tryJS \"HTMLSelectElement.willValidate\"\n $ HTMLSelectElement.prim__willValidate a\n \n export\n add : (obj : HTMLSelectElement)\n -> (element : NS I [ HTMLOptionElement , HTMLOptGroupElement ])\n -> (before : Optional (Maybe (NS I [ HTMLElement , Int32 ])))\n -> JSIO ()\n add a b c = primJS $ HTMLSelectElement.prim__add a (toFFI b) (toFFI c)\n\n export\n add' : (obj : HTMLSelectElement)\n -> (element : NS I [ HTMLOptionElement , HTMLOptGroupElement ])\n -> JSIO ()\n add' a b = primJS $ HTMLSelectElement.prim__add a (toFFI b) undef\n \n export\n checkValidity : (obj : HTMLSelectElement) -> JSIO Bool\n checkValidity a = tryJS \"HTMLSelectElement.checkValidity\"\n $ HTMLSelectElement.prim__checkValidity a\n \n export\n item : (obj : HTMLSelectElement) -> (index : Bits32) -> JSIO (Maybe Element)\n item a b = tryJS \"HTMLSelectElement.item\" $ HTMLSelectElement.prim__item a b\n \n export\n namedItem : (obj : HTMLSelectElement)\n -> (name : String)\n -> JSIO (Maybe HTMLOptionElement)\n namedItem a b = tryJS \"HTMLSelectElement.namedItem\"\n $ HTMLSelectElement.prim__namedItem a b\n \n export\n remove : (obj : HTMLSelectElement) -> JSIO ()\n remove a = primJS $ HTMLSelectElement.prim__remove a\n \n export\n remove1 : (obj : HTMLSelectElement) -> (index : Int32) -> JSIO ()\n remove1 a b = primJS $ HTMLSelectElement.prim__remove1 a b\n \n export\n reportValidity : (obj : HTMLSelectElement) -> JSIO Bool\n reportValidity a = tryJS \"HTMLSelectElement.reportValidity\"\n $ HTMLSelectElement.prim__reportValidity a\n \n export\n setCustomValidity : (obj : HTMLSelectElement) -> (error : String) -> JSIO ()\n setCustomValidity a b = primJS $ HTMLSelectElement.prim__setCustomValidity a b\n\n\nnamespace HTMLSlotElement\n \n export\n new : JSIO HTMLSlotElement\n new = primJS $ HTMLSlotElement.prim__new \n \n export\n name : HTMLSlotElement -> Attribute True I String\n name v = fromPrim \"HTMLSlotElement.getname\" prim__name prim__setName v\n \n export\n assignedElements : (0 _ : JSType t1)\n => {auto 0 _ : Elem AssignedNodesOptions (Types t1)}\n -> (obj : HTMLSlotElement)\n -> (options : Optional t1)\n -> JSIO (Array Element)\n assignedElements a b = primJS\n $ HTMLSlotElement.prim__assignedElements a (optUp b)\n\n export\n assignedElements' : (obj : HTMLSlotElement) -> JSIO (Array Element)\n assignedElements' a = primJS $ HTMLSlotElement.prim__assignedElements a undef\n \n export\n assignedNodes : (0 _ : JSType t1)\n => {auto 0 _ : Elem AssignedNodesOptions (Types t1)}\n -> (obj : HTMLSlotElement)\n -> (options : Optional t1)\n -> JSIO (Array Node)\n assignedNodes a b = primJS $ HTMLSlotElement.prim__assignedNodes a (optUp b)\n\n export\n assignedNodes' : (obj : HTMLSlotElement) -> JSIO (Array Node)\n assignedNodes' a = primJS $ HTMLSlotElement.prim__assignedNodes a undef\n\n\nnamespace HTMLSourceElement\n \n export\n new : JSIO HTMLSourceElement\n new = primJS $ HTMLSourceElement.prim__new \n \n export\n height : HTMLSourceElement -> Attribute True I Bits32\n height v = fromPrim \"HTMLSourceElement.getheight\"\n prim__height\n prim__setHeight\n v\n \n export\n media : HTMLSourceElement -> Attribute True I String\n media v = fromPrim \"HTMLSourceElement.getmedia\" prim__media prim__setMedia v\n \n export\n sizes : HTMLSourceElement -> Attribute True I String\n sizes v = fromPrim \"HTMLSourceElement.getsizes\" prim__sizes prim__setSizes v\n \n export\n src : HTMLSourceElement -> Attribute True I String\n src v = fromPrim \"HTMLSourceElement.getsrc\" prim__src prim__setSrc v\n \n export\n srcset : HTMLSourceElement -> Attribute True I String\n srcset v = fromPrim \"HTMLSourceElement.getsrcset\"\n prim__srcset\n prim__setSrcset\n v\n \n export\n type : HTMLSourceElement -> Attribute True I String\n type v = fromPrim \"HTMLSourceElement.gettype\" prim__type prim__setType v\n \n export\n width : HTMLSourceElement -> Attribute True I Bits32\n width v = fromPrim \"HTMLSourceElement.getwidth\" prim__width prim__setWidth v\n\n\nnamespace HTMLSpanElement\n \n export\n new : JSIO HTMLSpanElement\n new = primJS $ HTMLSpanElement.prim__new \n\n\nnamespace HTMLStyleElement\n \n export\n new : JSIO HTMLStyleElement\n new = primJS $ HTMLStyleElement.prim__new \n \n export\n media : HTMLStyleElement -> Attribute True I String\n media v = fromPrim \"HTMLStyleElement.getmedia\" prim__media prim__setMedia v\n \n export\n type : HTMLStyleElement -> Attribute True I String\n type v = fromPrim \"HTMLStyleElement.gettype\" prim__type prim__setType v\n\n\nnamespace HTMLTableCaptionElement\n \n export\n new : JSIO HTMLTableCaptionElement\n new = primJS $ HTMLTableCaptionElement.prim__new \n \n export\n align : HTMLTableCaptionElement -> Attribute True I String\n align v = fromPrim \"HTMLTableCaptionElement.getalign\"\n prim__align\n prim__setAlign\n v\n\n\nnamespace HTMLTableCellElement\n \n export\n new : JSIO HTMLTableCellElement\n new = primJS $ HTMLTableCellElement.prim__new \n \n export\n abbr : HTMLTableCellElement -> Attribute True I String\n abbr v = fromPrim \"HTMLTableCellElement.getabbr\" prim__abbr prim__setAbbr v\n \n export\n align : HTMLTableCellElement -> Attribute True I String\n align v = fromPrim \"HTMLTableCellElement.getalign\"\n prim__align\n prim__setAlign\n v\n \n export\n axis : HTMLTableCellElement -> Attribute True I String\n axis v = fromPrim \"HTMLTableCellElement.getaxis\" prim__axis prim__setAxis v\n \n export\n bgColor : HTMLTableCellElement -> Attribute True I String\n bgColor v = fromPrim \"HTMLTableCellElement.getbgColor\"\n prim__bgColor\n prim__setBgColor\n v\n \n export\n cellIndex : (obj : HTMLTableCellElement) -> JSIO Int32\n cellIndex a = primJS $ HTMLTableCellElement.prim__cellIndex a\n \n export\n ch : HTMLTableCellElement -> Attribute True I String\n ch v = fromPrim \"HTMLTableCellElement.getch\" prim__ch prim__setCh v\n \n export\n chOff : HTMLTableCellElement -> Attribute True I String\n chOff v = fromPrim \"HTMLTableCellElement.getchOff\"\n prim__chOff\n prim__setChOff\n v\n \n export\n colSpan : HTMLTableCellElement -> Attribute True I Bits32\n colSpan v = fromPrim \"HTMLTableCellElement.getcolSpan\"\n prim__colSpan\n prim__setColSpan\n v\n \n export\n headers : HTMLTableCellElement -> Attribute True I String\n headers v = fromPrim \"HTMLTableCellElement.getheaders\"\n prim__headers\n prim__setHeaders\n v\n \n export\n height : HTMLTableCellElement -> Attribute True I String\n height v = fromPrim \"HTMLTableCellElement.getheight\"\n prim__height\n prim__setHeight\n v\n \n export\n noWrap : HTMLTableCellElement -> Attribute True I Bool\n noWrap v = fromPrim \"HTMLTableCellElement.getnoWrap\"\n prim__noWrap\n prim__setNoWrap\n v\n \n export\n rowSpan : HTMLTableCellElement -> Attribute True I Bits32\n rowSpan v = fromPrim \"HTMLTableCellElement.getrowSpan\"\n prim__rowSpan\n prim__setRowSpan\n v\n \n export\n scope : HTMLTableCellElement -> Attribute True I String\n scope v = fromPrim \"HTMLTableCellElement.getscope\"\n prim__scope\n prim__setScope\n v\n \n export\n vAlign : HTMLTableCellElement -> Attribute True I String\n vAlign v = fromPrim \"HTMLTableCellElement.getvAlign\"\n prim__vAlign\n prim__setVAlign\n v\n \n export\n width : HTMLTableCellElement -> Attribute True I String\n width v = fromPrim \"HTMLTableCellElement.getwidth\"\n prim__width\n prim__setWidth\n v\n\n\nnamespace HTMLTableColElement\n \n export\n new : JSIO HTMLTableColElement\n new = primJS $ HTMLTableColElement.prim__new \n \n export\n align : HTMLTableColElement -> Attribute True I String\n align v = fromPrim \"HTMLTableColElement.getalign\" prim__align prim__setAlign v\n \n export\n ch : HTMLTableColElement -> Attribute True I String\n ch v = fromPrim \"HTMLTableColElement.getch\" prim__ch prim__setCh v\n \n export\n chOff : HTMLTableColElement -> Attribute True I String\n chOff v = fromPrim \"HTMLTableColElement.getchOff\" prim__chOff prim__setChOff v\n \n export\n span : HTMLTableColElement -> Attribute True I Bits32\n span v = fromPrim \"HTMLTableColElement.getspan\" prim__span prim__setSpan v\n \n export\n vAlign : HTMLTableColElement -> Attribute True I String\n vAlign v = fromPrim \"HTMLTableColElement.getvAlign\"\n prim__vAlign\n prim__setVAlign\n v\n \n export\n width : HTMLTableColElement -> Attribute True I String\n width v = fromPrim \"HTMLTableColElement.getwidth\" prim__width prim__setWidth v\n\n\nnamespace HTMLTableElement\n \n export\n new : JSIO HTMLTableElement\n new = primJS $ HTMLTableElement.prim__new \n \n export\n align : HTMLTableElement -> Attribute True I String\n align v = fromPrim \"HTMLTableElement.getalign\" prim__align prim__setAlign v\n \n export\n bgColor : HTMLTableElement -> Attribute True I String\n bgColor v = fromPrim \"HTMLTableElement.getbgColor\"\n prim__bgColor\n prim__setBgColor\n v\n \n export\n border : HTMLTableElement -> Attribute True I String\n border v = fromPrim \"HTMLTableElement.getborder\"\n prim__border\n prim__setBorder\n v\n \n export\n caption : HTMLTableElement -> Attribute False Maybe HTMLTableCaptionElement\n caption v = fromNullablePrim \"HTMLTableElement.getcaption\"\n prim__caption\n prim__setCaption\n v\n \n export\n cellPadding : HTMLTableElement -> Attribute True I String\n cellPadding v = fromPrim \"HTMLTableElement.getcellPadding\"\n prim__cellPadding\n prim__setCellPadding\n v\n \n export\n cellSpacing : HTMLTableElement -> Attribute True I String\n cellSpacing v = fromPrim \"HTMLTableElement.getcellSpacing\"\n prim__cellSpacing\n prim__setCellSpacing\n v\n \n export\n frame : HTMLTableElement -> Attribute True I String\n frame v = fromPrim \"HTMLTableElement.getframe\" prim__frame prim__setFrame v\n \n export\n rows : (obj : HTMLTableElement) -> JSIO HTMLCollection\n rows a = primJS $ HTMLTableElement.prim__rows a\n \n export\n rules : HTMLTableElement -> Attribute True I String\n rules v = fromPrim \"HTMLTableElement.getrules\" prim__rules prim__setRules v\n \n export\n summary : HTMLTableElement -> Attribute True I String\n summary v = fromPrim \"HTMLTableElement.getsummary\"\n prim__summary\n prim__setSummary\n v\n \n export\n tBodies : (obj : HTMLTableElement) -> JSIO HTMLCollection\n tBodies a = primJS $ HTMLTableElement.prim__tBodies a\n \n export\n tFoot : HTMLTableElement -> Attribute False Maybe HTMLTableSectionElement\n tFoot v = fromNullablePrim \"HTMLTableElement.gettFoot\"\n prim__tFoot\n prim__setTFoot\n v\n \n export\n tHead : HTMLTableElement -> Attribute False Maybe HTMLTableSectionElement\n tHead v = fromNullablePrim \"HTMLTableElement.gettHead\"\n prim__tHead\n prim__setTHead\n v\n \n export\n width : HTMLTableElement -> Attribute True I String\n width v = fromPrim \"HTMLTableElement.getwidth\" prim__width prim__setWidth v\n \n export\n createCaption : (obj : HTMLTableElement) -> JSIO HTMLTableCaptionElement\n createCaption a = primJS $ HTMLTableElement.prim__createCaption a\n \n export\n createTBody : (obj : HTMLTableElement) -> JSIO HTMLTableSectionElement\n createTBody a = primJS $ HTMLTableElement.prim__createTBody a\n \n export\n createTFoot : (obj : HTMLTableElement) -> JSIO HTMLTableSectionElement\n createTFoot a = primJS $ HTMLTableElement.prim__createTFoot a\n \n export\n createTHead : (obj : HTMLTableElement) -> JSIO HTMLTableSectionElement\n createTHead a = primJS $ HTMLTableElement.prim__createTHead a\n \n export\n deleteCaption : (obj : HTMLTableElement) -> JSIO ()\n deleteCaption a = primJS $ HTMLTableElement.prim__deleteCaption a\n \n export\n deleteRow : (obj : HTMLTableElement) -> (index : Int32) -> JSIO ()\n deleteRow a b = primJS $ HTMLTableElement.prim__deleteRow a b\n \n export\n deleteTFoot : (obj : HTMLTableElement) -> JSIO ()\n deleteTFoot a = primJS $ HTMLTableElement.prim__deleteTFoot a\n \n export\n deleteTHead : (obj : HTMLTableElement) -> JSIO ()\n deleteTHead a = primJS $ HTMLTableElement.prim__deleteTHead a\n \n export\n insertRow : (obj : HTMLTableElement)\n -> (index : Optional Int32)\n -> JSIO HTMLTableRowElement\n insertRow a b = primJS $ HTMLTableElement.prim__insertRow a (toFFI b)\n\n export\n insertRow' : (obj : HTMLTableElement) -> JSIO HTMLTableRowElement\n insertRow' a = primJS $ HTMLTableElement.prim__insertRow a undef\n\n\nnamespace HTMLTableRowElement\n \n export\n new : JSIO HTMLTableRowElement\n new = primJS $ HTMLTableRowElement.prim__new \n \n export\n align : HTMLTableRowElement -> Attribute True I String\n align v = fromPrim \"HTMLTableRowElement.getalign\" prim__align prim__setAlign v\n \n export\n bgColor : HTMLTableRowElement -> Attribute True I String\n bgColor v = fromPrim \"HTMLTableRowElement.getbgColor\"\n prim__bgColor\n prim__setBgColor\n v\n \n export\n cells : (obj : HTMLTableRowElement) -> JSIO HTMLCollection\n cells a = primJS $ HTMLTableRowElement.prim__cells a\n \n export\n ch : HTMLTableRowElement -> Attribute True I String\n ch v = fromPrim \"HTMLTableRowElement.getch\" prim__ch prim__setCh v\n \n export\n chOff : HTMLTableRowElement -> Attribute True I String\n chOff v = fromPrim \"HTMLTableRowElement.getchOff\" prim__chOff prim__setChOff v\n \n export\n rowIndex : (obj : HTMLTableRowElement) -> JSIO Int32\n rowIndex a = primJS $ HTMLTableRowElement.prim__rowIndex a\n \n export\n sectionRowIndex : (obj : HTMLTableRowElement) -> JSIO Int32\n sectionRowIndex a = primJS $ HTMLTableRowElement.prim__sectionRowIndex a\n \n export\n vAlign : HTMLTableRowElement -> Attribute True I String\n vAlign v = fromPrim \"HTMLTableRowElement.getvAlign\"\n prim__vAlign\n prim__setVAlign\n v\n \n export\n deleteCell : (obj : HTMLTableRowElement) -> (index : Int32) -> JSIO ()\n deleteCell a b = primJS $ HTMLTableRowElement.prim__deleteCell a b\n \n export\n insertCell : (obj : HTMLTableRowElement)\n -> (index : Optional Int32)\n -> JSIO HTMLTableCellElement\n insertCell a b = primJS $ HTMLTableRowElement.prim__insertCell a (toFFI b)\n\n export\n insertCell' : (obj : HTMLTableRowElement) -> JSIO HTMLTableCellElement\n insertCell' a = primJS $ HTMLTableRowElement.prim__insertCell a undef\n\n\nnamespace HTMLTableSectionElement\n \n export\n new : JSIO HTMLTableSectionElement\n new = primJS $ HTMLTableSectionElement.prim__new \n \n export\n align : HTMLTableSectionElement -> Attribute True I String\n align v = fromPrim \"HTMLTableSectionElement.getalign\"\n prim__align\n prim__setAlign\n v\n \n export\n ch : HTMLTableSectionElement -> Attribute True I String\n ch v = fromPrim \"HTMLTableSectionElement.getch\" prim__ch prim__setCh v\n \n export\n chOff : HTMLTableSectionElement -> Attribute True I String\n chOff v = fromPrim \"HTMLTableSectionElement.getchOff\"\n prim__chOff\n prim__setChOff\n v\n \n export\n rows : (obj : HTMLTableSectionElement) -> JSIO HTMLCollection\n rows a = primJS $ HTMLTableSectionElement.prim__rows a\n \n export\n vAlign : HTMLTableSectionElement -> Attribute True I String\n vAlign v = fromPrim \"HTMLTableSectionElement.getvAlign\"\n prim__vAlign\n prim__setVAlign\n v\n \n export\n deleteRow : (obj : HTMLTableSectionElement) -> (index : Int32) -> JSIO ()\n deleteRow a b = primJS $ HTMLTableSectionElement.prim__deleteRow a b\n \n export\n insertRow : (obj : HTMLTableSectionElement)\n -> (index : Optional Int32)\n -> JSIO HTMLTableRowElement\n insertRow a b = primJS $ HTMLTableSectionElement.prim__insertRow a (toFFI b)\n\n export\n insertRow' : (obj : HTMLTableSectionElement) -> JSIO HTMLTableRowElement\n insertRow' a = primJS $ HTMLTableSectionElement.prim__insertRow a undef\n\n\nnamespace HTMLTemplateElement\n \n export\n new : JSIO HTMLTemplateElement\n new = primJS $ HTMLTemplateElement.prim__new \n \n export\n content : (obj : HTMLTemplateElement) -> JSIO DocumentFragment\n content a = primJS $ HTMLTemplateElement.prim__content a\n\n\nnamespace HTMLTextAreaElement\n \n export\n new : JSIO HTMLTextAreaElement\n new = primJS $ HTMLTextAreaElement.prim__new \n \n export\n autocomplete : HTMLTextAreaElement -> Attribute True I String\n autocomplete v = fromPrim \"HTMLTextAreaElement.getautocomplete\"\n prim__autocomplete\n prim__setAutocomplete\n v\n \n export\n cols : HTMLTextAreaElement -> Attribute True I Bits32\n cols v = fromPrim \"HTMLTextAreaElement.getcols\" prim__cols prim__setCols v\n \n export\n defaultValue : HTMLTextAreaElement -> Attribute True I String\n defaultValue v = fromPrim \"HTMLTextAreaElement.getdefaultValue\"\n prim__defaultValue\n prim__setDefaultValue\n v\n \n export\n dirName : HTMLTextAreaElement -> Attribute True I String\n dirName v = fromPrim \"HTMLTextAreaElement.getdirName\"\n prim__dirName\n prim__setDirName\n v\n \n export\n disabled : HTMLTextAreaElement -> Attribute True I Bool\n disabled v = fromPrim \"HTMLTextAreaElement.getdisabled\"\n prim__disabled\n prim__setDisabled\n v\n \n export\n form : (obj : HTMLTextAreaElement) -> JSIO (Maybe HTMLFormElement)\n form a = tryJS \"HTMLTextAreaElement.form\" $ HTMLTextAreaElement.prim__form a\n \n export\n labels : (obj : HTMLTextAreaElement) -> JSIO NodeList\n labels a = primJS $ HTMLTextAreaElement.prim__labels a\n \n export\n maxLength : HTMLTextAreaElement -> Attribute True I Int32\n maxLength v = fromPrim \"HTMLTextAreaElement.getmaxLength\"\n prim__maxLength\n prim__setMaxLength\n v\n \n export\n minLength : HTMLTextAreaElement -> Attribute True I Int32\n minLength v = fromPrim \"HTMLTextAreaElement.getminLength\"\n prim__minLength\n prim__setMinLength\n v\n \n export\n name : HTMLTextAreaElement -> Attribute True I String\n name v = fromPrim \"HTMLTextAreaElement.getname\" prim__name prim__setName v\n \n export\n placeholder : HTMLTextAreaElement -> Attribute True I String\n placeholder v = fromPrim \"HTMLTextAreaElement.getplaceholder\"\n prim__placeholder\n prim__setPlaceholder\n v\n \n export\n readOnly : HTMLTextAreaElement -> Attribute True I Bool\n readOnly v = fromPrim \"HTMLTextAreaElement.getreadOnly\"\n prim__readOnly\n prim__setReadOnly\n v\n \n export\n required : HTMLTextAreaElement -> Attribute True I Bool\n required v = fromPrim \"HTMLTextAreaElement.getrequired\"\n prim__required\n prim__setRequired\n v\n \n export\n rows : HTMLTextAreaElement -> Attribute True I Bits32\n rows v = fromPrim \"HTMLTextAreaElement.getrows\" prim__rows prim__setRows v\n \n export\n selectionDirection : HTMLTextAreaElement -> Attribute True I String\n selectionDirection v = fromPrim \"HTMLTextAreaElement.getselectionDirection\"\n prim__selectionDirection\n prim__setSelectionDirection\n v\n \n export\n selectionEnd : HTMLTextAreaElement -> Attribute True I Bits32\n selectionEnd v = fromPrim \"HTMLTextAreaElement.getselectionEnd\"\n prim__selectionEnd\n prim__setSelectionEnd\n v\n \n export\n selectionStart : HTMLTextAreaElement -> Attribute True I Bits32\n selectionStart v = fromPrim \"HTMLTextAreaElement.getselectionStart\"\n prim__selectionStart\n prim__setSelectionStart\n v\n \n export\n textLength : (obj : HTMLTextAreaElement) -> JSIO Bits32\n textLength a = primJS $ HTMLTextAreaElement.prim__textLength a\n \n export\n type : (obj : HTMLTextAreaElement) -> JSIO String\n type a = primJS $ HTMLTextAreaElement.prim__type a\n \n export\n validationMessage : (obj : HTMLTextAreaElement) -> JSIO String\n validationMessage a = primJS $ HTMLTextAreaElement.prim__validationMessage a\n \n export\n validity : (obj : HTMLTextAreaElement) -> JSIO ValidityState\n validity a = primJS $ HTMLTextAreaElement.prim__validity a\n \n export\n value : HTMLTextAreaElement -> Attribute True I String\n value v = fromPrim \"HTMLTextAreaElement.getvalue\" prim__value prim__setValue v\n \n export\n willValidate : (obj : HTMLTextAreaElement) -> JSIO Bool\n willValidate a = tryJS \"HTMLTextAreaElement.willValidate\"\n $ HTMLTextAreaElement.prim__willValidate a\n \n export\n wrap : HTMLTextAreaElement -> Attribute True I String\n wrap v = fromPrim \"HTMLTextAreaElement.getwrap\" prim__wrap prim__setWrap v\n \n export\n checkValidity : (obj : HTMLTextAreaElement) -> JSIO Bool\n checkValidity a = tryJS \"HTMLTextAreaElement.checkValidity\"\n $ HTMLTextAreaElement.prim__checkValidity a\n \n export\n reportValidity : (obj : HTMLTextAreaElement) -> JSIO Bool\n reportValidity a = tryJS \"HTMLTextAreaElement.reportValidity\"\n $ HTMLTextAreaElement.prim__reportValidity a\n \n export\n select : (obj : HTMLTextAreaElement) -> JSIO ()\n select a = primJS $ HTMLTextAreaElement.prim__select a\n \n export\n setCustomValidity : (obj : HTMLTextAreaElement) -> (error : String) -> JSIO ()\n setCustomValidity a b = primJS\n $ HTMLTextAreaElement.prim__setCustomValidity a b\n \n export\n setRangeText : (obj : HTMLTextAreaElement)\n -> (replacement : String)\n -> JSIO ()\n setRangeText a b = primJS $ HTMLTextAreaElement.prim__setRangeText a b\n \n export\n setRangeText1 : (obj : HTMLTextAreaElement)\n -> (replacement : String)\n -> (start : Bits32)\n -> (end : Bits32)\n -> (selectionMode : Optional SelectionMode)\n -> JSIO ()\n setRangeText1 a b c d e = primJS\n $ HTMLTextAreaElement.prim__setRangeText1 a\n b\n c\n d\n (toFFI e)\n\n export\n setRangeText1' : (obj : HTMLTextAreaElement)\n -> (replacement : String)\n -> (start : Bits32)\n -> (end : Bits32)\n -> JSIO ()\n setRangeText1' a b c d = primJS\n $ HTMLTextAreaElement.prim__setRangeText1 a b c d undef\n \n export\n setSelectionRange : (obj : HTMLTextAreaElement)\n -> (start : Bits32)\n -> (end : Bits32)\n -> (direction : Optional String)\n -> JSIO ()\n setSelectionRange a b c d = primJS\n $ HTMLTextAreaElement.prim__setSelectionRange a\n b\n c\n (toFFI d)\n\n export\n setSelectionRange' : (obj : HTMLTextAreaElement)\n -> (start : Bits32)\n -> (end : Bits32)\n -> JSIO ()\n setSelectionRange' a b c = primJS\n $ HTMLTextAreaElement.prim__setSelectionRange a\n b\n c\n undef\n\n\nnamespace HTMLTimeElement\n \n export\n new : JSIO HTMLTimeElement\n new = primJS $ HTMLTimeElement.prim__new \n \n export\n dateTime : HTMLTimeElement -> Attribute True I String\n dateTime v = fromPrim \"HTMLTimeElement.getdateTime\"\n prim__dateTime\n prim__setDateTime\n v\n\n\nnamespace HTMLTitleElement\n \n export\n new : JSIO HTMLTitleElement\n new = primJS $ HTMLTitleElement.prim__new \n \n export\n text : HTMLTitleElement -> Attribute True I String\n text v = fromPrim \"HTMLTitleElement.gettext\" prim__text prim__setText v\n\n\nnamespace HTMLTrackElement\n \n public export\n ERROR : Bits16\n ERROR = 3\n \n public export\n LOADED : Bits16\n LOADED = 2\n \n public export\n LOADING : Bits16\n LOADING = 1\n \n public export\n NONE : Bits16\n NONE = 0\n \n export\n new : JSIO HTMLTrackElement\n new = primJS $ HTMLTrackElement.prim__new \n \n export\n default_ : HTMLTrackElement -> Attribute True I Bool\n default_ v = fromPrim \"HTMLTrackElement.getdefault\"\n prim__default\n prim__setDefault\n v\n \n export\n kind : HTMLTrackElement -> Attribute True I String\n kind v = fromPrim \"HTMLTrackElement.getkind\" prim__kind prim__setKind v\n \n export\n label : HTMLTrackElement -> Attribute True I String\n label v = fromPrim \"HTMLTrackElement.getlabel\" prim__label prim__setLabel v\n \n export\n readyState : (obj : HTMLTrackElement) -> JSIO Bits16\n readyState a = primJS $ HTMLTrackElement.prim__readyState a\n \n export\n src : HTMLTrackElement -> Attribute True I String\n src v = fromPrim \"HTMLTrackElement.getsrc\" prim__src prim__setSrc v\n \n export\n srclang : HTMLTrackElement -> Attribute True I String\n srclang v = fromPrim \"HTMLTrackElement.getsrclang\"\n prim__srclang\n prim__setSrclang\n v\n \n export\n track : (obj : HTMLTrackElement) -> JSIO TextTrack\n track a = primJS $ HTMLTrackElement.prim__track a\n\n\nnamespace HTMLUListElement\n \n export\n new : JSIO HTMLUListElement\n new = primJS $ HTMLUListElement.prim__new \n \n export\n compact : HTMLUListElement -> Attribute True I Bool\n compact v = fromPrim \"HTMLUListElement.getcompact\"\n prim__compact\n prim__setCompact\n v\n \n export\n type : HTMLUListElement -> Attribute True I String\n type v = fromPrim \"HTMLUListElement.gettype\" prim__type prim__setType v\n\n\n\nnamespace HTMLVideoElement\n \n export\n new : JSIO HTMLVideoElement\n new = primJS $ HTMLVideoElement.prim__new \n \n export\n height : HTMLVideoElement -> Attribute True I Bits32\n height v = fromPrim \"HTMLVideoElement.getheight\"\n prim__height\n prim__setHeight\n v\n \n export\n playsInline : HTMLVideoElement -> Attribute True I Bool\n playsInline v = fromPrim \"HTMLVideoElement.getplaysInline\"\n prim__playsInline\n prim__setPlaysInline\n v\n \n export\n poster : HTMLVideoElement -> Attribute True I String\n poster v = fromPrim \"HTMLVideoElement.getposter\"\n prim__poster\n prim__setPoster\n v\n \n export\n videoHeight : (obj : HTMLVideoElement) -> JSIO Bits32\n videoHeight a = primJS $ HTMLVideoElement.prim__videoHeight a\n \n export\n videoWidth : (obj : HTMLVideoElement) -> JSIO Bits32\n videoWidth a = primJS $ HTMLVideoElement.prim__videoWidth a\n \n export\n width : HTMLVideoElement -> Attribute True I Bits32\n width v = fromPrim \"HTMLVideoElement.getwidth\" prim__width prim__setWidth v\n\n\nnamespace HashChangeEvent\n \n export\n new : (0 _ : JSType t1)\n => {auto 0 _ : Elem HashChangeEventInit (Types t1)}\n -> (type : String)\n -> (eventInitDict : Optional t1)\n -> JSIO HashChangeEvent\n new a b = primJS $ HashChangeEvent.prim__new a (optUp b)\n\n export\n new' : (type : String) -> JSIO HashChangeEvent\n new' a = primJS $ HashChangeEvent.prim__new a undef\n \n export\n newURL : (obj : HashChangeEvent) -> JSIO String\n newURL a = primJS $ HashChangeEvent.prim__newURL a\n \n export\n oldURL : (obj : HashChangeEvent) -> JSIO String\n oldURL a = primJS $ HashChangeEvent.prim__oldURL a\n\n\nnamespace History\n \n export\n length : (obj : History) -> JSIO Bits32\n length a = primJS $ History.prim__length a\n \n export\n scrollRestoration : History -> Attribute True I ScrollRestoration\n scrollRestoration v = fromPrim \"History.getscrollRestoration\"\n prim__scrollRestoration\n prim__setScrollRestoration\n v\n \n export\n state : (obj : History) -> JSIO Any\n state a = tryJS \"History.state\" $ History.prim__state a\n \n export\n back : (obj : History) -> JSIO ()\n back a = primJS $ History.prim__back a\n \n export\n forward : (obj : History) -> JSIO ()\n forward a = primJS $ History.prim__forward a\n \n export\n go : (obj : History) -> (delta : Optional Int32) -> JSIO ()\n go a b = primJS $ History.prim__go a (toFFI b)\n\n export\n go' : (obj : History) -> JSIO ()\n go' a = primJS $ History.prim__go a undef\n \n export\n pushState : (obj : History)\n -> (data_ : Any)\n -> (unused : String)\n -> (url : Optional (Maybe String))\n -> JSIO ()\n pushState a b c d = primJS $ History.prim__pushState a (toFFI b) c (toFFI d)\n\n export\n pushState' : (obj : History) -> (data_ : Any) -> (unused : String) -> JSIO ()\n pushState' a b c = primJS $ History.prim__pushState a (toFFI b) c undef\n \n export\n replaceState : (obj : History)\n -> (data_ : Any)\n -> (unused : String)\n -> (url : Optional (Maybe String))\n -> JSIO ()\n replaceState a b c d = primJS\n $ History.prim__replaceState a (toFFI b) c (toFFI d)\n\n export\n replaceState' : (obj : History)\n -> (data_ : Any)\n -> (unused : String)\n -> JSIO ()\n replaceState' a b c = primJS $ History.prim__replaceState a (toFFI b) c undef\n\n\nnamespace ImageBitmap\n \n export\n height : (obj : ImageBitmap) -> JSIO Bits32\n height a = primJS $ ImageBitmap.prim__height a\n \n export\n width : (obj : ImageBitmap) -> JSIO Bits32\n width a = primJS $ ImageBitmap.prim__width a\n \n export\n close : (obj : ImageBitmap) -> JSIO ()\n close a = primJS $ ImageBitmap.prim__close a\n\n\nnamespace ImageBitmapRenderingContext\n \n export\n canvas : (obj : ImageBitmapRenderingContext)\n -> JSIO (NS I [ HTMLCanvasElement , OffscreenCanvas ])\n canvas a = tryJS \"ImageBitmapRenderingContext.canvas\"\n $ ImageBitmapRenderingContext.prim__canvas a\n \n export\n transferFromImageBitmap : (obj : ImageBitmapRenderingContext)\n -> (bitmap : Maybe ImageBitmap)\n -> JSIO ()\n transferFromImageBitmap a b = primJS\n $ ImageBitmapRenderingContext.prim__transferFromImageBitmap a\n (toFFI b)\n\n\nnamespace ImageData\n \n export\n new : (sw : Bits32) -> (sh : Bits32) -> JSIO ImageData\n new a b = primJS $ ImageData.prim__new a b\n \n export\n new1 : (data_ : UInt8ClampedArray)\n -> (sw : Bits32)\n -> (sh : Optional Bits32)\n -> JSIO ImageData\n new1 a b c = primJS $ ImageData.prim__new1 a b (toFFI c)\n\n export\n new1' : (data_ : UInt8ClampedArray) -> (sw : Bits32) -> JSIO ImageData\n new1' a b = primJS $ ImageData.prim__new1 a b undef\n \n export\n data_ : (obj : ImageData) -> JSIO UInt8ClampedArray\n data_ a = primJS $ ImageData.prim__data a\n \n export\n height : (obj : ImageData) -> JSIO Bits32\n height a = primJS $ ImageData.prim__height a\n \n export\n width : (obj : ImageData) -> JSIO Bits32\n width a = primJS $ ImageData.prim__width a\n\n\nnamespace Location\n \n export\n ancestorOrigins : (obj : Location) -> JSIO DOMStringList\n ancestorOrigins a = primJS $ Location.prim__ancestorOrigins a\n \n export\n hash : Location -> Attribute True I String\n hash v = fromPrim \"Location.gethash\" prim__hash prim__setHash v\n \n export\n host : Location -> Attribute True I String\n host v = fromPrim \"Location.gethost\" prim__host prim__setHost v\n \n export\n hostname : Location -> Attribute True I String\n hostname v = fromPrim \"Location.gethostname\"\n prim__hostname\n prim__setHostname\n v\n \n export\n href : Location -> Attribute True I String\n href v = fromPrim \"Location.gethref\" prim__href prim__setHref v\n \n export\n origin : (obj : Location) -> JSIO String\n origin a = primJS $ Location.prim__origin a\n \n export\n pathname : Location -> Attribute True I String\n pathname v = fromPrim \"Location.getpathname\"\n prim__pathname\n prim__setPathname\n v\n \n export\n port : Location -> Attribute True I String\n port v = fromPrim \"Location.getport\" prim__port prim__setPort v\n \n export\n protocol : Location -> Attribute True I String\n protocol v = fromPrim \"Location.getprotocol\"\n prim__protocol\n prim__setProtocol\n v\n \n export\n search : Location -> Attribute True I String\n search v = fromPrim \"Location.getsearch\" prim__search prim__setSearch v\n \n export\n assign : (obj : Location) -> (url : String) -> JSIO ()\n assign a b = primJS $ Location.prim__assign a b\n \n export\n reload : (obj : Location) -> JSIO ()\n reload a = primJS $ Location.prim__reload a\n \n export\n replace : (obj : Location) -> (url : String) -> JSIO ()\n replace a b = primJS $ Location.prim__replace a b\n\n\nnamespace MediaError\n \n public export\n MEDIA_ERR_ABORTED : Bits16\n MEDIA_ERR_ABORTED = 1\n \n public export\n MEDIA_ERR_DECODE : Bits16\n MEDIA_ERR_DECODE = 3\n \n public export\n MEDIA_ERR_NETWORK : Bits16\n MEDIA_ERR_NETWORK = 2\n \n public export\n MEDIA_ERR_SRC_NOT_SUPPORTED : Bits16\n MEDIA_ERR_SRC_NOT_SUPPORTED = 4\n \n export\n code : (obj : MediaError) -> JSIO Bits16\n code a = primJS $ MediaError.prim__code a\n \n export\n message : (obj : MediaError) -> JSIO String\n message a = primJS $ MediaError.prim__message a\n\n\nnamespace MessageChannel\n \n export\n new : JSIO MessageChannel\n new = primJS $ MessageChannel.prim__new \n \n export\n port1 : (obj : MessageChannel) -> JSIO MessagePort\n port1 a = primJS $ MessageChannel.prim__port1 a\n \n export\n port2 : (obj : MessageChannel) -> JSIO MessagePort\n port2 a = primJS $ MessageChannel.prim__port2 a\n\n\nnamespace MessageEvent\n \n export\n new : (0 _ : JSType t1)\n => {auto 0 _ : Elem MessageEventInit (Types t1)}\n -> (type : String)\n -> (eventInitDict : Optional t1)\n -> JSIO MessageEvent\n new a b = primJS $ MessageEvent.prim__new a (optUp b)\n\n export\n new' : (type : String) -> JSIO MessageEvent\n new' a = primJS $ MessageEvent.prim__new a undef\n \n export\n data_ : (obj : MessageEvent) -> JSIO Any\n data_ a = tryJS \"MessageEvent.data_\" $ MessageEvent.prim__data a\n \n export\n lastEventId : (obj : MessageEvent) -> JSIO String\n lastEventId a = primJS $ MessageEvent.prim__lastEventId a\n \n export\n origin : (obj : MessageEvent) -> JSIO String\n origin a = primJS $ MessageEvent.prim__origin a\n \n export\n ports : (obj : MessageEvent) -> JSIO (Array MessagePort)\n ports a = primJS $ MessageEvent.prim__ports a\n \n export\n source : (obj : MessageEvent)\n -> JSIO (Maybe (Union3 WindowProxy MessagePort ServiceWorker))\n source a = tryJS \"MessageEvent.source\" $ MessageEvent.prim__source a\n \n export\n initMessageEvent : (obj : MessageEvent)\n -> (type : String)\n -> (bubbles : Optional Bool)\n -> (cancelable : Optional Bool)\n -> (data_ : Optional Any)\n -> (origin : Optional String)\n -> (lastEventId : Optional String)\n -> (source : Optional (Maybe (NS I [ WindowProxy\n , MessagePort\n , ServiceWorker\n ])))\n -> (ports : Optional (Array MessagePort))\n -> JSIO ()\n initMessageEvent a b c d e f g h i = primJS\n $ MessageEvent.prim__initMessageEvent a\n b\n (toFFI c)\n (toFFI d)\n (toFFI e)\n (toFFI f)\n (toFFI g)\n (toFFI h)\n (toFFI i)\n\n export\n initMessageEvent' : (obj : MessageEvent) -> (type : String) -> JSIO ()\n initMessageEvent' a b = primJS\n $ MessageEvent.prim__initMessageEvent a\n b\n undef\n undef\n undef\n undef\n undef\n undef\n undef\n\n\nnamespace MessagePort\n \n export\n onmessage : MessagePort -> Attribute False Maybe EventHandlerNonNull\n onmessage v = fromNullablePrim \"MessagePort.getonmessage\"\n prim__onmessage\n prim__setOnmessage\n v\n \n export\n onmessageerror : MessagePort -> Attribute False Maybe EventHandlerNonNull\n onmessageerror v = fromNullablePrim \"MessagePort.getonmessageerror\"\n prim__onmessageerror\n prim__setOnmessageerror\n v\n \n export\n close : (obj : MessagePort) -> JSIO ()\n close a = primJS $ MessagePort.prim__close a\n \n export\n postMessage : (obj : MessagePort)\n -> (message : Any)\n -> (transfer : Array Object)\n -> JSIO ()\n postMessage a b c = primJS $ MessagePort.prim__postMessage a (toFFI b) c\n \n export\n postMessage1 : (0 _ : JSType t1)\n => {auto 0 _ : Elem PostMessageOptions (Types t1)}\n -> (obj : MessagePort)\n -> (message : Any)\n -> (options : Optional t1)\n -> JSIO ()\n postMessage1 a b c = primJS\n $ MessagePort.prim__postMessage1 a (toFFI b) (optUp c)\n\n export\n postMessage1' : (obj : MessagePort) -> (message : Any) -> JSIO ()\n postMessage1' a b = primJS $ MessagePort.prim__postMessage1 a (toFFI b) undef\n \n export\n start : (obj : MessagePort) -> JSIO ()\n start a = primJS $ MessagePort.prim__start a\n\n\nnamespace MimeType\n \n export\n description : (obj : MimeType) -> JSIO ()\n description a = primJS $ MimeType.prim__description a\n \n export\n enabledPlugin : (obj : MimeType) -> JSIO ()\n enabledPlugin a = primJS $ MimeType.prim__enabledPlugin a\n \n export\n suffixes : (obj : MimeType) -> JSIO ()\n suffixes a = primJS $ MimeType.prim__suffixes a\n \n export\n type : (obj : MimeType) -> JSIO ()\n type a = primJS $ MimeType.prim__type a\n\n\nnamespace MimeTypeArray\n \n export\n length : (obj : MimeTypeArray) -> JSIO Bits32\n length a = primJS $ MimeTypeArray.prim__length a\n \n export\n item : (obj : MimeTypeArray) -> (index : Bits32) -> JSIO (Maybe Object)\n item a b = tryJS \"MimeTypeArray.item\" $ MimeTypeArray.prim__item a b\n \n export\n namedItem : (obj : MimeTypeArray) -> (name : String) -> JSIO (Maybe Object)\n namedItem a b = tryJS \"MimeTypeArray.namedItem\"\n $ MimeTypeArray.prim__namedItem a b\n\n\nnamespace Navigator\n \n export\n clipboard : (obj : Navigator) -> JSIO Clipboard\n clipboard a = primJS $ Navigator.prim__clipboard a\n \n export\n mediaDevices : (obj : Navigator) -> JSIO MediaDevices\n mediaDevices a = primJS $ Navigator.prim__mediaDevices a\n \n export\n permissions : (obj : Navigator) -> JSIO Permissions\n permissions a = primJS $ Navigator.prim__permissions a\n \n export\n serviceWorker : (obj : Navigator) -> JSIO ServiceWorkerContainer\n serviceWorker a = primJS $ Navigator.prim__serviceWorker a\n \n export\n getUserMedia : (0 _ : JSType t1)\n => {auto 0 _ : Elem MediaStreamConstraints (Types t1)}\n -> (obj : Navigator)\n -> (constraints : t1)\n -> (successCallback : NavigatorUserMediaSuccessCallback)\n -> (errorCallback : NavigatorUserMediaErrorCallback)\n -> JSIO ()\n getUserMedia a b c d = primJS $ Navigator.prim__getUserMedia a (up b) c d\n\n\nnamespace OffscreenCanvas\n \n export\n new : (width : JSBits64) -> (height : JSBits64) -> JSIO OffscreenCanvas\n new a b = primJS $ OffscreenCanvas.prim__new a b\n \n export\n height : OffscreenCanvas -> Attribute True I JSBits64\n height v = fromPrim \"OffscreenCanvas.getheight\" prim__height prim__setHeight v\n \n export\n width : OffscreenCanvas -> Attribute True I JSBits64\n width v = fromPrim \"OffscreenCanvas.getwidth\" prim__width prim__setWidth v\n \n export\n convertToBlob : (0 _ : JSType t1)\n => {auto 0 _ : Elem ImageEncodeOptions (Types t1)}\n -> (obj : OffscreenCanvas)\n -> (options : Optional t1)\n -> JSIO (Promise Blob)\n convertToBlob a b = primJS $ OffscreenCanvas.prim__convertToBlob a (optUp b)\n\n export\n convertToBlob' : (obj : OffscreenCanvas) -> JSIO (Promise Blob)\n convertToBlob' a = primJS $ OffscreenCanvas.prim__convertToBlob a undef\n \n export\n getContext : (obj : OffscreenCanvas)\n -> (contextId : OffscreenRenderingContextId)\n -> (options : Optional Any)\n -> JSIO (Maybe (NS I [ OffscreenCanvasRenderingContext2D\n , ImageBitmapRenderingContext\n , WebGLRenderingContext\n , WebGL2RenderingContext\n ]))\n getContext a b c = tryJS \"OffscreenCanvas.getContext\"\n $ OffscreenCanvas.prim__getContext a (toFFI b) (toFFI c)\n\n export\n getContext' : (obj : OffscreenCanvas)\n -> (contextId : OffscreenRenderingContextId)\n -> JSIO (Maybe (NS I [ OffscreenCanvasRenderingContext2D\n , ImageBitmapRenderingContext\n , WebGLRenderingContext\n , WebGL2RenderingContext\n ]))\n getContext' a b = tryJS \"OffscreenCanvas.getContext'\"\n $ OffscreenCanvas.prim__getContext a (toFFI b) undef\n \n export\n transferToImageBitmap : (obj : OffscreenCanvas) -> JSIO ImageBitmap\n transferToImageBitmap a = primJS\n $ OffscreenCanvas.prim__transferToImageBitmap a\n\n\nnamespace OffscreenCanvasRenderingContext2D\n \n export\n canvas : (obj : OffscreenCanvasRenderingContext2D) -> JSIO OffscreenCanvas\n canvas a = primJS $ OffscreenCanvasRenderingContext2D.prim__canvas a\n \n export\n commit : (obj : OffscreenCanvasRenderingContext2D) -> JSIO ()\n commit a = primJS $ OffscreenCanvasRenderingContext2D.prim__commit a\n\n\nnamespace PageTransitionEvent\n \n export\n new : (0 _ : JSType t1)\n => {auto 0 _ : Elem PageTransitionEventInit (Types t1)}\n -> (type : String)\n -> (eventInitDict : Optional t1)\n -> JSIO PageTransitionEvent\n new a b = primJS $ PageTransitionEvent.prim__new a (optUp b)\n\n export\n new' : (type : String) -> JSIO PageTransitionEvent\n new' a = primJS $ PageTransitionEvent.prim__new a undef\n \n export\n persisted : (obj : PageTransitionEvent) -> JSIO Bool\n persisted a = tryJS \"PageTransitionEvent.persisted\"\n $ PageTransitionEvent.prim__persisted a\n\n\nnamespace Path2D\n \n export\n new : (path : Optional (NS I [ Path2D , String ])) -> JSIO Path2D\n new a = primJS $ Path2D.prim__new (toFFI a)\n\n export\n new' : JSIO Path2D\n new' = primJS $ Path2D.prim__new undef\n \n export\n addPath : (0 _ : JSType t1)\n => {auto 0 _ : Elem DOMMatrix2DInit (Types t1)}\n -> (obj : Path2D)\n -> (path : Path2D)\n -> (transform : Optional t1)\n -> JSIO ()\n addPath a b c = primJS $ Path2D.prim__addPath a b (optUp c)\n\n export\n addPath' : (obj : Path2D) -> (path : Path2D) -> JSIO ()\n addPath' a b = primJS $ Path2D.prim__addPath a b undef\n\n\nnamespace Plugin\n \n export\n description : (obj : Plugin) -> JSIO ()\n description a = primJS $ Plugin.prim__description a\n \n export\n filename : (obj : Plugin) -> JSIO ()\n filename a = primJS $ Plugin.prim__filename a\n \n export\n length : (obj : Plugin) -> JSIO ()\n length a = primJS $ Plugin.prim__length a\n \n export\n name : (obj : Plugin) -> JSIO ()\n name a = primJS $ Plugin.prim__name a\n \n export\n item : (obj : Plugin) -> (index : Bits32) -> JSIO ()\n item a b = primJS $ Plugin.prim__item a b\n \n export\n namedItem : (obj : Plugin) -> (name : String) -> JSIO ()\n namedItem a b = primJS $ Plugin.prim__namedItem a b\n\n\nnamespace PluginArray\n \n export\n length : (obj : PluginArray) -> JSIO Bits32\n length a = primJS $ PluginArray.prim__length a\n \n export\n item : (obj : PluginArray) -> (index : Bits32) -> JSIO (Maybe Object)\n item a b = tryJS \"PluginArray.item\" $ PluginArray.prim__item a b\n \n export\n namedItem : (obj : PluginArray) -> (name : String) -> JSIO (Maybe Object)\n namedItem a b = tryJS \"PluginArray.namedItem\"\n $ PluginArray.prim__namedItem a b\n \n export\n refresh : (obj : PluginArray) -> JSIO ()\n refresh a = primJS $ PluginArray.prim__refresh a\n\n\nnamespace PopStateEvent\n \n export\n new : (0 _ : JSType t1)\n => {auto 0 _ : Elem PopStateEventInit (Types t1)}\n -> (type : String)\n -> (eventInitDict : Optional t1)\n -> JSIO PopStateEvent\n new a b = primJS $ PopStateEvent.prim__new a (optUp b)\n\n export\n new' : (type : String) -> JSIO PopStateEvent\n new' a = primJS $ PopStateEvent.prim__new a undef\n \n export\n state : (obj : PopStateEvent) -> JSIO Any\n state a = tryJS \"PopStateEvent.state\" $ PopStateEvent.prim__state a\n\n\nnamespace PromiseRejectionEvent\n \n export\n new : (0 _ : JSType t1)\n => {auto 0 _ : Elem PromiseRejectionEventInit (Types t1)}\n -> (type : String)\n -> (eventInitDict : t1)\n -> JSIO PromiseRejectionEvent\n new a b = primJS $ PromiseRejectionEvent.prim__new a (up b)\n \n export\n promise : (obj : PromiseRejectionEvent) -> JSIO (Promise AnyPtr)\n promise a = primJS $ PromiseRejectionEvent.prim__promise a\n \n export\n reason : (obj : PromiseRejectionEvent) -> JSIO Any\n reason a = tryJS \"PromiseRejectionEvent.reason\"\n $ PromiseRejectionEvent.prim__reason a\n\n\nnamespace RadioNodeList\n \n export\n value : RadioNodeList -> Attribute True I String\n value v = fromPrim \"RadioNodeList.getvalue\" prim__value prim__setValue v\n\n\nnamespace SharedWorker\n \n export\n new : (scriptURL : String)\n -> (options : Optional (NS I [ String , WorkerOptions ]))\n -> JSIO SharedWorker\n new a b = primJS $ SharedWorker.prim__new a (toFFI b)\n\n export\n new' : (scriptURL : String) -> JSIO SharedWorker\n new' a = primJS $ SharedWorker.prim__new a undef\n \n export\n port : (obj : SharedWorker) -> JSIO MessagePort\n port a = primJS $ SharedWorker.prim__port a\n\n\nnamespace SharedWorkerGlobalScope\n \n export\n name : (obj : SharedWorkerGlobalScope) -> JSIO String\n name a = primJS $ SharedWorkerGlobalScope.prim__name a\n \n export\n onconnect : SharedWorkerGlobalScope\n -> Attribute False Maybe EventHandlerNonNull\n onconnect v = fromNullablePrim \"SharedWorkerGlobalScope.getonconnect\"\n prim__onconnect\n prim__setOnconnect\n v\n \n export\n close : (obj : SharedWorkerGlobalScope) -> JSIO ()\n close a = primJS $ SharedWorkerGlobalScope.prim__close a\n\n\nnamespace Storage\n \n export\n length : (obj : Storage) -> JSIO Bits32\n length a = primJS $ Storage.prim__length a\n \n export\n clear : (obj : Storage) -> JSIO ()\n clear a = primJS $ Storage.prim__clear a\n \n export\n getItem : (obj : Storage) -> (key : String) -> JSIO (Maybe String)\n getItem a b = tryJS \"Storage.getItem\" $ Storage.prim__getItem a b\n \n export\n key : (obj : Storage) -> (index : Bits32) -> JSIO (Maybe String)\n key a b = tryJS \"Storage.key\" $ Storage.prim__key a b\n \n export\n setItem : (obj : Storage) -> (key : String) -> (value : String) -> JSIO ()\n setItem a b c = primJS $ Storage.prim__setItem a b c\n\n\nnamespace StorageEvent\n \n export\n new : (0 _ : JSType t1)\n => {auto 0 _ : Elem StorageEventInit (Types t1)}\n -> (type : String)\n -> (eventInitDict : Optional t1)\n -> JSIO StorageEvent\n new a b = primJS $ StorageEvent.prim__new a (optUp b)\n\n export\n new' : (type : String) -> JSIO StorageEvent\n new' a = primJS $ StorageEvent.prim__new a undef\n \n export\n key : (obj : StorageEvent) -> JSIO (Maybe String)\n key a = tryJS \"StorageEvent.key\" $ StorageEvent.prim__key a\n \n export\n newValue : (obj : StorageEvent) -> JSIO (Maybe String)\n newValue a = tryJS \"StorageEvent.newValue\" $ StorageEvent.prim__newValue a\n \n export\n oldValue : (obj : StorageEvent) -> JSIO (Maybe String)\n oldValue a = tryJS \"StorageEvent.oldValue\" $ StorageEvent.prim__oldValue a\n \n export\n storageArea : (obj : StorageEvent) -> JSIO (Maybe Storage)\n storageArea a = tryJS \"StorageEvent.storageArea\"\n $ StorageEvent.prim__storageArea a\n \n export\n url : (obj : StorageEvent) -> JSIO String\n url a = primJS $ StorageEvent.prim__url a\n \n export\n initStorageEvent : (obj : StorageEvent)\n -> (type : String)\n -> (bubbles : Optional Bool)\n -> (cancelable : Optional Bool)\n -> (key : Optional (Maybe String))\n -> (oldValue : Optional (Maybe String))\n -> (newValue : Optional (Maybe String))\n -> (url : Optional String)\n -> (storageArea : Optional (Maybe Storage))\n -> JSIO ()\n initStorageEvent a b c d e f g h i = primJS\n $ StorageEvent.prim__initStorageEvent a\n b\n (toFFI c)\n (toFFI d)\n (toFFI e)\n (toFFI f)\n (toFFI g)\n (toFFI h)\n (toFFI i)\n\n export\n initStorageEvent' : (obj : StorageEvent) -> (type : String) -> JSIO ()\n initStorageEvent' a b = primJS\n $ StorageEvent.prim__initStorageEvent a\n b\n undef\n undef\n undef\n undef\n undef\n undef\n undef\n\n\nnamespace SubmitEvent\n \n export\n new : (0 _ : JSType t1)\n => {auto 0 _ : Elem SubmitEventInit (Types t1)}\n -> (type : String)\n -> (eventInitDict : Optional t1)\n -> JSIO SubmitEvent\n new a b = primJS $ SubmitEvent.prim__new a (optUp b)\n\n export\n new' : (type : String) -> JSIO SubmitEvent\n new' a = primJS $ SubmitEvent.prim__new a undef\n \n export\n submitter : (obj : SubmitEvent) -> JSIO (Maybe HTMLElement)\n submitter a = tryJS \"SubmitEvent.submitter\" $ SubmitEvent.prim__submitter a\n\n\nnamespace TextMetrics\n \n export\n actualBoundingBoxAscent : (obj : TextMetrics) -> JSIO Double\n actualBoundingBoxAscent a = primJS\n $ TextMetrics.prim__actualBoundingBoxAscent a\n \n export\n actualBoundingBoxDescent : (obj : TextMetrics) -> JSIO Double\n actualBoundingBoxDescent a = primJS\n $ TextMetrics.prim__actualBoundingBoxDescent a\n \n export\n actualBoundingBoxLeft : (obj : TextMetrics) -> JSIO Double\n actualBoundingBoxLeft a = primJS $ TextMetrics.prim__actualBoundingBoxLeft a\n \n export\n actualBoundingBoxRight : (obj : TextMetrics) -> JSIO Double\n actualBoundingBoxRight a = primJS $ TextMetrics.prim__actualBoundingBoxRight a\n \n export\n alphabeticBaseline : (obj : TextMetrics) -> JSIO Double\n alphabeticBaseline a = primJS $ TextMetrics.prim__alphabeticBaseline a\n \n export\n emHeightAscent : (obj : TextMetrics) -> JSIO Double\n emHeightAscent a = primJS $ TextMetrics.prim__emHeightAscent a\n \n export\n emHeightDescent : (obj : TextMetrics) -> JSIO Double\n emHeightDescent a = primJS $ TextMetrics.prim__emHeightDescent a\n \n export\n fontBoundingBoxAscent : (obj : TextMetrics) -> JSIO Double\n fontBoundingBoxAscent a = primJS $ TextMetrics.prim__fontBoundingBoxAscent a\n \n export\n fontBoundingBoxDescent : (obj : TextMetrics) -> JSIO Double\n fontBoundingBoxDescent a = primJS $ TextMetrics.prim__fontBoundingBoxDescent a\n \n export\n hangingBaseline : (obj : TextMetrics) -> JSIO Double\n hangingBaseline a = primJS $ TextMetrics.prim__hangingBaseline a\n \n export\n ideographicBaseline : (obj : TextMetrics) -> JSIO Double\n ideographicBaseline a = primJS $ TextMetrics.prim__ideographicBaseline a\n \n export\n width : (obj : TextMetrics) -> JSIO Double\n width a = primJS $ TextMetrics.prim__width a\n\n\nnamespace TextTrack\n \n export\n activeCues : (obj : TextTrack) -> JSIO (Maybe TextTrackCueList)\n activeCues a = tryJS \"TextTrack.activeCues\" $ TextTrack.prim__activeCues a\n \n export\n cues : (obj : TextTrack) -> JSIO (Maybe TextTrackCueList)\n cues a = tryJS \"TextTrack.cues\" $ TextTrack.prim__cues a\n \n export\n id : (obj : TextTrack) -> JSIO String\n id a = primJS $ TextTrack.prim__id a\n \n export\n inBandMetadataTrackDispatchType : (obj : TextTrack) -> JSIO String\n inBandMetadataTrackDispatchType a = primJS\n $ TextTrack.prim__inBandMetadataTrackDispatchType a\n \n export\n kind : (obj : TextTrack) -> JSIO TextTrackKind\n kind a = tryJS \"TextTrack.kind\" $ TextTrack.prim__kind a\n \n export\n label : (obj : TextTrack) -> JSIO String\n label a = primJS $ TextTrack.prim__label a\n \n export\n language : (obj : TextTrack) -> JSIO String\n language a = primJS $ TextTrack.prim__language a\n \n export\n mode : TextTrack -> Attribute True I TextTrackMode\n mode v = fromPrim \"TextTrack.getmode\" prim__mode prim__setMode v\n \n export\n oncuechange : TextTrack -> Attribute False Maybe EventHandlerNonNull\n oncuechange v = fromNullablePrim \"TextTrack.getoncuechange\"\n prim__oncuechange\n prim__setOncuechange\n v\n \n export\n sourceBuffer : (obj : TextTrack) -> JSIO (Maybe SourceBuffer)\n sourceBuffer a = tryJS \"TextTrack.sourceBuffer\"\n $ TextTrack.prim__sourceBuffer a\n \n export\n addCue : (obj : TextTrack) -> (cue : TextTrackCue) -> JSIO ()\n addCue a b = primJS $ TextTrack.prim__addCue a b\n \n export\n removeCue : (obj : TextTrack) -> (cue : TextTrackCue) -> JSIO ()\n removeCue a b = primJS $ TextTrack.prim__removeCue a b\n\n\nnamespace TextTrackCue\n \n export\n endTime : TextTrackCue -> Attribute True I Double\n endTime v = fromPrim \"TextTrackCue.getendTime\"\n prim__endTime\n prim__setEndTime\n v\n \n export\n id : TextTrackCue -> Attribute True I String\n id v = fromPrim \"TextTrackCue.getid\" prim__id prim__setId v\n \n export\n onenter : TextTrackCue -> Attribute False Maybe EventHandlerNonNull\n onenter v = fromNullablePrim \"TextTrackCue.getonenter\"\n prim__onenter\n prim__setOnenter\n v\n \n export\n onexit : TextTrackCue -> Attribute False Maybe EventHandlerNonNull\n onexit v = fromNullablePrim \"TextTrackCue.getonexit\"\n prim__onexit\n prim__setOnexit\n v\n \n export\n pauseOnExit : TextTrackCue -> Attribute True I Bool\n pauseOnExit v = fromPrim \"TextTrackCue.getpauseOnExit\"\n prim__pauseOnExit\n prim__setPauseOnExit\n v\n \n export\n startTime : TextTrackCue -> Attribute True I Double\n startTime v = fromPrim \"TextTrackCue.getstartTime\"\n prim__startTime\n prim__setStartTime\n v\n \n export\n track : (obj : TextTrackCue) -> JSIO (Maybe TextTrack)\n track a = tryJS \"TextTrackCue.track\" $ TextTrackCue.prim__track a\n\n\nnamespace TextTrackCueList\n \n export\n get : (obj : TextTrackCueList) -> (index : Bits32) -> JSIO TextTrackCue\n get a b = primJS $ TextTrackCueList.prim__get a b\n \n export\n length : (obj : TextTrackCueList) -> JSIO Bits32\n length a = primJS $ TextTrackCueList.prim__length a\n \n export\n getCueById : (obj : TextTrackCueList)\n -> (id : String)\n -> JSIO (Maybe TextTrackCue)\n getCueById a b = tryJS \"TextTrackCueList.getCueById\"\n $ TextTrackCueList.prim__getCueById a b\n\n\nnamespace TextTrackList\n \n export\n get : (obj : TextTrackList) -> (index : Bits32) -> JSIO TextTrack\n get a b = primJS $ TextTrackList.prim__get a b\n \n export\n length : (obj : TextTrackList) -> JSIO Bits32\n length a = primJS $ TextTrackList.prim__length a\n \n export\n onaddtrack : TextTrackList -> Attribute False Maybe EventHandlerNonNull\n onaddtrack v = fromNullablePrim \"TextTrackList.getonaddtrack\"\n prim__onaddtrack\n prim__setOnaddtrack\n v\n \n export\n onchange : TextTrackList -> Attribute False Maybe EventHandlerNonNull\n onchange v = fromNullablePrim \"TextTrackList.getonchange\"\n prim__onchange\n prim__setOnchange\n v\n \n export\n onremovetrack : TextTrackList -> Attribute False Maybe EventHandlerNonNull\n onremovetrack v = fromNullablePrim \"TextTrackList.getonremovetrack\"\n prim__onremovetrack\n prim__setOnremovetrack\n v\n \n export\n getTrackById : (obj : TextTrackList)\n -> (id : String)\n -> JSIO (Maybe TextTrack)\n getTrackById a b = tryJS \"TextTrackList.getTrackById\"\n $ TextTrackList.prim__getTrackById a b\n\n\nnamespace TimeRanges\n \n export\n length : (obj : TimeRanges) -> JSIO Bits32\n length a = primJS $ TimeRanges.prim__length a\n \n export\n end : (obj : TimeRanges) -> (index : Bits32) -> JSIO Double\n end a b = primJS $ TimeRanges.prim__end a b\n \n export\n start : (obj : TimeRanges) -> (index : Bits32) -> JSIO Double\n start a b = primJS $ TimeRanges.prim__start a b\n\n\nnamespace TrackEvent\n \n export\n new : (0 _ : JSType t1)\n => {auto 0 _ : Elem TrackEventInit (Types t1)}\n -> (type : String)\n -> (eventInitDict : Optional t1)\n -> JSIO TrackEvent\n new a b = primJS $ TrackEvent.prim__new a (optUp b)\n\n export\n new' : (type : String) -> JSIO TrackEvent\n new' a = primJS $ TrackEvent.prim__new a undef\n \n export\n track : (obj : TrackEvent)\n -> JSIO (Maybe (NS I [ VideoTrack , AudioTrack , TextTrack ]))\n track a = tryJS \"TrackEvent.track\" $ TrackEvent.prim__track a\n\n\nnamespace ValidityState\n \n export\n badInput : (obj : ValidityState) -> JSIO Bool\n badInput a = tryJS \"ValidityState.badInput\" $ ValidityState.prim__badInput a\n \n export\n customError : (obj : ValidityState) -> JSIO Bool\n customError a = tryJS \"ValidityState.customError\"\n $ ValidityState.prim__customError a\n \n export\n patternMismatch : (obj : ValidityState) -> JSIO Bool\n patternMismatch a = tryJS \"ValidityState.patternMismatch\"\n $ ValidityState.prim__patternMismatch a\n \n export\n rangeOverflow : (obj : ValidityState) -> JSIO Bool\n rangeOverflow a = tryJS \"ValidityState.rangeOverflow\"\n $ ValidityState.prim__rangeOverflow a\n \n export\n rangeUnderflow : (obj : ValidityState) -> JSIO Bool\n rangeUnderflow a = tryJS \"ValidityState.rangeUnderflow\"\n $ ValidityState.prim__rangeUnderflow a\n \n export\n stepMismatch : (obj : ValidityState) -> JSIO Bool\n stepMismatch a = tryJS \"ValidityState.stepMismatch\"\n $ ValidityState.prim__stepMismatch a\n \n export\n tooLong : (obj : ValidityState) -> JSIO Bool\n tooLong a = tryJS \"ValidityState.tooLong\" $ ValidityState.prim__tooLong a\n \n export\n tooShort : (obj : ValidityState) -> JSIO Bool\n tooShort a = tryJS \"ValidityState.tooShort\" $ ValidityState.prim__tooShort a\n \n export\n typeMismatch : (obj : ValidityState) -> JSIO Bool\n typeMismatch a = tryJS \"ValidityState.typeMismatch\"\n $ ValidityState.prim__typeMismatch a\n \n export\n valid : (obj : ValidityState) -> JSIO Bool\n valid a = tryJS \"ValidityState.valid\" $ ValidityState.prim__valid a\n \n export\n valueMissing : (obj : ValidityState) -> JSIO Bool\n valueMissing a = tryJS \"ValidityState.valueMissing\"\n $ ValidityState.prim__valueMissing a\n\n\nnamespace VideoTrack\n \n export\n id : (obj : VideoTrack) -> JSIO String\n id a = primJS $ VideoTrack.prim__id a\n \n export\n kind : (obj : VideoTrack) -> JSIO String\n kind a = primJS $ VideoTrack.prim__kind a\n \n export\n label : (obj : VideoTrack) -> JSIO String\n label a = primJS $ VideoTrack.prim__label a\n \n export\n language : (obj : VideoTrack) -> JSIO String\n language a = primJS $ VideoTrack.prim__language a\n \n export\n selected : VideoTrack -> Attribute True I Bool\n selected v = fromPrim \"VideoTrack.getselected\"\n prim__selected\n prim__setSelected\n v\n \n export\n sourceBuffer : (obj : VideoTrack) -> JSIO (Maybe SourceBuffer)\n sourceBuffer a = tryJS \"VideoTrack.sourceBuffer\"\n $ VideoTrack.prim__sourceBuffer a\n\n\nnamespace VideoTrackList\n \n export\n get : (obj : VideoTrackList) -> (index : Bits32) -> JSIO VideoTrack\n get a b = primJS $ VideoTrackList.prim__get a b\n \n export\n length : (obj : VideoTrackList) -> JSIO Bits32\n length a = primJS $ VideoTrackList.prim__length a\n \n export\n onaddtrack : VideoTrackList -> Attribute False Maybe EventHandlerNonNull\n onaddtrack v = fromNullablePrim \"VideoTrackList.getonaddtrack\"\n prim__onaddtrack\n prim__setOnaddtrack\n v\n \n export\n onchange : VideoTrackList -> Attribute False Maybe EventHandlerNonNull\n onchange v = fromNullablePrim \"VideoTrackList.getonchange\"\n prim__onchange\n prim__setOnchange\n v\n \n export\n onremovetrack : VideoTrackList -> Attribute False Maybe EventHandlerNonNull\n onremovetrack v = fromNullablePrim \"VideoTrackList.getonremovetrack\"\n prim__onremovetrack\n prim__setOnremovetrack\n v\n \n export\n selectedIndex : (obj : VideoTrackList) -> JSIO Int32\n selectedIndex a = primJS $ VideoTrackList.prim__selectedIndex a\n \n export\n getTrackById : (obj : VideoTrackList)\n -> (id : String)\n -> JSIO (Maybe VideoTrack)\n getTrackById a b = tryJS \"VideoTrackList.getTrackById\"\n $ VideoTrackList.prim__getTrackById a b\n\n\nnamespace WebSocket\n \n public export\n CLOSED : Bits16\n CLOSED = 3\n \n public export\n CLOSING : Bits16\n CLOSING = 2\n \n public export\n CONNECTING : Bits16\n CONNECTING = 0\n \n public export\n OPEN : Bits16\n OPEN = 1\n \n export\n new : (url : String)\n -> (protocols : Optional (NS I [ String , Array String ]))\n -> JSIO WebSocket\n new a b = primJS $ WebSocket.prim__new a (toFFI b)\n\n export\n new' : (url : String) -> JSIO WebSocket\n new' a = primJS $ WebSocket.prim__new a undef\n \n export\n binaryType : WebSocket -> Attribute True I BinaryType\n binaryType v = fromPrim \"WebSocket.getbinaryType\"\n prim__binaryType\n prim__setBinaryType\n v\n \n export\n bufferedAmount : (obj : WebSocket) -> JSIO JSBits64\n bufferedAmount a = primJS $ WebSocket.prim__bufferedAmount a\n \n export\n extensions : (obj : WebSocket) -> JSIO String\n extensions a = primJS $ WebSocket.prim__extensions a\n \n export\n onclose : WebSocket -> Attribute False Maybe EventHandlerNonNull\n onclose v = fromNullablePrim \"WebSocket.getonclose\"\n prim__onclose\n prim__setOnclose\n v\n \n export\n onerror : WebSocket -> Attribute False Maybe EventHandlerNonNull\n onerror v = fromNullablePrim \"WebSocket.getonerror\"\n prim__onerror\n prim__setOnerror\n v\n \n export\n onmessage : WebSocket -> Attribute False Maybe EventHandlerNonNull\n onmessage v = fromNullablePrim \"WebSocket.getonmessage\"\n prim__onmessage\n prim__setOnmessage\n v\n \n export\n onopen : WebSocket -> Attribute False Maybe EventHandlerNonNull\n onopen v = fromNullablePrim \"WebSocket.getonopen\"\n prim__onopen\n prim__setOnopen\n v\n \n export\n protocol : (obj : WebSocket) -> JSIO String\n protocol a = primJS $ WebSocket.prim__protocol a\n \n export\n readyState : (obj : WebSocket) -> JSIO Bits16\n readyState a = primJS $ WebSocket.prim__readyState a\n \n export\n url : (obj : WebSocket) -> JSIO String\n url a = primJS $ WebSocket.prim__url a\n \n export\n close : (obj : WebSocket)\n -> (code : Optional Bits16)\n -> (reason : Optional String)\n -> JSIO ()\n close a b c = primJS $ WebSocket.prim__close a (toFFI b) (toFFI c)\n\n export\n close' : (obj : WebSocket) -> JSIO ()\n close' a = primJS $ WebSocket.prim__close a undef undef\n \n export\n send : (obj : WebSocket) -> (data_ : String) -> JSIO ()\n send a b = primJS $ WebSocket.prim__send a b\n \n export\n send1 : (0 _ : JSType t1)\n => {auto 0 _ : Elem Blob (Types t1)}\n -> (obj : WebSocket)\n -> (data_ : t1)\n -> JSIO ()\n send1 a b = primJS $ WebSocket.prim__send1 a (up b)\n \n export\n send2 : (obj : WebSocket) -> (data_ : ArrayBuffer) -> JSIO ()\n send2 a b = primJS $ WebSocket.prim__send2 a b\n \n export\n send3 : (obj : WebSocket)\n -> (data_ : NS I [ Int8Array\n , Int16Array\n , Int32Array\n , UInt8Array\n , UInt8Array\n , UInt8Array\n , UInt8ClampedArray\n , Float32Array\n , Float64Array\n , DataView\n ])\n -> JSIO ()\n send3 a b = primJS $ WebSocket.prim__send3 a (toFFI b)\n\n\nnamespace Window\n \n export\n get : (obj : Window) -> (name : String) -> JSIO Object\n get a b = primJS $ Window.prim__get a b\n \n export\n closed : (obj : Window) -> JSIO Bool\n closed a = tryJS \"Window.closed\" $ Window.prim__closed a\n \n export\n customElements : (obj : Window) -> JSIO CustomElementRegistry\n customElements a = primJS $ Window.prim__customElements a\n \n export\n document : (obj : Window) -> JSIO Document\n document a = primJS $ Window.prim__document a\n \n export\n event : (obj : Window) -> JSIO (NS I [ Event , Undefined ])\n event a = tryJS \"Window.event\" $ Window.prim__event a\n \n export\n external : (obj : Window) -> JSIO External\n external a = primJS $ Window.prim__external a\n \n export\n frameElement : (obj : Window) -> JSIO (Maybe Element)\n frameElement a = tryJS \"Window.frameElement\" $ Window.prim__frameElement a\n \n export\n frames : (obj : Window) -> JSIO WindowProxy\n frames a = primJS $ Window.prim__frames a\n \n export\n history : (obj : Window) -> JSIO History\n history a = primJS $ Window.prim__history a\n \n export\n length : (obj : Window) -> JSIO Bits32\n length a = primJS $ Window.prim__length a\n \n export\n location : (obj : Window) -> JSIO Location\n location a = primJS $ Window.prim__location a\n \n export\n locationbar : (obj : Window) -> JSIO BarProp\n locationbar a = primJS $ Window.prim__locationbar a\n \n export\n menubar : (obj : Window) -> JSIO BarProp\n menubar a = primJS $ Window.prim__menubar a\n \n export\n name : Window -> Attribute True I String\n name v = fromPrim \"Window.getname\" prim__name prim__setName v\n \n export\n navigator : (obj : Window) -> JSIO Navigator\n navigator a = primJS $ Window.prim__navigator a\n \n export\n opener : Window -> Attribute True I Any\n opener v = fromPrim \"Window.getopener\" prim__opener prim__setOpener v\n \n export\n originAgentCluster : (obj : Window) -> JSIO Bool\n originAgentCluster a = tryJS \"Window.originAgentCluster\"\n $ Window.prim__originAgentCluster a\n \n export\n parent : (obj : Window) -> JSIO (Maybe WindowProxy)\n parent a = tryJS \"Window.parent\" $ Window.prim__parent a\n \n export\n personalbar : (obj : Window) -> JSIO BarProp\n personalbar a = primJS $ Window.prim__personalbar a\n \n export\n scrollbars : (obj : Window) -> JSIO BarProp\n scrollbars a = primJS $ Window.prim__scrollbars a\n \n export\n self : (obj : Window) -> JSIO WindowProxy\n self a = primJS $ Window.prim__self a\n \n export\n status : Window -> Attribute True I String\n status v = fromPrim \"Window.getstatus\" prim__status prim__setStatus v\n \n export\n statusbar : (obj : Window) -> JSIO BarProp\n statusbar a = primJS $ Window.prim__statusbar a\n \n export\n toolbar : (obj : Window) -> JSIO BarProp\n toolbar a = primJS $ Window.prim__toolbar a\n \n export\n top : (obj : Window) -> JSIO (Maybe WindowProxy)\n top a = tryJS \"Window.top\" $ Window.prim__top a\n \n export\n window : (obj : Window) -> JSIO WindowProxy\n window a = primJS $ Window.prim__window a\n \n export\n alert : (obj : Window) -> JSIO ()\n alert a = primJS $ Window.prim__alert a\n \n export\n alert1 : (obj : Window) -> (message : String) -> JSIO ()\n alert1 a b = primJS $ Window.prim__alert1 a b\n \n export\n blur : (obj : Window) -> JSIO ()\n blur a = primJS $ Window.prim__blur a\n \n export\n captureEvents : (obj : Window) -> JSIO ()\n captureEvents a = primJS $ Window.prim__captureEvents a\n \n export\n close : (obj : Window) -> JSIO ()\n close a = primJS $ Window.prim__close a\n \n export\n confirm : (obj : Window) -> (message : Optional String) -> JSIO Bool\n confirm a b = tryJS \"Window.confirm\" $ Window.prim__confirm a (toFFI b)\n\n export\n confirm' : (obj : Window) -> JSIO Bool\n confirm' a = tryJS \"Window.confirm'\" $ Window.prim__confirm a undef\n \n export\n focus : (obj : Window) -> JSIO ()\n focus a = primJS $ Window.prim__focus a\n \n export\n getComputedStyle : (0 _ : JSType t1)\n => {auto 0 _ : Elem Element (Types t1)}\n -> (obj : Window)\n -> (elt : t1)\n -> (pseudoElt : Optional (Maybe String))\n -> JSIO CSSStyleDeclaration\n getComputedStyle a b c = primJS\n $ Window.prim__getComputedStyle a (up b) (toFFI c)\n\n export\n getComputedStyle' : (0 _ : JSType t1)\n => {auto 0 _ : Elem Element (Types t1)}\n -> (obj : Window)\n -> (elt : t1)\n -> JSIO CSSStyleDeclaration\n getComputedStyle' a b = primJS $ Window.prim__getComputedStyle a (up b) undef\n \n export\n open_ : (obj : Window)\n -> (url : Optional String)\n -> (target : Optional String)\n -> (features : Optional String)\n -> JSIO (Maybe WindowProxy)\n open_ a b c d = tryJS \"Window.open_\"\n $ Window.prim__open a (toFFI b) (toFFI c) (toFFI d)\n\n export\n open' : (obj : Window) -> JSIO (Maybe WindowProxy)\n open' a = tryJS \"Window.open'\" $ Window.prim__open a undef undef undef\n \n export\n postMessage : (obj : Window)\n -> (message : Any)\n -> (targetOrigin : String)\n -> (transfer : Optional (Array Object))\n -> JSIO ()\n postMessage a b c d = primJS\n $ Window.prim__postMessage a (toFFI b) c (toFFI d)\n\n export\n postMessage' : (obj : Window)\n -> (message : Any)\n -> (targetOrigin : String)\n -> JSIO ()\n postMessage' a b c = primJS $ Window.prim__postMessage a (toFFI b) c undef\n \n export\n postMessage1 : (0 _ : JSType t1)\n => {auto 0 _ : Elem WindowPostMessageOptions (Types t1)}\n -> (obj : Window)\n -> (message : Any)\n -> (options : Optional t1)\n -> JSIO ()\n postMessage1 a b c = primJS $ Window.prim__postMessage1 a (toFFI b) (optUp c)\n\n export\n postMessage1' : (obj : Window) -> (message : Any) -> JSIO ()\n postMessage1' a b = primJS $ Window.prim__postMessage1 a (toFFI b) undef\n \n export\n print : (obj : Window) -> JSIO ()\n print a = primJS $ Window.prim__print a\n \n export\n prompt : (obj : Window)\n -> (message : Optional String)\n -> (default_ : Optional String)\n -> JSIO (Maybe String)\n prompt a b c = tryJS \"Window.prompt\"\n $ Window.prim__prompt a (toFFI b) (toFFI c)\n\n export\n prompt' : (obj : Window) -> JSIO (Maybe String)\n prompt' a = tryJS \"Window.prompt'\" $ Window.prim__prompt a undef undef\n \n export\n releaseEvents : (obj : Window) -> JSIO ()\n releaseEvents a = primJS $ Window.prim__releaseEvents a\n \n export\n stop : (obj : Window) -> JSIO ()\n stop a = primJS $ Window.prim__stop a\n\n\nnamespace Worker\n \n export\n new : (0 _ : JSType t1)\n => {auto 0 _ : Elem WorkerOptions (Types t1)}\n -> (scriptURL : String)\n -> (options : Optional t1)\n -> JSIO Worker\n new a b = primJS $ Worker.prim__new a (optUp b)\n\n export\n new' : (scriptURL : String) -> JSIO Worker\n new' a = primJS $ Worker.prim__new a undef\n \n export\n onmessage : Worker -> Attribute False Maybe EventHandlerNonNull\n onmessage v = fromNullablePrim \"Worker.getonmessage\"\n prim__onmessage\n prim__setOnmessage\n v\n \n export\n onmessageerror : Worker -> Attribute False Maybe EventHandlerNonNull\n onmessageerror v = fromNullablePrim \"Worker.getonmessageerror\"\n prim__onmessageerror\n prim__setOnmessageerror\n v\n \n export\n postMessage : (obj : Worker)\n -> (message : Any)\n -> (transfer : Array Object)\n -> JSIO ()\n postMessage a b c = primJS $ Worker.prim__postMessage a (toFFI b) c\n \n export\n postMessage1 : (0 _ : JSType t1)\n => {auto 0 _ : Elem PostMessageOptions (Types t1)}\n -> (obj : Worker)\n -> (message : Any)\n -> (options : Optional t1)\n -> JSIO ()\n postMessage1 a b c = primJS $ Worker.prim__postMessage1 a (toFFI b) (optUp c)\n\n export\n postMessage1' : (obj : Worker) -> (message : Any) -> JSIO ()\n postMessage1' a b = primJS $ Worker.prim__postMessage1 a (toFFI b) undef\n \n export\n terminate : (obj : Worker) -> JSIO ()\n terminate a = primJS $ Worker.prim__terminate a\n\n\nnamespace WorkerGlobalScope\n \n export\n location : (0 _ : JSType t1)\n => {auto 0 _ : Elem WorkerGlobalScope (Types t1)}\n -> (obj : t1)\n -> JSIO WorkerLocation\n location a = primJS $ WorkerGlobalScope.prim__location (up a)\n \n export\n navigator : (0 _ : JSType t1)\n => {auto 0 _ : Elem WorkerGlobalScope (Types t1)}\n -> (obj : t1)\n -> JSIO WorkerNavigator\n navigator a = primJS $ WorkerGlobalScope.prim__navigator (up a)\n \n export\n onerror : (0 _ : JSType t)\n => {auto 0 _ : Elem WorkerGlobalScope (Types t)}\n -> t\n -> Attribute False Maybe OnErrorEventHandlerNonNull\n onerror v = fromNullablePrim \"WorkerGlobalScope.getonerror\"\n prim__onerror\n prim__setOnerror\n (v :> WorkerGlobalScope)\n \n export\n onlanguagechange : (0 _ : JSType t)\n => {auto 0 _ : Elem WorkerGlobalScope (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onlanguagechange v = fromNullablePrim \"WorkerGlobalScope.getonlanguagechange\"\n prim__onlanguagechange\n prim__setOnlanguagechange\n (v :> WorkerGlobalScope)\n \n export\n onoffline : (0 _ : JSType t)\n => {auto 0 _ : Elem WorkerGlobalScope (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onoffline v = fromNullablePrim \"WorkerGlobalScope.getonoffline\"\n prim__onoffline\n prim__setOnoffline\n (v :> WorkerGlobalScope)\n \n export\n ononline : (0 _ : JSType t)\n => {auto 0 _ : Elem WorkerGlobalScope (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n ononline v = fromNullablePrim \"WorkerGlobalScope.getononline\"\n prim__ononline\n prim__setOnonline\n (v :> WorkerGlobalScope)\n \n export\n onrejectionhandled : (0 _ : JSType t)\n => {auto 0 _ : Elem WorkerGlobalScope (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onrejectionhandled v = fromNullablePrim \"WorkerGlobalScope.getonrejectionhandled\"\n prim__onrejectionhandled\n prim__setOnrejectionhandled\n (v :> WorkerGlobalScope)\n \n export\n onunhandledrejection : (0 _ : JSType t)\n => {auto 0 _ : Elem WorkerGlobalScope (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onunhandledrejection v = fromNullablePrim \"WorkerGlobalScope.getonunhandledrejection\"\n prim__onunhandledrejection\n prim__setOnunhandledrejection\n (v :> WorkerGlobalScope)\n \n export\n self : (0 _ : JSType t1)\n => {auto 0 _ : Elem WorkerGlobalScope (Types t1)}\n -> (obj : t1)\n -> JSIO WorkerGlobalScope\n self a = primJS $ WorkerGlobalScope.prim__self (up a)\n \n export\n importScripts : (0 _ : JSType t1)\n => {auto 0 _ : Elem WorkerGlobalScope (Types t1)}\n -> (obj : t1)\n -> (urls : List String)\n -> JSIO ()\n importScripts a b = primJS\n $ WorkerGlobalScope.prim__importScripts (up a) (toFFI b)\n\n\nnamespace WorkerLocation\n \n export\n hash : (obj : WorkerLocation) -> JSIO String\n hash a = primJS $ WorkerLocation.prim__hash a\n \n export\n host : (obj : WorkerLocation) -> JSIO String\n host a = primJS $ WorkerLocation.prim__host a\n \n export\n hostname : (obj : WorkerLocation) -> JSIO String\n hostname a = primJS $ WorkerLocation.prim__hostname a\n \n export\n href : (obj : WorkerLocation) -> JSIO String\n href a = primJS $ WorkerLocation.prim__href a\n \n export\n origin : (obj : WorkerLocation) -> JSIO String\n origin a = primJS $ WorkerLocation.prim__origin a\n \n export\n pathname : (obj : WorkerLocation) -> JSIO String\n pathname a = primJS $ WorkerLocation.prim__pathname a\n \n export\n port : (obj : WorkerLocation) -> JSIO String\n port a = primJS $ WorkerLocation.prim__port a\n \n export\n protocol : (obj : WorkerLocation) -> JSIO String\n protocol a = primJS $ WorkerLocation.prim__protocol a\n \n export\n search : (obj : WorkerLocation) -> JSIO String\n search a = primJS $ WorkerLocation.prim__search a\n\n\nnamespace WorkerNavigator\n \n export\n permissions : (obj : WorkerNavigator) -> JSIO Permissions\n permissions a = primJS $ WorkerNavigator.prim__permissions a\n \n export\n serviceWorker : (obj : WorkerNavigator) -> JSIO ServiceWorkerContainer\n serviceWorker a = primJS $ WorkerNavigator.prim__serviceWorker a\n\n\nnamespace Worklet\n \n export\n addModule : (0 _ : JSType t1)\n => {auto 0 _ : Elem WorkletOptions (Types t1)}\n -> (obj : Worklet)\n -> (moduleURL : String)\n -> (options : Optional t1)\n -> JSIO (Promise Undefined)\n addModule a b c = primJS $ Worklet.prim__addModule a b (optUp c)\n\n export\n addModule' : (obj : Worklet)\n -> (moduleURL : String)\n -> JSIO (Promise Undefined)\n addModule' a b = primJS $ Worklet.prim__addModule a b undef\n\n\n\n\n--------------------------------------------------------------------------------\n-- Mixins\n--------------------------------------------------------------------------------\n\nnamespace ARIAMixin\n \n export\n ariaAtomic : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaAtomic v = fromPrim \"ARIAMixin.getariaAtomic\"\n prim__ariaAtomic\n prim__setAriaAtomic\n (v :> ARIAMixin)\n \n export\n ariaAutoComplete : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaAutoComplete v = fromPrim \"ARIAMixin.getariaAutoComplete\"\n prim__ariaAutoComplete\n prim__setAriaAutoComplete\n (v :> ARIAMixin)\n \n export\n ariaBusy : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaBusy v = fromPrim \"ARIAMixin.getariaBusy\"\n prim__ariaBusy\n prim__setAriaBusy\n (v :> ARIAMixin)\n \n export\n ariaChecked : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaChecked v = fromPrim \"ARIAMixin.getariaChecked\"\n prim__ariaChecked\n prim__setAriaChecked\n (v :> ARIAMixin)\n \n export\n ariaColCount : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaColCount v = fromPrim \"ARIAMixin.getariaColCount\"\n prim__ariaColCount\n prim__setAriaColCount\n (v :> ARIAMixin)\n \n export\n ariaColIndex : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaColIndex v = fromPrim \"ARIAMixin.getariaColIndex\"\n prim__ariaColIndex\n prim__setAriaColIndex\n (v :> ARIAMixin)\n \n export\n ariaColIndexText : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaColIndexText v = fromPrim \"ARIAMixin.getariaColIndexText\"\n prim__ariaColIndexText\n prim__setAriaColIndexText\n (v :> ARIAMixin)\n \n export\n ariaColSpan : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaColSpan v = fromPrim \"ARIAMixin.getariaColSpan\"\n prim__ariaColSpan\n prim__setAriaColSpan\n (v :> ARIAMixin)\n \n export\n ariaCurrent : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaCurrent v = fromPrim \"ARIAMixin.getariaCurrent\"\n prim__ariaCurrent\n prim__setAriaCurrent\n (v :> ARIAMixin)\n \n export\n ariaDescription : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaDescription v = fromPrim \"ARIAMixin.getariaDescription\"\n prim__ariaDescription\n prim__setAriaDescription\n (v :> ARIAMixin)\n \n export\n ariaDisabled : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaDisabled v = fromPrim \"ARIAMixin.getariaDisabled\"\n prim__ariaDisabled\n prim__setAriaDisabled\n (v :> ARIAMixin)\n \n export\n ariaExpanded : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaExpanded v = fromPrim \"ARIAMixin.getariaExpanded\"\n prim__ariaExpanded\n prim__setAriaExpanded\n (v :> ARIAMixin)\n \n export\n ariaHasPopup : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaHasPopup v = fromPrim \"ARIAMixin.getariaHasPopup\"\n prim__ariaHasPopup\n prim__setAriaHasPopup\n (v :> ARIAMixin)\n \n export\n ariaHidden : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaHidden v = fromPrim \"ARIAMixin.getariaHidden\"\n prim__ariaHidden\n prim__setAriaHidden\n (v :> ARIAMixin)\n \n export\n ariaInvalid : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaInvalid v = fromPrim \"ARIAMixin.getariaInvalid\"\n prim__ariaInvalid\n prim__setAriaInvalid\n (v :> ARIAMixin)\n \n export\n ariaKeyShortcuts : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaKeyShortcuts v = fromPrim \"ARIAMixin.getariaKeyShortcuts\"\n prim__ariaKeyShortcuts\n prim__setAriaKeyShortcuts\n (v :> ARIAMixin)\n \n export\n ariaLabel : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaLabel v = fromPrim \"ARIAMixin.getariaLabel\"\n prim__ariaLabel\n prim__setAriaLabel\n (v :> ARIAMixin)\n \n export\n ariaLevel : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaLevel v = fromPrim \"ARIAMixin.getariaLevel\"\n prim__ariaLevel\n prim__setAriaLevel\n (v :> ARIAMixin)\n \n export\n ariaLive : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaLive v = fromPrim \"ARIAMixin.getariaLive\"\n prim__ariaLive\n prim__setAriaLive\n (v :> ARIAMixin)\n \n export\n ariaModal : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaModal v = fromPrim \"ARIAMixin.getariaModal\"\n prim__ariaModal\n prim__setAriaModal\n (v :> ARIAMixin)\n \n export\n ariaMultiLine : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaMultiLine v = fromPrim \"ARIAMixin.getariaMultiLine\"\n prim__ariaMultiLine\n prim__setAriaMultiLine\n (v :> ARIAMixin)\n \n export\n ariaMultiSelectable : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaMultiSelectable v = fromPrim \"ARIAMixin.getariaMultiSelectable\"\n prim__ariaMultiSelectable\n prim__setAriaMultiSelectable\n (v :> ARIAMixin)\n \n export\n ariaOrientation : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaOrientation v = fromPrim \"ARIAMixin.getariaOrientation\"\n prim__ariaOrientation\n prim__setAriaOrientation\n (v :> ARIAMixin)\n \n export\n ariaPlaceholder : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaPlaceholder v = fromPrim \"ARIAMixin.getariaPlaceholder\"\n prim__ariaPlaceholder\n prim__setAriaPlaceholder\n (v :> ARIAMixin)\n \n export\n ariaPosInSet : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaPosInSet v = fromPrim \"ARIAMixin.getariaPosInSet\"\n prim__ariaPosInSet\n prim__setAriaPosInSet\n (v :> ARIAMixin)\n \n export\n ariaPressed : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaPressed v = fromPrim \"ARIAMixin.getariaPressed\"\n prim__ariaPressed\n prim__setAriaPressed\n (v :> ARIAMixin)\n \n export\n ariaReadOnly : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaReadOnly v = fromPrim \"ARIAMixin.getariaReadOnly\"\n prim__ariaReadOnly\n prim__setAriaReadOnly\n (v :> ARIAMixin)\n \n export\n ariaRequired : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaRequired v = fromPrim \"ARIAMixin.getariaRequired\"\n prim__ariaRequired\n prim__setAriaRequired\n (v :> ARIAMixin)\n \n export\n ariaRoleDescription : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaRoleDescription v = fromPrim \"ARIAMixin.getariaRoleDescription\"\n prim__ariaRoleDescription\n prim__setAriaRoleDescription\n (v :> ARIAMixin)\n \n export\n ariaRowCount : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaRowCount v = fromPrim \"ARIAMixin.getariaRowCount\"\n prim__ariaRowCount\n prim__setAriaRowCount\n (v :> ARIAMixin)\n \n export\n ariaRowIndex : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaRowIndex v = fromPrim \"ARIAMixin.getariaRowIndex\"\n prim__ariaRowIndex\n prim__setAriaRowIndex\n (v :> ARIAMixin)\n \n export\n ariaRowIndexText : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaRowIndexText v = fromPrim \"ARIAMixin.getariaRowIndexText\"\n prim__ariaRowIndexText\n prim__setAriaRowIndexText\n (v :> ARIAMixin)\n \n export\n ariaRowSpan : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaRowSpan v = fromPrim \"ARIAMixin.getariaRowSpan\"\n prim__ariaRowSpan\n prim__setAriaRowSpan\n (v :> ARIAMixin)\n \n export\n ariaSelected : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaSelected v = fromPrim \"ARIAMixin.getariaSelected\"\n prim__ariaSelected\n prim__setAriaSelected\n (v :> ARIAMixin)\n \n export\n ariaSetSize : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaSetSize v = fromPrim \"ARIAMixin.getariaSetSize\"\n prim__ariaSetSize\n prim__setAriaSetSize\n (v :> ARIAMixin)\n \n export\n ariaSort : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaSort v = fromPrim \"ARIAMixin.getariaSort\"\n prim__ariaSort\n prim__setAriaSort\n (v :> ARIAMixin)\n \n export\n ariaValueMax : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaValueMax v = fromPrim \"ARIAMixin.getariaValueMax\"\n prim__ariaValueMax\n prim__setAriaValueMax\n (v :> ARIAMixin)\n \n export\n ariaValueMin : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaValueMin v = fromPrim \"ARIAMixin.getariaValueMin\"\n prim__ariaValueMin\n prim__setAriaValueMin\n (v :> ARIAMixin)\n \n export\n ariaValueNow : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaValueNow v = fromPrim \"ARIAMixin.getariaValueNow\"\n prim__ariaValueNow\n prim__setAriaValueNow\n (v :> ARIAMixin)\n \n export\n ariaValueText : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute True I String\n ariaValueText v = fromPrim \"ARIAMixin.getariaValueText\"\n prim__ariaValueText\n prim__setAriaValueText\n (v :> ARIAMixin)\n \n export\n role : (0 _ : JSType t)\n => {auto 0 _ : Elem ARIAMixin (Types t)}\n -> t\n -> Attribute False Maybe String\n role v = fromNullablePrim \"ARIAMixin.getrole\"\n prim__role\n prim__setRole\n (v :> ARIAMixin)\n\n\nnamespace AbstractWorker\n \n export\n onerror : (0 _ : JSType t)\n => {auto 0 _ : Elem AbstractWorker (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onerror v = fromNullablePrim \"AbstractWorker.getonerror\"\n prim__onerror\n prim__setOnerror\n (v :> AbstractWorker)\n\n\nnamespace CanvasCompositing\n \n export\n globalAlpha : (0 _ : JSType t)\n => {auto 0 _ : Elem CanvasCompositing (Types t)}\n -> t\n -> Attribute True I Double\n globalAlpha v = fromPrim \"CanvasCompositing.getglobalAlpha\"\n prim__globalAlpha\n prim__setGlobalAlpha\n (v :> CanvasCompositing)\n \n export\n globalCompositeOperation : (0 _ : JSType t)\n => {auto 0 _ : Elem CanvasCompositing (Types t)}\n -> t\n -> Attribute True I String\n globalCompositeOperation v = fromPrim \"CanvasCompositing.getglobalCompositeOperation\"\n prim__globalCompositeOperation\n prim__setGlobalCompositeOperation\n (v :> CanvasCompositing)\n\n\nnamespace CanvasDrawImage\n \n export\n drawImage : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasDrawImage (Types t1)}\n -> (obj : t1)\n -> (image : NS I [ HTMLImageElement\n , SVGImageElement\n , HTMLVideoElement\n , HTMLCanvasElement\n , ImageBitmap\n , OffscreenCanvas\n ])\n -> (dx : Double)\n -> (dy : Double)\n -> JSIO ()\n drawImage a b c d = primJS\n $ CanvasDrawImage.prim__drawImage (up a) (toFFI b) c d\n \n export\n drawImage1 : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasDrawImage (Types t1)}\n -> (obj : t1)\n -> (image : NS I [ HTMLImageElement\n , SVGImageElement\n , HTMLVideoElement\n , HTMLCanvasElement\n , ImageBitmap\n , OffscreenCanvas\n ])\n -> (dx : Double)\n -> (dy : Double)\n -> (dw : Double)\n -> (dh : Double)\n -> JSIO ()\n drawImage1 a b c d e f = primJS\n $ CanvasDrawImage.prim__drawImage1 (up a)\n (toFFI b)\n c\n d\n e\n f\n \n export\n drawImage2 : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasDrawImage (Types t1)}\n -> (obj : t1)\n -> (image : NS I [ HTMLImageElement\n , SVGImageElement\n , HTMLVideoElement\n , HTMLCanvasElement\n , ImageBitmap\n , OffscreenCanvas\n ])\n -> (sx : Double)\n -> (sy : Double)\n -> (sw : Double)\n -> (sh : Double)\n -> (dx : Double)\n -> (dy : Double)\n -> (dw : Double)\n -> (dh : Double)\n -> JSIO ()\n drawImage2 a b c d e f g h i j = primJS\n $ CanvasDrawImage.prim__drawImage2 (up a)\n (toFFI b)\n c\n d\n e\n f\n g\n h\n i\n j\n\n\nnamespace CanvasDrawPath\n \n export\n beginPath : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasDrawPath (Types t1)}\n -> (obj : t1)\n -> JSIO ()\n beginPath a = primJS $ CanvasDrawPath.prim__beginPath (up a)\n \n export\n clip : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasDrawPath (Types t1)}\n -> (obj : t1)\n -> (fillRule : Optional CanvasFillRule)\n -> JSIO ()\n clip a b = primJS $ CanvasDrawPath.prim__clip (up a) (toFFI b)\n\n export\n clip' : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasDrawPath (Types t1)}\n -> (obj : t1)\n -> JSIO ()\n clip' a = primJS $ CanvasDrawPath.prim__clip (up a) undef\n \n export\n clip1 : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasDrawPath (Types t1)}\n -> (obj : t1)\n -> (path : Path2D)\n -> (fillRule : Optional CanvasFillRule)\n -> JSIO ()\n clip1 a b c = primJS $ CanvasDrawPath.prim__clip1 (up a) b (toFFI c)\n\n export\n clip1' : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasDrawPath (Types t1)}\n -> (obj : t1)\n -> (path : Path2D)\n -> JSIO ()\n clip1' a b = primJS $ CanvasDrawPath.prim__clip1 (up a) b undef\n \n export\n fill : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasDrawPath (Types t1)}\n -> (obj : t1)\n -> (fillRule : Optional CanvasFillRule)\n -> JSIO ()\n fill a b = primJS $ CanvasDrawPath.prim__fill (up a) (toFFI b)\n\n export\n fill' : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasDrawPath (Types t1)}\n -> (obj : t1)\n -> JSIO ()\n fill' a = primJS $ CanvasDrawPath.prim__fill (up a) undef\n \n export\n fill1 : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasDrawPath (Types t1)}\n -> (obj : t1)\n -> (path : Path2D)\n -> (fillRule : Optional CanvasFillRule)\n -> JSIO ()\n fill1 a b c = primJS $ CanvasDrawPath.prim__fill1 (up a) b (toFFI c)\n\n export\n fill1' : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasDrawPath (Types t1)}\n -> (obj : t1)\n -> (path : Path2D)\n -> JSIO ()\n fill1' a b = primJS $ CanvasDrawPath.prim__fill1 (up a) b undef\n \n export\n isPointInPath : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasDrawPath (Types t1)}\n -> (obj : t1)\n -> (x : Double)\n -> (y : Double)\n -> (fillRule : Optional CanvasFillRule)\n -> JSIO Bool\n isPointInPath a b c d = tryJS \"CanvasDrawPath.isPointInPath\"\n $ CanvasDrawPath.prim__isPointInPath (up a)\n b\n c\n (toFFI d)\n\n export\n isPointInPath' : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasDrawPath (Types t1)}\n -> (obj : t1)\n -> (x : Double)\n -> (y : Double)\n -> JSIO Bool\n isPointInPath' a b c = tryJS \"CanvasDrawPath.isPointInPath'\"\n $ CanvasDrawPath.prim__isPointInPath (up a) b c undef\n \n export\n isPointInPath1 : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasDrawPath (Types t1)}\n -> (obj : t1)\n -> (path : Path2D)\n -> (x : Double)\n -> (y : Double)\n -> (fillRule : Optional CanvasFillRule)\n -> JSIO Bool\n isPointInPath1 a b c d e = tryJS \"CanvasDrawPath.isPointInPath1\"\n $ CanvasDrawPath.prim__isPointInPath1 (up a)\n b\n c\n d\n (toFFI e)\n\n export\n isPointInPath1' : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasDrawPath (Types t1)}\n -> (obj : t1)\n -> (path : Path2D)\n -> (x : Double)\n -> (y : Double)\n -> JSIO Bool\n isPointInPath1' a b c d = tryJS \"CanvasDrawPath.isPointInPath1'\"\n $ CanvasDrawPath.prim__isPointInPath1 (up a)\n b\n c\n d\n undef\n \n export\n isPointInStroke : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasDrawPath (Types t1)}\n -> (obj : t1)\n -> (x : Double)\n -> (y : Double)\n -> JSIO Bool\n isPointInStroke a b c = tryJS \"CanvasDrawPath.isPointInStroke\"\n $ CanvasDrawPath.prim__isPointInStroke (up a) b c\n \n export\n isPointInStroke1 : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasDrawPath (Types t1)}\n -> (obj : t1)\n -> (path : Path2D)\n -> (x : Double)\n -> (y : Double)\n -> JSIO Bool\n isPointInStroke1 a b c d = tryJS \"CanvasDrawPath.isPointInStroke1\"\n $ CanvasDrawPath.prim__isPointInStroke1 (up a) b c d\n \n export\n stroke : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasDrawPath (Types t1)}\n -> (obj : t1)\n -> JSIO ()\n stroke a = primJS $ CanvasDrawPath.prim__stroke (up a)\n \n export\n stroke1 : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasDrawPath (Types t1)}\n -> (obj : t1)\n -> (path : Path2D)\n -> JSIO ()\n stroke1 a b = primJS $ CanvasDrawPath.prim__stroke1 (up a) b\n\n\nnamespace CanvasFillStrokeStyles\n \n export\n fillStyle : (0 _ : JSType t)\n => {auto 0 _ : Elem CanvasFillStrokeStyles (Types t)}\n -> t\n -> Attribute True I (NS I [ String\n , CanvasGradient\n , CanvasPattern\n ])\n fillStyle v = fromPrim \"CanvasFillStrokeStyles.getfillStyle\"\n prim__fillStyle\n prim__setFillStyle\n (v :> CanvasFillStrokeStyles)\n \n export\n strokeStyle : (0 _ : JSType t)\n => {auto 0 _ : Elem CanvasFillStrokeStyles (Types t)}\n -> t\n -> Attribute True I (NS I [ String\n , CanvasGradient\n , CanvasPattern\n ])\n strokeStyle v = fromPrim \"CanvasFillStrokeStyles.getstrokeStyle\"\n prim__strokeStyle\n prim__setStrokeStyle\n (v :> CanvasFillStrokeStyles)\n \n export\n createLinearGradient : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasFillStrokeStyles (Types t1)}\n -> (obj : t1)\n -> (x0 : Double)\n -> (y0 : Double)\n -> (x1 : Double)\n -> (y1 : Double)\n -> JSIO CanvasGradient\n createLinearGradient a b c d e = primJS\n $ CanvasFillStrokeStyles.prim__createLinearGradient (up a)\n b\n c\n d\n e\n \n export\n createPattern : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasFillStrokeStyles (Types t1)}\n -> (obj : t1)\n -> (image : NS I [ HTMLImageElement\n , SVGImageElement\n , HTMLVideoElement\n , HTMLCanvasElement\n , ImageBitmap\n , OffscreenCanvas\n ])\n -> (repetition : String)\n -> JSIO (Maybe CanvasPattern)\n createPattern a b c = tryJS \"CanvasFillStrokeStyles.createPattern\"\n $ CanvasFillStrokeStyles.prim__createPattern (up a)\n (toFFI b)\n c\n \n export\n createRadialGradient : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasFillStrokeStyles (Types t1)}\n -> (obj : t1)\n -> (x0 : Double)\n -> (y0 : Double)\n -> (r0 : Double)\n -> (x1 : Double)\n -> (y1 : Double)\n -> (r1 : Double)\n -> JSIO CanvasGradient\n createRadialGradient a b c d e f g = primJS\n $ CanvasFillStrokeStyles.prim__createRadialGradient (up a)\n b\n c\n d\n e\n f\n g\n\n\nnamespace CanvasFilters\n \n export\n filter : (0 _ : JSType t)\n => {auto 0 _ : Elem CanvasFilters (Types t)}\n -> t\n -> Attribute True I String\n filter v = fromPrim \"CanvasFilters.getfilter\"\n prim__filter\n prim__setFilter\n (v :> CanvasFilters)\n\n\nnamespace CanvasImageData\n \n export\n createImageData : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasImageData (Types t1)}\n -> (obj : t1)\n -> (sw : Int32)\n -> (sh : Int32)\n -> JSIO ImageData\n createImageData a b c = primJS\n $ CanvasImageData.prim__createImageData (up a) b c\n \n export\n createImageData1 : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasImageData (Types t1)}\n -> (obj : t1)\n -> (imagedata : ImageData)\n -> JSIO ImageData\n createImageData1 a b = primJS\n $ CanvasImageData.prim__createImageData1 (up a) b\n \n export\n getImageData : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasImageData (Types t1)}\n -> (obj : t1)\n -> (sx : Int32)\n -> (sy : Int32)\n -> (sw : Int32)\n -> (sh : Int32)\n -> JSIO ImageData\n getImageData a b c d e = primJS\n $ CanvasImageData.prim__getImageData (up a) b c d e\n \n export\n putImageData : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasImageData (Types t1)}\n -> (obj : t1)\n -> (imagedata : ImageData)\n -> (dx : Int32)\n -> (dy : Int32)\n -> JSIO ()\n putImageData a b c d = primJS\n $ CanvasImageData.prim__putImageData (up a) b c d\n \n export\n putImageData1 : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasImageData (Types t1)}\n -> (obj : t1)\n -> (imagedata : ImageData)\n -> (dx : Int32)\n -> (dy : Int32)\n -> (dirtyX : Int32)\n -> (dirtyY : Int32)\n -> (dirtyWidth : Int32)\n -> (dirtyHeight : Int32)\n -> JSIO ()\n putImageData1 a b c d e f g h = primJS\n $ CanvasImageData.prim__putImageData1 (up a)\n b\n c\n d\n e\n f\n g\n h\n\n\nnamespace CanvasImageSmoothing\n \n export\n imageSmoothingEnabled : (0 _ : JSType t)\n => {auto 0 _ : Elem CanvasImageSmoothing (Types t)}\n -> t\n -> Attribute True I Bool\n imageSmoothingEnabled v = fromPrim \"CanvasImageSmoothing.getimageSmoothingEnabled\"\n prim__imageSmoothingEnabled\n prim__setImageSmoothingEnabled\n (v :> CanvasImageSmoothing)\n \n export\n imageSmoothingQuality : (0 _ : JSType t)\n => {auto 0 _ : Elem CanvasImageSmoothing (Types t)}\n -> t\n -> Attribute True I ImageSmoothingQuality\n imageSmoothingQuality v = fromPrim \"CanvasImageSmoothing.getimageSmoothingQuality\"\n prim__imageSmoothingQuality\n prim__setImageSmoothingQuality\n (v :> CanvasImageSmoothing)\n\n\nnamespace CanvasPath\n \n export\n arc : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasPath (Types t1)}\n -> (obj : t1)\n -> (x : Double)\n -> (y : Double)\n -> (radius : Double)\n -> (startAngle : Double)\n -> (endAngle : Double)\n -> (counterclockwise : Optional Bool)\n -> JSIO ()\n arc a b c d e f g = primJS $ CanvasPath.prim__arc (up a) b c d e f (toFFI g)\n\n export\n arc' : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasPath (Types t1)}\n -> (obj : t1)\n -> (x : Double)\n -> (y : Double)\n -> (radius : Double)\n -> (startAngle : Double)\n -> (endAngle : Double)\n -> JSIO ()\n arc' a b c d e f = primJS $ CanvasPath.prim__arc (up a) b c d e f undef\n \n export\n arcTo : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasPath (Types t1)}\n -> (obj : t1)\n -> (x1 : Double)\n -> (y1 : Double)\n -> (x2 : Double)\n -> (y2 : Double)\n -> (radius : Double)\n -> JSIO ()\n arcTo a b c d e f = primJS $ CanvasPath.prim__arcTo (up a) b c d e f\n \n export\n bezierCurveTo : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasPath (Types t1)}\n -> (obj : t1)\n -> (cp1x : Double)\n -> (cp1y : Double)\n -> (cp2x : Double)\n -> (cp2y : Double)\n -> (x : Double)\n -> (y : Double)\n -> JSIO ()\n bezierCurveTo a b c d e f g = primJS\n $ CanvasPath.prim__bezierCurveTo (up a)\n b\n c\n d\n e\n f\n g\n \n export\n closePath : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasPath (Types t1)}\n -> (obj : t1)\n -> JSIO ()\n closePath a = primJS $ CanvasPath.prim__closePath (up a)\n \n export\n ellipse : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasPath (Types t1)}\n -> (obj : t1)\n -> (x : Double)\n -> (y : Double)\n -> (radiusX : Double)\n -> (radiusY : Double)\n -> (rotation : Double)\n -> (startAngle : Double)\n -> (endAngle : Double)\n -> (counterclockwise : Optional Bool)\n -> JSIO ()\n ellipse a b c d e f g h i = primJS\n $ CanvasPath.prim__ellipse (up a)\n b\n c\n d\n e\n f\n g\n h\n (toFFI i)\n\n export\n ellipse' : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasPath (Types t1)}\n -> (obj : t1)\n -> (x : Double)\n -> (y : Double)\n -> (radiusX : Double)\n -> (radiusY : Double)\n -> (rotation : Double)\n -> (startAngle : Double)\n -> (endAngle : Double)\n -> JSIO ()\n ellipse' a b c d e f g h = primJS\n $ CanvasPath.prim__ellipse (up a) b c d e f g h undef\n \n export\n lineTo : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasPath (Types t1)}\n -> (obj : t1)\n -> (x : Double)\n -> (y : Double)\n -> JSIO ()\n lineTo a b c = primJS $ CanvasPath.prim__lineTo (up a) b c\n \n export\n moveTo : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasPath (Types t1)}\n -> (obj : t1)\n -> (x : Double)\n -> (y : Double)\n -> JSIO ()\n moveTo a b c = primJS $ CanvasPath.prim__moveTo (up a) b c\n \n export\n quadraticCurveTo : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasPath (Types t1)}\n -> (obj : t1)\n -> (cpx : Double)\n -> (cpy : Double)\n -> (x : Double)\n -> (y : Double)\n -> JSIO ()\n quadraticCurveTo a b c d e = primJS\n $ CanvasPath.prim__quadraticCurveTo (up a) b c d e\n \n export\n rect : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasPath (Types t1)}\n -> (obj : t1)\n -> (x : Double)\n -> (y : Double)\n -> (w : Double)\n -> (h : Double)\n -> JSIO ()\n rect a b c d e = primJS $ CanvasPath.prim__rect (up a) b c d e\n\n\nnamespace CanvasPathDrawingStyles\n \n export\n lineCap : (0 _ : JSType t)\n => {auto 0 _ : Elem CanvasPathDrawingStyles (Types t)}\n -> t\n -> Attribute True I CanvasLineCap\n lineCap v = fromPrim \"CanvasPathDrawingStyles.getlineCap\"\n prim__lineCap\n prim__setLineCap\n (v :> CanvasPathDrawingStyles)\n \n export\n lineDashOffset : (0 _ : JSType t)\n => {auto 0 _ : Elem CanvasPathDrawingStyles (Types t)}\n -> t\n -> Attribute True I Double\n lineDashOffset v = fromPrim \"CanvasPathDrawingStyles.getlineDashOffset\"\n prim__lineDashOffset\n prim__setLineDashOffset\n (v :> CanvasPathDrawingStyles)\n \n export\n lineJoin : (0 _ : JSType t)\n => {auto 0 _ : Elem CanvasPathDrawingStyles (Types t)}\n -> t\n -> Attribute True I CanvasLineJoin\n lineJoin v = fromPrim \"CanvasPathDrawingStyles.getlineJoin\"\n prim__lineJoin\n prim__setLineJoin\n (v :> CanvasPathDrawingStyles)\n \n export\n lineWidth : (0 _ : JSType t)\n => {auto 0 _ : Elem CanvasPathDrawingStyles (Types t)}\n -> t\n -> Attribute True I Double\n lineWidth v = fromPrim \"CanvasPathDrawingStyles.getlineWidth\"\n prim__lineWidth\n prim__setLineWidth\n (v :> CanvasPathDrawingStyles)\n \n export\n miterLimit : (0 _ : JSType t)\n => {auto 0 _ : Elem CanvasPathDrawingStyles (Types t)}\n -> t\n -> Attribute True I Double\n miterLimit v = fromPrim \"CanvasPathDrawingStyles.getmiterLimit\"\n prim__miterLimit\n prim__setMiterLimit\n (v :> CanvasPathDrawingStyles)\n \n export\n getLineDash : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasPathDrawingStyles (Types t1)}\n -> (obj : t1)\n -> JSIO (Array Double)\n getLineDash a = primJS $ CanvasPathDrawingStyles.prim__getLineDash (up a)\n \n export\n setLineDash : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasPathDrawingStyles (Types t1)}\n -> (obj : t1)\n -> (segments : Array Double)\n -> JSIO ()\n setLineDash a b = primJS $ CanvasPathDrawingStyles.prim__setLineDash (up a) b\n\n\nnamespace CanvasRect\n \n export\n clearRect : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasRect (Types t1)}\n -> (obj : t1)\n -> (x : Double)\n -> (y : Double)\n -> (w : Double)\n -> (h : Double)\n -> JSIO ()\n clearRect a b c d e = primJS $ CanvasRect.prim__clearRect (up a) b c d e\n \n export\n fillRect : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasRect (Types t1)}\n -> (obj : t1)\n -> (x : Double)\n -> (y : Double)\n -> (w : Double)\n -> (h : Double)\n -> JSIO ()\n fillRect a b c d e = primJS $ CanvasRect.prim__fillRect (up a) b c d e\n \n export\n strokeRect : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasRect (Types t1)}\n -> (obj : t1)\n -> (x : Double)\n -> (y : Double)\n -> (w : Double)\n -> (h : Double)\n -> JSIO ()\n strokeRect a b c d e = primJS $ CanvasRect.prim__strokeRect (up a) b c d e\n\n\nnamespace CanvasShadowStyles\n \n export\n shadowBlur : (0 _ : JSType t)\n => {auto 0 _ : Elem CanvasShadowStyles (Types t)}\n -> t\n -> Attribute True I Double\n shadowBlur v = fromPrim \"CanvasShadowStyles.getshadowBlur\"\n prim__shadowBlur\n prim__setShadowBlur\n (v :> CanvasShadowStyles)\n \n export\n shadowColor : (0 _ : JSType t)\n => {auto 0 _ : Elem CanvasShadowStyles (Types t)}\n -> t\n -> Attribute True I String\n shadowColor v = fromPrim \"CanvasShadowStyles.getshadowColor\"\n prim__shadowColor\n prim__setShadowColor\n (v :> CanvasShadowStyles)\n \n export\n shadowOffsetX : (0 _ : JSType t)\n => {auto 0 _ : Elem CanvasShadowStyles (Types t)}\n -> t\n -> Attribute True I Double\n shadowOffsetX v = fromPrim \"CanvasShadowStyles.getshadowOffsetX\"\n prim__shadowOffsetX\n prim__setShadowOffsetX\n (v :> CanvasShadowStyles)\n \n export\n shadowOffsetY : (0 _ : JSType t)\n => {auto 0 _ : Elem CanvasShadowStyles (Types t)}\n -> t\n -> Attribute True I Double\n shadowOffsetY v = fromPrim \"CanvasShadowStyles.getshadowOffsetY\"\n prim__shadowOffsetY\n prim__setShadowOffsetY\n (v :> CanvasShadowStyles)\n\n\nnamespace CanvasState\n \n export\n restore : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasState (Types t1)}\n -> (obj : t1)\n -> JSIO ()\n restore a = primJS $ CanvasState.prim__restore (up a)\n \n export\n save : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasState (Types t1)}\n -> (obj : t1)\n -> JSIO ()\n save a = primJS $ CanvasState.prim__save (up a)\n\n\nnamespace CanvasText\n \n export\n fillText : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasText (Types t1)}\n -> (obj : t1)\n -> (text : String)\n -> (x : Double)\n -> (y : Double)\n -> (maxWidth : Optional Double)\n -> JSIO ()\n fillText a b c d e = primJS $ CanvasText.prim__fillText (up a) b c d (toFFI e)\n\n export\n fillText' : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasText (Types t1)}\n -> (obj : t1)\n -> (text : String)\n -> (x : Double)\n -> (y : Double)\n -> JSIO ()\n fillText' a b c d = primJS $ CanvasText.prim__fillText (up a) b c d undef\n \n export\n measureText : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasText (Types t1)}\n -> (obj : t1)\n -> (text : String)\n -> JSIO TextMetrics\n measureText a b = primJS $ CanvasText.prim__measureText (up a) b\n \n export\n strokeText : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasText (Types t1)}\n -> (obj : t1)\n -> (text : String)\n -> (x : Double)\n -> (y : Double)\n -> (maxWidth : Optional Double)\n -> JSIO ()\n strokeText a b c d e = primJS\n $ CanvasText.prim__strokeText (up a) b c d (toFFI e)\n\n export\n strokeText' : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasText (Types t1)}\n -> (obj : t1)\n -> (text : String)\n -> (x : Double)\n -> (y : Double)\n -> JSIO ()\n strokeText' a b c d = primJS $ CanvasText.prim__strokeText (up a) b c d undef\n\n\nnamespace CanvasTextDrawingStyles\n \n export\n direction : (0 _ : JSType t)\n => {auto 0 _ : Elem CanvasTextDrawingStyles (Types t)}\n -> t\n -> Attribute True I CanvasDirection\n direction v = fromPrim \"CanvasTextDrawingStyles.getdirection\"\n prim__direction\n prim__setDirection\n (v :> CanvasTextDrawingStyles)\n \n export\n font : (0 _ : JSType t)\n => {auto 0 _ : Elem CanvasTextDrawingStyles (Types t)}\n -> t\n -> Attribute True I String\n font v = fromPrim \"CanvasTextDrawingStyles.getfont\"\n prim__font\n prim__setFont\n (v :> CanvasTextDrawingStyles)\n \n export\n textAlign : (0 _ : JSType t)\n => {auto 0 _ : Elem CanvasTextDrawingStyles (Types t)}\n -> t\n -> Attribute True I CanvasTextAlign\n textAlign v = fromPrim \"CanvasTextDrawingStyles.gettextAlign\"\n prim__textAlign\n prim__setTextAlign\n (v :> CanvasTextDrawingStyles)\n \n export\n textBaseline : (0 _ : JSType t)\n => {auto 0 _ : Elem CanvasTextDrawingStyles (Types t)}\n -> t\n -> Attribute True I CanvasTextBaseline\n textBaseline v = fromPrim \"CanvasTextDrawingStyles.gettextBaseline\"\n prim__textBaseline\n prim__setTextBaseline\n (v :> CanvasTextDrawingStyles)\n\n\nnamespace CanvasTransform\n \n export\n getTransform : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasTransform (Types t1)}\n -> (obj : t1)\n -> JSIO DOMMatrix\n getTransform a = primJS $ CanvasTransform.prim__getTransform (up a)\n \n export\n resetTransform : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasTransform (Types t1)}\n -> (obj : t1)\n -> JSIO ()\n resetTransform a = primJS $ CanvasTransform.prim__resetTransform (up a)\n \n export\n rotate : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasTransform (Types t1)}\n -> (obj : t1)\n -> (angle : Double)\n -> JSIO ()\n rotate a b = primJS $ CanvasTransform.prim__rotate (up a) b\n \n export\n scale : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasTransform (Types t1)}\n -> (obj : t1)\n -> (x : Double)\n -> (y : Double)\n -> JSIO ()\n scale a b c = primJS $ CanvasTransform.prim__scale (up a) b c\n \n export\n setTransform : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasTransform (Types t1)}\n -> (obj : t1)\n -> (a : Double)\n -> (b : Double)\n -> (c : Double)\n -> (d : Double)\n -> (e : Double)\n -> (f : Double)\n -> JSIO ()\n setTransform a b c d e f g = primJS\n $ CanvasTransform.prim__setTransform (up a)\n b\n c\n d\n e\n f\n g\n \n export\n setTransform1 : (0 _ : JSType t1)\n => (0 _ : JSType t2)\n => {auto 0 _ : Elem CanvasTransform (Types t1)}\n -> {auto 0 _ : Elem DOMMatrix2DInit (Types t2)}\n -> (obj : t1)\n -> (transform : Optional t2)\n -> JSIO ()\n setTransform1 a b = primJS\n $ CanvasTransform.prim__setTransform1 (up a) (optUp b)\n\n export\n setTransform1' : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasTransform (Types t1)}\n -> (obj : t1)\n -> JSIO ()\n setTransform1' a = primJS $ CanvasTransform.prim__setTransform1 (up a) undef\n \n export\n transform : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasTransform (Types t1)}\n -> (obj : t1)\n -> (a : Double)\n -> (b : Double)\n -> (c : Double)\n -> (d : Double)\n -> (e : Double)\n -> (f : Double)\n -> JSIO ()\n transform a b c d e f g = primJS\n $ CanvasTransform.prim__transform (up a) b c d e f g\n \n export\n translate : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasTransform (Types t1)}\n -> (obj : t1)\n -> (x : Double)\n -> (y : Double)\n -> JSIO ()\n translate a b c = primJS $ CanvasTransform.prim__translate (up a) b c\n\n\nnamespace CanvasUserInterface\n \n export\n drawFocusIfNeeded : (0 _ : JSType t1)\n => (0 _ : JSType t2)\n => {auto 0 _ : Elem CanvasUserInterface (Types t1)}\n -> {auto 0 _ : Elem Element (Types t2)}\n -> (obj : t1)\n -> (element : t2)\n -> JSIO ()\n drawFocusIfNeeded a b = primJS\n $ CanvasUserInterface.prim__drawFocusIfNeeded (up a)\n (up b)\n \n export\n drawFocusIfNeeded1 : (0 _ : JSType t1)\n => (0 _ : JSType t2)\n => {auto 0 _ : Elem CanvasUserInterface (Types t1)}\n -> {auto 0 _ : Elem Element (Types t2)}\n -> (obj : t1)\n -> (path : Path2D)\n -> (element : t2)\n -> JSIO ()\n drawFocusIfNeeded1 a b c = primJS\n $ CanvasUserInterface.prim__drawFocusIfNeeded1 (up a)\n b\n (up c)\n \n export\n scrollPathIntoView : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasUserInterface (Types t1)}\n -> (obj : t1)\n -> JSIO ()\n scrollPathIntoView a = primJS\n $ CanvasUserInterface.prim__scrollPathIntoView (up a)\n \n export\n scrollPathIntoView1 : (0 _ : JSType t1)\n => {auto 0 _ : Elem CanvasUserInterface (Types t1)}\n -> (obj : t1)\n -> (path : Path2D)\n -> JSIO ()\n scrollPathIntoView1 a b = primJS\n $ CanvasUserInterface.prim__scrollPathIntoView1 (up a)\n b\n\n\nnamespace DocumentAndElementEventHandlers\n \n export\n oncopy : (0 _ : JSType t)\n => {auto 0 _ : Elem DocumentAndElementEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n oncopy v = fromNullablePrim \"DocumentAndElementEventHandlers.getoncopy\"\n prim__oncopy\n prim__setOncopy\n (v :> DocumentAndElementEventHandlers)\n \n export\n oncut : (0 _ : JSType t)\n => {auto 0 _ : Elem DocumentAndElementEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n oncut v = fromNullablePrim \"DocumentAndElementEventHandlers.getoncut\"\n prim__oncut\n prim__setOncut\n (v :> DocumentAndElementEventHandlers)\n \n export\n onpaste : (0 _ : JSType t)\n => {auto 0 _ : Elem DocumentAndElementEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onpaste v = fromNullablePrim \"DocumentAndElementEventHandlers.getonpaste\"\n prim__onpaste\n prim__setOnpaste\n (v :> DocumentAndElementEventHandlers)\n\n\nnamespace ElementContentEditable\n \n export\n contentEditable : (0 _ : JSType t)\n => {auto 0 _ : Elem ElementContentEditable (Types t)}\n -> t\n -> Attribute True I String\n contentEditable v = fromPrim \"ElementContentEditable.getcontentEditable\"\n prim__contentEditable\n prim__setContentEditable\n (v :> ElementContentEditable)\n \n export\n enterKeyHint : (0 _ : JSType t)\n => {auto 0 _ : Elem ElementContentEditable (Types t)}\n -> t\n -> Attribute True I String\n enterKeyHint v = fromPrim \"ElementContentEditable.getenterKeyHint\"\n prim__enterKeyHint\n prim__setEnterKeyHint\n (v :> ElementContentEditable)\n \n export\n inputMode : (0 _ : JSType t)\n => {auto 0 _ : Elem ElementContentEditable (Types t)}\n -> t\n -> Attribute True I String\n inputMode v = fromPrim \"ElementContentEditable.getinputMode\"\n prim__inputMode\n prim__setInputMode\n (v :> ElementContentEditable)\n \n export\n isContentEditable : (0 _ : JSType t1)\n => {auto 0 _ : Elem ElementContentEditable (Types t1)}\n -> (obj : t1)\n -> JSIO Bool\n isContentEditable a = tryJS \"ElementContentEditable.isContentEditable\"\n $ ElementContentEditable.prim__isContentEditable (up a)\n\n\nnamespace GlobalEventHandlers\n \n export\n onabort : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe UIEventHandler\n onabort v = fromNullablePrim \"GlobalEventHandlers.getonabort\"\n prim__onabort\n prim__setOnabort\n (v :> GlobalEventHandlers)\n \n export\n onauxclick : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe MouseEventHandler\n onauxclick v = fromNullablePrim \"GlobalEventHandlers.getonauxclick\"\n prim__onauxclick\n prim__setOnauxclick\n (v :> GlobalEventHandlers)\n \n export\n onblur : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe FocusEventHandler\n onblur v = fromNullablePrim \"GlobalEventHandlers.getonblur\"\n prim__onblur\n prim__setOnblur\n (v :> GlobalEventHandlers)\n \n export\n oncancel : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n oncancel v = fromNullablePrim \"GlobalEventHandlers.getoncancel\"\n prim__oncancel\n prim__setOncancel\n (v :> GlobalEventHandlers)\n \n export\n oncanplay : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n oncanplay v = fromNullablePrim \"GlobalEventHandlers.getoncanplay\"\n prim__oncanplay\n prim__setOncanplay\n (v :> GlobalEventHandlers)\n \n export\n oncanplaythrough : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n oncanplaythrough v = fromNullablePrim \"GlobalEventHandlers.getoncanplaythrough\"\n prim__oncanplaythrough\n prim__setOncanplaythrough\n (v :> GlobalEventHandlers)\n \n export\n onchange : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onchange v = fromNullablePrim \"GlobalEventHandlers.getonchange\"\n prim__onchange\n prim__setOnchange\n (v :> GlobalEventHandlers)\n \n export\n onclick : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe MouseEventHandler\n onclick v = fromNullablePrim \"GlobalEventHandlers.getonclick\"\n prim__onclick\n prim__setOnclick\n (v :> GlobalEventHandlers)\n \n export\n onclose : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onclose v = fromNullablePrim \"GlobalEventHandlers.getonclose\"\n prim__onclose\n prim__setOnclose\n (v :> GlobalEventHandlers)\n \n export\n oncontextmenu : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n oncontextmenu v = fromNullablePrim \"GlobalEventHandlers.getoncontextmenu\"\n prim__oncontextmenu\n prim__setOncontextmenu\n (v :> GlobalEventHandlers)\n \n export\n oncuechange : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n oncuechange v = fromNullablePrim \"GlobalEventHandlers.getoncuechange\"\n prim__oncuechange\n prim__setOncuechange\n (v :> GlobalEventHandlers)\n \n export\n ondblclick : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe MouseEventHandler\n ondblclick v = fromNullablePrim \"GlobalEventHandlers.getondblclick\"\n prim__ondblclick\n prim__setOndblclick\n (v :> GlobalEventHandlers)\n \n export\n ondrag : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n ondrag v = fromNullablePrim \"GlobalEventHandlers.getondrag\"\n prim__ondrag\n prim__setOndrag\n (v :> GlobalEventHandlers)\n \n export\n ondragend : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n ondragend v = fromNullablePrim \"GlobalEventHandlers.getondragend\"\n prim__ondragend\n prim__setOndragend\n (v :> GlobalEventHandlers)\n \n export\n ondragenter : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n ondragenter v = fromNullablePrim \"GlobalEventHandlers.getondragenter\"\n prim__ondragenter\n prim__setOndragenter\n (v :> GlobalEventHandlers)\n \n export\n ondragleave : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n ondragleave v = fromNullablePrim \"GlobalEventHandlers.getondragleave\"\n prim__ondragleave\n prim__setOndragleave\n (v :> GlobalEventHandlers)\n \n export\n ondragover : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n ondragover v = fromNullablePrim \"GlobalEventHandlers.getondragover\"\n prim__ondragover\n prim__setOndragover\n (v :> GlobalEventHandlers)\n \n export\n ondragstart : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n ondragstart v = fromNullablePrim \"GlobalEventHandlers.getondragstart\"\n prim__ondragstart\n prim__setOndragstart\n (v :> GlobalEventHandlers)\n \n export\n ondrop : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n ondrop v = fromNullablePrim \"GlobalEventHandlers.getondrop\"\n prim__ondrop\n prim__setOndrop\n (v :> GlobalEventHandlers)\n \n export\n ondurationchange : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n ondurationchange v = fromNullablePrim \"GlobalEventHandlers.getondurationchange\"\n prim__ondurationchange\n prim__setOndurationchange\n (v :> GlobalEventHandlers)\n \n export\n onemptied : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onemptied v = fromNullablePrim \"GlobalEventHandlers.getonemptied\"\n prim__onemptied\n prim__setOnemptied\n (v :> GlobalEventHandlers)\n \n export\n onended : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onended v = fromNullablePrim \"GlobalEventHandlers.getonended\"\n prim__onended\n prim__setOnended\n (v :> GlobalEventHandlers)\n \n export\n onerror : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe OnErrorEventHandlerNonNull\n onerror v = fromNullablePrim \"GlobalEventHandlers.getonerror\"\n prim__onerror\n prim__setOnerror\n (v :> GlobalEventHandlers)\n \n export\n onfocus : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe FocusEventHandler\n onfocus v = fromNullablePrim \"GlobalEventHandlers.getonfocus\"\n prim__onfocus\n prim__setOnfocus\n (v :> GlobalEventHandlers)\n \n export\n onformdata : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onformdata v = fromNullablePrim \"GlobalEventHandlers.getonformdata\"\n prim__onformdata\n prim__setOnformdata\n (v :> GlobalEventHandlers)\n \n export\n oninput : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe InputEventHandler\n oninput v = fromNullablePrim \"GlobalEventHandlers.getoninput\"\n prim__oninput\n prim__setOninput\n (v :> GlobalEventHandlers)\n \n export\n oninvalid : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n oninvalid v = fromNullablePrim \"GlobalEventHandlers.getoninvalid\"\n prim__oninvalid\n prim__setOninvalid\n (v :> GlobalEventHandlers)\n \n export\n onkeydown : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe KeyboardEventHandler\n onkeydown v = fromNullablePrim \"GlobalEventHandlers.getonkeydown\"\n prim__onkeydown\n prim__setOnkeydown\n (v :> GlobalEventHandlers)\n \n export\n onkeypress : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onkeypress v = fromNullablePrim \"GlobalEventHandlers.getonkeypress\"\n prim__onkeypress\n prim__setOnkeypress\n (v :> GlobalEventHandlers)\n \n export\n onkeyup : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe KeyboardEventHandler\n onkeyup v = fromNullablePrim \"GlobalEventHandlers.getonkeyup\"\n prim__onkeyup\n prim__setOnkeyup\n (v :> GlobalEventHandlers)\n \n export\n onload : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe UIEventHandler\n onload v = fromNullablePrim \"GlobalEventHandlers.getonload\"\n prim__onload\n prim__setOnload\n (v :> GlobalEventHandlers)\n \n export\n onloadeddata : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onloadeddata v = fromNullablePrim \"GlobalEventHandlers.getonloadeddata\"\n prim__onloadeddata\n prim__setOnloadeddata\n (v :> GlobalEventHandlers)\n \n export\n onloadedmetadata : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onloadedmetadata v = fromNullablePrim \"GlobalEventHandlers.getonloadedmetadata\"\n prim__onloadedmetadata\n prim__setOnloadedmetadata\n (v :> GlobalEventHandlers)\n \n export\n onloadstart : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onloadstart v = fromNullablePrim \"GlobalEventHandlers.getonloadstart\"\n prim__onloadstart\n prim__setOnloadstart\n (v :> GlobalEventHandlers)\n \n export\n onmousedown : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe MouseEventHandler\n onmousedown v = fromNullablePrim \"GlobalEventHandlers.getonmousedown\"\n prim__onmousedown\n prim__setOnmousedown\n (v :> GlobalEventHandlers)\n \n export\n onmouseenter : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe MouseEventHandler\n onmouseenter v = fromNullablePrim \"GlobalEventHandlers.getonmouseenter\"\n prim__onmouseenter\n prim__setOnmouseenter\n (v :> GlobalEventHandlers)\n \n export\n onmouseleave : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe MouseEventHandler\n onmouseleave v = fromNullablePrim \"GlobalEventHandlers.getonmouseleave\"\n prim__onmouseleave\n prim__setOnmouseleave\n (v :> GlobalEventHandlers)\n \n export\n onmousemove : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe MouseEventHandler\n onmousemove v = fromNullablePrim \"GlobalEventHandlers.getonmousemove\"\n prim__onmousemove\n prim__setOnmousemove\n (v :> GlobalEventHandlers)\n \n export\n onmouseout : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe MouseEventHandler\n onmouseout v = fromNullablePrim \"GlobalEventHandlers.getonmouseout\"\n prim__onmouseout\n prim__setOnmouseout\n (v :> GlobalEventHandlers)\n \n export\n onmouseover : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe MouseEventHandler\n onmouseover v = fromNullablePrim \"GlobalEventHandlers.getonmouseover\"\n prim__onmouseover\n prim__setOnmouseover\n (v :> GlobalEventHandlers)\n \n export\n onmouseup : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe MouseEventHandler\n onmouseup v = fromNullablePrim \"GlobalEventHandlers.getonmouseup\"\n prim__onmouseup\n prim__setOnmouseup\n (v :> GlobalEventHandlers)\n \n export\n onpause : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onpause v = fromNullablePrim \"GlobalEventHandlers.getonpause\"\n prim__onpause\n prim__setOnpause\n (v :> GlobalEventHandlers)\n \n export\n onplay : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onplay v = fromNullablePrim \"GlobalEventHandlers.getonplay\"\n prim__onplay\n prim__setOnplay\n (v :> GlobalEventHandlers)\n \n export\n onplaying : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onplaying v = fromNullablePrim \"GlobalEventHandlers.getonplaying\"\n prim__onplaying\n prim__setOnplaying\n (v :> GlobalEventHandlers)\n \n export\n onprogress : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onprogress v = fromNullablePrim \"GlobalEventHandlers.getonprogress\"\n prim__onprogress\n prim__setOnprogress\n (v :> GlobalEventHandlers)\n \n export\n onratechange : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onratechange v = fromNullablePrim \"GlobalEventHandlers.getonratechange\"\n prim__onratechange\n prim__setOnratechange\n (v :> GlobalEventHandlers)\n \n export\n onreset : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onreset v = fromNullablePrim \"GlobalEventHandlers.getonreset\"\n prim__onreset\n prim__setOnreset\n (v :> GlobalEventHandlers)\n \n export\n onresize : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onresize v = fromNullablePrim \"GlobalEventHandlers.getonresize\"\n prim__onresize\n prim__setOnresize\n (v :> GlobalEventHandlers)\n \n export\n onscroll : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onscroll v = fromNullablePrim \"GlobalEventHandlers.getonscroll\"\n prim__onscroll\n prim__setOnscroll\n (v :> GlobalEventHandlers)\n \n export\n onsecuritypolicyviolation : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onsecuritypolicyviolation v = fromNullablePrim \"GlobalEventHandlers.getonsecuritypolicyviolation\"\n prim__onsecuritypolicyviolation\n prim__setOnsecuritypolicyviolation\n (v :> GlobalEventHandlers)\n \n export\n onseeked : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onseeked v = fromNullablePrim \"GlobalEventHandlers.getonseeked\"\n prim__onseeked\n prim__setOnseeked\n (v :> GlobalEventHandlers)\n \n export\n onseeking : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onseeking v = fromNullablePrim \"GlobalEventHandlers.getonseeking\"\n prim__onseeking\n prim__setOnseeking\n (v :> GlobalEventHandlers)\n \n export\n onselect : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe UIEventHandler\n onselect v = fromNullablePrim \"GlobalEventHandlers.getonselect\"\n prim__onselect\n prim__setOnselect\n (v :> GlobalEventHandlers)\n \n export\n onslotchange : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onslotchange v = fromNullablePrim \"GlobalEventHandlers.getonslotchange\"\n prim__onslotchange\n prim__setOnslotchange\n (v :> GlobalEventHandlers)\n \n export\n onstalled : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onstalled v = fromNullablePrim \"GlobalEventHandlers.getonstalled\"\n prim__onstalled\n prim__setOnstalled\n (v :> GlobalEventHandlers)\n \n export\n onsubmit : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onsubmit v = fromNullablePrim \"GlobalEventHandlers.getonsubmit\"\n prim__onsubmit\n prim__setOnsubmit\n (v :> GlobalEventHandlers)\n \n export\n onsuspend : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onsuspend v = fromNullablePrim \"GlobalEventHandlers.getonsuspend\"\n prim__onsuspend\n prim__setOnsuspend\n (v :> GlobalEventHandlers)\n \n export\n ontimeupdate : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n ontimeupdate v = fromNullablePrim \"GlobalEventHandlers.getontimeupdate\"\n prim__ontimeupdate\n prim__setOntimeupdate\n (v :> GlobalEventHandlers)\n \n export\n ontoggle : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n ontoggle v = fromNullablePrim \"GlobalEventHandlers.getontoggle\"\n prim__ontoggle\n prim__setOntoggle\n (v :> GlobalEventHandlers)\n \n export\n onvolumechange : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onvolumechange v = fromNullablePrim \"GlobalEventHandlers.getonvolumechange\"\n prim__onvolumechange\n prim__setOnvolumechange\n (v :> GlobalEventHandlers)\n \n export\n onwaiting : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onwaiting v = fromNullablePrim \"GlobalEventHandlers.getonwaiting\"\n prim__onwaiting\n prim__setOnwaiting\n (v :> GlobalEventHandlers)\n \n export\n onwebkitanimationend : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onwebkitanimationend v = fromNullablePrim \"GlobalEventHandlers.getonwebkitanimationend\"\n prim__onwebkitanimationend\n prim__setOnwebkitanimationend\n (v :> GlobalEventHandlers)\n \n export\n onwebkitanimationiteration : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onwebkitanimationiteration v = fromNullablePrim \"GlobalEventHandlers.getonwebkitanimationiteration\"\n prim__onwebkitanimationiteration\n prim__setOnwebkitanimationiteration\n (v :> GlobalEventHandlers)\n \n export\n onwebkitanimationstart : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onwebkitanimationstart v = fromNullablePrim \"GlobalEventHandlers.getonwebkitanimationstart\"\n prim__onwebkitanimationstart\n prim__setOnwebkitanimationstart\n (v :> GlobalEventHandlers)\n \n export\n onwebkittransitionend : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onwebkittransitionend v = fromNullablePrim \"GlobalEventHandlers.getonwebkittransitionend\"\n prim__onwebkittransitionend\n prim__setOnwebkittransitionend\n (v :> GlobalEventHandlers)\n \n export\n onwheel : (0 _ : JSType t)\n => {auto 0 _ : Elem GlobalEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe WheelEventHandler\n onwheel v = fromNullablePrim \"GlobalEventHandlers.getonwheel\"\n prim__onwheel\n prim__setOnwheel\n (v :> GlobalEventHandlers)\n\n\nnamespace HTMLHyperlinkElementUtils\n \n export\n hash : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLHyperlinkElementUtils (Types t)}\n -> t\n -> Attribute True I String\n hash v = fromPrim \"HTMLHyperlinkElementUtils.gethash\"\n prim__hash\n prim__setHash\n (v :> HTMLHyperlinkElementUtils)\n \n export\n host : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLHyperlinkElementUtils (Types t)}\n -> t\n -> Attribute True I String\n host v = fromPrim \"HTMLHyperlinkElementUtils.gethost\"\n prim__host\n prim__setHost\n (v :> HTMLHyperlinkElementUtils)\n \n export\n hostname : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLHyperlinkElementUtils (Types t)}\n -> t\n -> Attribute True I String\n hostname v = fromPrim \"HTMLHyperlinkElementUtils.gethostname\"\n prim__hostname\n prim__setHostname\n (v :> HTMLHyperlinkElementUtils)\n \n export\n href : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLHyperlinkElementUtils (Types t)}\n -> t\n -> Attribute True I String\n href v = fromPrim \"HTMLHyperlinkElementUtils.gethref\"\n prim__href\n prim__setHref\n (v :> HTMLHyperlinkElementUtils)\n \n export\n origin : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLHyperlinkElementUtils (Types t1)}\n -> (obj : t1)\n -> JSIO String\n origin a = primJS $ HTMLHyperlinkElementUtils.prim__origin (up a)\n \n export\n password : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLHyperlinkElementUtils (Types t)}\n -> t\n -> Attribute True I String\n password v = fromPrim \"HTMLHyperlinkElementUtils.getpassword\"\n prim__password\n prim__setPassword\n (v :> HTMLHyperlinkElementUtils)\n \n export\n pathname : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLHyperlinkElementUtils (Types t)}\n -> t\n -> Attribute True I String\n pathname v = fromPrim \"HTMLHyperlinkElementUtils.getpathname\"\n prim__pathname\n prim__setPathname\n (v :> HTMLHyperlinkElementUtils)\n \n export\n port : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLHyperlinkElementUtils (Types t)}\n -> t\n -> Attribute True I String\n port v = fromPrim \"HTMLHyperlinkElementUtils.getport\"\n prim__port\n prim__setPort\n (v :> HTMLHyperlinkElementUtils)\n \n export\n protocol : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLHyperlinkElementUtils (Types t)}\n -> t\n -> Attribute True I String\n protocol v = fromPrim \"HTMLHyperlinkElementUtils.getprotocol\"\n prim__protocol\n prim__setProtocol\n (v :> HTMLHyperlinkElementUtils)\n \n export\n search : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLHyperlinkElementUtils (Types t)}\n -> t\n -> Attribute True I String\n search v = fromPrim \"HTMLHyperlinkElementUtils.getsearch\"\n prim__search\n prim__setSearch\n (v :> HTMLHyperlinkElementUtils)\n \n export\n username : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLHyperlinkElementUtils (Types t)}\n -> t\n -> Attribute True I String\n username v = fromPrim \"HTMLHyperlinkElementUtils.getusername\"\n prim__username\n prim__setUsername\n (v :> HTMLHyperlinkElementUtils)\n\n\nnamespace HTMLOrSVGElement\n \n export\n autofocus : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLOrSVGElement (Types t)}\n -> t\n -> Attribute True I Bool\n autofocus v = fromPrim \"HTMLOrSVGElement.getautofocus\"\n prim__autofocus\n prim__setAutofocus\n (v :> HTMLOrSVGElement)\n \n export\n dataset : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLOrSVGElement (Types t1)}\n -> (obj : t1)\n -> JSIO DOMStringMap\n dataset a = primJS $ HTMLOrSVGElement.prim__dataset (up a)\n \n export\n nonce : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLOrSVGElement (Types t)}\n -> t\n -> Attribute True I String\n nonce v = fromPrim \"HTMLOrSVGElement.getnonce\"\n prim__nonce\n prim__setNonce\n (v :> HTMLOrSVGElement)\n \n export\n tabIndex : (0 _ : JSType t)\n => {auto 0 _ : Elem HTMLOrSVGElement (Types t)}\n -> t\n -> Attribute True I Int32\n tabIndex v = fromPrim \"HTMLOrSVGElement.gettabIndex\"\n prim__tabIndex\n prim__setTabIndex\n (v :> HTMLOrSVGElement)\n \n export\n blur : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLOrSVGElement (Types t1)}\n -> (obj : t1)\n -> JSIO ()\n blur a = primJS $ HTMLOrSVGElement.prim__blur (up a)\n \n export\n focus : (0 _ : JSType t1)\n => (0 _ : JSType t2)\n => {auto 0 _ : Elem HTMLOrSVGElement (Types t1)}\n -> {auto 0 _ : Elem FocusOptions (Types t2)}\n -> (obj : t1)\n -> (options : Optional t2)\n -> JSIO ()\n focus a b = primJS $ HTMLOrSVGElement.prim__focus (up a) (optUp b)\n\n export\n focus' : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLOrSVGElement (Types t1)}\n -> (obj : t1)\n -> JSIO ()\n focus' a = primJS $ HTMLOrSVGElement.prim__focus (up a) undef\n\n\nnamespace NavigatorConcurrentHardware\n \n export\n hardwareConcurrency : (0 _ : JSType t1)\n => {auto 0 _ : Elem NavigatorConcurrentHardware (Types t1)}\n -> (obj : t1)\n -> JSIO JSBits64\n hardwareConcurrency a = primJS\n $ NavigatorConcurrentHardware.prim__hardwareConcurrency (up a)\n\n\nnamespace NavigatorContentUtils\n \n export\n registerProtocolHandler : (0 _ : JSType t1)\n => {auto 0 _ : Elem NavigatorContentUtils (Types t1)}\n -> (obj : t1)\n -> (scheme : String)\n -> (url : String)\n -> JSIO ()\n registerProtocolHandler a b c = primJS\n $ NavigatorContentUtils.prim__registerProtocolHandler (up a)\n b\n c\n \n export\n unregisterProtocolHandler : (0 _ : JSType t1)\n => {auto 0 _ : Elem NavigatorContentUtils (Types t1)}\n -> (obj : t1)\n -> (scheme : String)\n -> (url : String)\n -> JSIO ()\n unregisterProtocolHandler a b c = primJS\n $ NavigatorContentUtils.prim__unregisterProtocolHandler (up a)\n b\n c\n\n\nnamespace NavigatorCookies\n \n export\n cookieEnabled : (0 _ : JSType t1)\n => {auto 0 _ : Elem NavigatorCookies (Types t1)}\n -> (obj : t1)\n -> JSIO Bool\n cookieEnabled a = tryJS \"NavigatorCookies.cookieEnabled\"\n $ NavigatorCookies.prim__cookieEnabled (up a)\n\n\nnamespace NavigatorID\n \n export\n appCodeName : (0 _ : JSType t1)\n => {auto 0 _ : Elem NavigatorID (Types t1)}\n -> (obj : t1)\n -> JSIO String\n appCodeName a = primJS $ NavigatorID.prim__appCodeName (up a)\n \n export\n appName : (0 _ : JSType t1)\n => {auto 0 _ : Elem NavigatorID (Types t1)}\n -> (obj : t1)\n -> JSIO String\n appName a = primJS $ NavigatorID.prim__appName (up a)\n \n export\n appVersion : (0 _ : JSType t1)\n => {auto 0 _ : Elem NavigatorID (Types t1)}\n -> (obj : t1)\n -> JSIO String\n appVersion a = primJS $ NavigatorID.prim__appVersion (up a)\n \n export\n platform : (0 _ : JSType t1)\n => {auto 0 _ : Elem NavigatorID (Types t1)}\n -> (obj : t1)\n -> JSIO String\n platform a = primJS $ NavigatorID.prim__platform (up a)\n \n export\n product : (0 _ : JSType t1)\n => {auto 0 _ : Elem NavigatorID (Types t1)}\n -> (obj : t1)\n -> JSIO String\n product a = primJS $ NavigatorID.prim__product (up a)\n \n export\n productSub : (0 _ : JSType t1)\n => {auto 0 _ : Elem NavigatorID (Types t1)}\n -> (obj : t1)\n -> JSIO String\n productSub a = primJS $ NavigatorID.prim__productSub (up a)\n \n export\n userAgent : (0 _ : JSType t1)\n => {auto 0 _ : Elem NavigatorID (Types t1)}\n -> (obj : t1)\n -> JSIO String\n userAgent a = primJS $ NavigatorID.prim__userAgent (up a)\n \n export\n vendor : (0 _ : JSType t1)\n => {auto 0 _ : Elem NavigatorID (Types t1)}\n -> (obj : t1)\n -> JSIO String\n vendor a = primJS $ NavigatorID.prim__vendor (up a)\n \n export\n vendorSub : (0 _ : JSType t1)\n => {auto 0 _ : Elem NavigatorID (Types t1)}\n -> (obj : t1)\n -> JSIO String\n vendorSub a = primJS $ NavigatorID.prim__vendorSub (up a)\n\n\nnamespace NavigatorLanguage\n \n export\n language : (0 _ : JSType t1)\n => {auto 0 _ : Elem NavigatorLanguage (Types t1)}\n -> (obj : t1)\n -> JSIO String\n language a = primJS $ NavigatorLanguage.prim__language (up a)\n \n export\n languages : (0 _ : JSType t1)\n => {auto 0 _ : Elem NavigatorLanguage (Types t1)}\n -> (obj : t1)\n -> JSIO (Array String)\n languages a = primJS $ NavigatorLanguage.prim__languages (up a)\n\n\nnamespace NavigatorOnLine\n \n export\n onLine : (0 _ : JSType t1)\n => {auto 0 _ : Elem NavigatorOnLine (Types t1)}\n -> (obj : t1)\n -> JSIO Bool\n onLine a = tryJS \"NavigatorOnLine.onLine\"\n $ NavigatorOnLine.prim__onLine (up a)\n\n\nnamespace NavigatorPlugins\n \n export\n mimeTypes : (0 _ : JSType t1)\n => {auto 0 _ : Elem NavigatorPlugins (Types t1)}\n -> (obj : t1)\n -> JSIO MimeTypeArray\n mimeTypes a = primJS $ NavigatorPlugins.prim__mimeTypes (up a)\n \n export\n plugins : (0 _ : JSType t1)\n => {auto 0 _ : Elem NavigatorPlugins (Types t1)}\n -> (obj : t1)\n -> JSIO PluginArray\n plugins a = primJS $ NavigatorPlugins.prim__plugins (up a)\n \n export\n javaEnabled : (0 _ : JSType t1)\n => {auto 0 _ : Elem NavigatorPlugins (Types t1)}\n -> (obj : t1)\n -> JSIO Bool\n javaEnabled a = tryJS \"NavigatorPlugins.javaEnabled\"\n $ NavigatorPlugins.prim__javaEnabled (up a)\n\n\nnamespace WindowEventHandlers\n \n export\n onafterprint : (0 _ : JSType t)\n => {auto 0 _ : Elem WindowEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onafterprint v = fromNullablePrim \"WindowEventHandlers.getonafterprint\"\n prim__onafterprint\n prim__setOnafterprint\n (v :> WindowEventHandlers)\n \n export\n onbeforeprint : (0 _ : JSType t)\n => {auto 0 _ : Elem WindowEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onbeforeprint v = fromNullablePrim \"WindowEventHandlers.getonbeforeprint\"\n prim__onbeforeprint\n prim__setOnbeforeprint\n (v :> WindowEventHandlers)\n \n export\n onbeforeunload : (0 _ : JSType t)\n => {auto 0 _ : Elem WindowEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe OnBeforeUnloadEventHandlerNonNull\n onbeforeunload v = fromNullablePrim \"WindowEventHandlers.getonbeforeunload\"\n prim__onbeforeunload\n prim__setOnbeforeunload\n (v :> WindowEventHandlers)\n \n export\n onhashchange : (0 _ : JSType t)\n => {auto 0 _ : Elem WindowEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onhashchange v = fromNullablePrim \"WindowEventHandlers.getonhashchange\"\n prim__onhashchange\n prim__setOnhashchange\n (v :> WindowEventHandlers)\n \n export\n onlanguagechange : (0 _ : JSType t)\n => {auto 0 _ : Elem WindowEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onlanguagechange v = fromNullablePrim \"WindowEventHandlers.getonlanguagechange\"\n prim__onlanguagechange\n prim__setOnlanguagechange\n (v :> WindowEventHandlers)\n \n export\n onmessage : (0 _ : JSType t)\n => {auto 0 _ : Elem WindowEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onmessage v = fromNullablePrim \"WindowEventHandlers.getonmessage\"\n prim__onmessage\n prim__setOnmessage\n (v :> WindowEventHandlers)\n \n export\n onmessageerror : (0 _ : JSType t)\n => {auto 0 _ : Elem WindowEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onmessageerror v = fromNullablePrim \"WindowEventHandlers.getonmessageerror\"\n prim__onmessageerror\n prim__setOnmessageerror\n (v :> WindowEventHandlers)\n \n export\n onoffline : (0 _ : JSType t)\n => {auto 0 _ : Elem WindowEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onoffline v = fromNullablePrim \"WindowEventHandlers.getonoffline\"\n prim__onoffline\n prim__setOnoffline\n (v :> WindowEventHandlers)\n \n export\n ononline : (0 _ : JSType t)\n => {auto 0 _ : Elem WindowEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n ononline v = fromNullablePrim \"WindowEventHandlers.getononline\"\n prim__ononline\n prim__setOnonline\n (v :> WindowEventHandlers)\n \n export\n onpagehide : (0 _ : JSType t)\n => {auto 0 _ : Elem WindowEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onpagehide v = fromNullablePrim \"WindowEventHandlers.getonpagehide\"\n prim__onpagehide\n prim__setOnpagehide\n (v :> WindowEventHandlers)\n \n export\n onpageshow : (0 _ : JSType t)\n => {auto 0 _ : Elem WindowEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onpageshow v = fromNullablePrim \"WindowEventHandlers.getonpageshow\"\n prim__onpageshow\n prim__setOnpageshow\n (v :> WindowEventHandlers)\n \n export\n onpopstate : (0 _ : JSType t)\n => {auto 0 _ : Elem WindowEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onpopstate v = fromNullablePrim \"WindowEventHandlers.getonpopstate\"\n prim__onpopstate\n prim__setOnpopstate\n (v :> WindowEventHandlers)\n \n export\n onrejectionhandled : (0 _ : JSType t)\n => {auto 0 _ : Elem WindowEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onrejectionhandled v = fromNullablePrim \"WindowEventHandlers.getonrejectionhandled\"\n prim__onrejectionhandled\n prim__setOnrejectionhandled\n (v :> WindowEventHandlers)\n \n export\n onstorage : (0 _ : JSType t)\n => {auto 0 _ : Elem WindowEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onstorage v = fromNullablePrim \"WindowEventHandlers.getonstorage\"\n prim__onstorage\n prim__setOnstorage\n (v :> WindowEventHandlers)\n \n export\n onunhandledrejection : (0 _ : JSType t)\n => {auto 0 _ : Elem WindowEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe EventHandlerNonNull\n onunhandledrejection v = fromNullablePrim \"WindowEventHandlers.getonunhandledrejection\"\n prim__onunhandledrejection\n prim__setOnunhandledrejection\n (v :> WindowEventHandlers)\n \n export\n onunload : (0 _ : JSType t)\n => {auto 0 _ : Elem WindowEventHandlers (Types t)}\n -> t\n -> Attribute False Maybe UIEventHandler\n onunload v = fromNullablePrim \"WindowEventHandlers.getonunload\"\n prim__onunload\n prim__setOnunload\n (v :> WindowEventHandlers)\n\n\n\n--------------------------------------------------------------------------------\n-- Dictionaries\n--------------------------------------------------------------------------------\n\nnamespace AssignedNodesOptions\n \n export\n new : (flatten : Optional Bool) -> JSIO AssignedNodesOptions\n new a = primJS $ AssignedNodesOptions.prim__new (toFFI a)\n\n export\n new' : JSIO AssignedNodesOptions\n new' = primJS $ AssignedNodesOptions.prim__new undef\n \n export\n flatten : (0 _ : JSType t)\n => {auto 0 _ : Elem AssignedNodesOptions (Types t)}\n -> t\n -> Attribute True Optional Bool\n flatten v = fromUndefOrPrim \"AssignedNodesOptions.getflatten\"\n prim__flatten\n prim__setFlatten\n False\n (v :> AssignedNodesOptions)\n\n\nnamespace CanvasRenderingContext2DSettings\n \n export\n new : (alpha : Optional Bool)\n -> (desynchronized : Optional Bool)\n -> JSIO CanvasRenderingContext2DSettings\n new a b = primJS\n $ CanvasRenderingContext2DSettings.prim__new (toFFI a) (toFFI b)\n\n export\n new' : JSIO CanvasRenderingContext2DSettings\n new' = primJS $ CanvasRenderingContext2DSettings.prim__new undef undef\n \n export\n alpha : (0 _ : JSType t)\n => {auto 0 _ : Elem CanvasRenderingContext2DSettings (Types t)}\n -> t\n -> Attribute True Optional Bool\n alpha v = fromUndefOrPrim \"CanvasRenderingContext2DSettings.getalpha\"\n prim__alpha\n prim__setAlpha\n True\n (v :> CanvasRenderingContext2DSettings)\n \n export\n desynchronized : (0 _ : JSType t)\n => {auto 0 _ : Elem CanvasRenderingContext2DSettings (Types t)}\n -> t\n -> Attribute True Optional Bool\n desynchronized v = fromUndefOrPrim \"CanvasRenderingContext2DSettings.getdesynchronized\"\n prim__desynchronized\n prim__setDesynchronized\n False\n (v :> CanvasRenderingContext2DSettings)\n\n\nnamespace CloseEventInit\n \n export\n new : (wasClean : Optional Bool)\n -> (code : Optional Bits16)\n -> (reason : Optional String)\n -> JSIO CloseEventInit\n new a b c = primJS $ CloseEventInit.prim__new (toFFI a) (toFFI b) (toFFI c)\n\n export\n new' : JSIO CloseEventInit\n new' = primJS $ CloseEventInit.prim__new undef undef undef\n \n export\n code : (0 _ : JSType t)\n => {auto 0 _ : Elem CloseEventInit (Types t)}\n -> t\n -> Attribute True Optional Bits16\n code v = fromUndefOrPrim \"CloseEventInit.getcode\"\n prim__code\n prim__setCode\n 0\n (v :> CloseEventInit)\n \n export\n reason : (0 _ : JSType t)\n => {auto 0 _ : Elem CloseEventInit (Types t)}\n -> t\n -> Attribute True Optional String\n reason v = fromUndefOrPrim \"CloseEventInit.getreason\"\n prim__reason\n prim__setReason\n \"\"\n (v :> CloseEventInit)\n \n export\n wasClean : (0 _ : JSType t)\n => {auto 0 _ : Elem CloseEventInit (Types t)}\n -> t\n -> Attribute True Optional Bool\n wasClean v = fromUndefOrPrim \"CloseEventInit.getwasClean\"\n prim__wasClean\n prim__setWasClean\n False\n (v :> CloseEventInit)\n\n\nnamespace DragEventInit\n \n export\n new : (dataTransfer : Optional (Maybe DataTransfer)) -> JSIO DragEventInit\n new a = primJS $ DragEventInit.prim__new (toFFI a)\n\n export\n new' : JSIO DragEventInit\n new' = primJS $ DragEventInit.prim__new undef\n \n export\n dataTransfer : (0 _ : JSType t)\n => {auto 0 _ : Elem DragEventInit (Types t)}\n -> t\n -> Attribute True Optional (Maybe DataTransfer)\n dataTransfer v = fromUndefOrPrim \"DragEventInit.getdataTransfer\"\n prim__dataTransfer\n prim__setDataTransfer\n Nothing\n (v :> DragEventInit)\n\n\nnamespace ElementDefinitionOptions\n \n export\n new : (extends : Optional String) -> JSIO ElementDefinitionOptions\n new a = primJS $ ElementDefinitionOptions.prim__new (toFFI a)\n\n export\n new' : JSIO ElementDefinitionOptions\n new' = primJS $ ElementDefinitionOptions.prim__new undef\n \n export\n extends : (0 _ : JSType t)\n => {auto 0 _ : Elem ElementDefinitionOptions (Types t)}\n -> t\n -> Attribute False Optional String\n extends v = fromUndefOrPrimNoDefault \"ElementDefinitionOptions.getextends\"\n prim__extends\n prim__setExtends\n (v :> ElementDefinitionOptions)\n\n\nnamespace ErrorEventInit\n \n export\n new : (message : Optional String)\n -> (filename : Optional String)\n -> (lineno : Optional Bits32)\n -> (colno : Optional Bits32)\n -> (error : Optional Any)\n -> JSIO ErrorEventInit\n new a b c d e = primJS\n $ ErrorEventInit.prim__new (toFFI a)\n (toFFI b)\n (toFFI c)\n (toFFI d)\n (toFFI e)\n\n export\n new' : JSIO ErrorEventInit\n new' = primJS $ ErrorEventInit.prim__new undef undef undef undef undef\n \n export\n colno : (0 _ : JSType t)\n => {auto 0 _ : Elem ErrorEventInit (Types t)}\n -> t\n -> Attribute True Optional Bits32\n colno v = fromUndefOrPrim \"ErrorEventInit.getcolno\"\n prim__colno\n prim__setColno\n 0\n (v :> ErrorEventInit)\n \n export\n error : (0 _ : JSType t)\n => {auto 0 _ : Elem ErrorEventInit (Types t)}\n -> t\n -> Attribute True Optional Any\n error v = fromUndefOrPrim \"ErrorEventInit.geterror\"\n prim__error\n prim__setError\n (MkAny $ null {a = ()})\n (v :> ErrorEventInit)\n \n export\n filename : (0 _ : JSType t)\n => {auto 0 _ : Elem ErrorEventInit (Types t)}\n -> t\n -> Attribute True Optional String\n filename v = fromUndefOrPrim \"ErrorEventInit.getfilename\"\n prim__filename\n prim__setFilename\n \"\"\n (v :> ErrorEventInit)\n \n export\n lineno : (0 _ : JSType t)\n => {auto 0 _ : Elem ErrorEventInit (Types t)}\n -> t\n -> Attribute True Optional Bits32\n lineno v = fromUndefOrPrim \"ErrorEventInit.getlineno\"\n prim__lineno\n prim__setLineno\n 0\n (v :> ErrorEventInit)\n \n export\n message : (0 _ : JSType t)\n => {auto 0 _ : Elem ErrorEventInit (Types t)}\n -> t\n -> Attribute True Optional String\n message v = fromUndefOrPrim \"ErrorEventInit.getmessage\"\n prim__message\n prim__setMessage\n \"\"\n (v :> ErrorEventInit)\n\n\nnamespace EventSourceInit\n \n export\n new : (withCredentials : Optional Bool) -> JSIO EventSourceInit\n new a = primJS $ EventSourceInit.prim__new (toFFI a)\n\n export\n new' : JSIO EventSourceInit\n new' = primJS $ EventSourceInit.prim__new undef\n \n export\n withCredentials : (0 _ : JSType t)\n => {auto 0 _ : Elem EventSourceInit (Types t)}\n -> t\n -> Attribute True Optional Bool\n withCredentials v = fromUndefOrPrim \"EventSourceInit.getwithCredentials\"\n prim__withCredentials\n prim__setWithCredentials\n False\n (v :> EventSourceInit)\n\n\nnamespace FocusOptions\n \n export\n new : (preventScroll : Optional Bool) -> JSIO FocusOptions\n new a = primJS $ FocusOptions.prim__new (toFFI a)\n\n export\n new' : JSIO FocusOptions\n new' = primJS $ FocusOptions.prim__new undef\n \n export\n preventScroll : (0 _ : JSType t)\n => {auto 0 _ : Elem FocusOptions (Types t)}\n -> t\n -> Attribute True Optional Bool\n preventScroll v = fromUndefOrPrim \"FocusOptions.getpreventScroll\"\n prim__preventScroll\n prim__setPreventScroll\n False\n (v :> FocusOptions)\n\n\nnamespace FormDataEventInit\n \n export\n new : (formData : FormData) -> JSIO FormDataEventInit\n new a = primJS $ FormDataEventInit.prim__new a\n \n export\n formData : (0 _ : JSType t)\n => {auto 0 _ : Elem FormDataEventInit (Types t)}\n -> t\n -> Attribute True I FormData\n formData v = fromPrim \"FormDataEventInit.getformData\"\n prim__formData\n prim__setFormData\n (v :> FormDataEventInit)\n\n\nnamespace HashChangeEventInit\n \n export\n new : (oldURL : Optional String)\n -> (newURL : Optional String)\n -> JSIO HashChangeEventInit\n new a b = primJS $ HashChangeEventInit.prim__new (toFFI a) (toFFI b)\n\n export\n new' : JSIO HashChangeEventInit\n new' = primJS $ HashChangeEventInit.prim__new undef undef\n \n export\n newURL : (0 _ : JSType t)\n => {auto 0 _ : Elem HashChangeEventInit (Types t)}\n -> t\n -> Attribute True Optional String\n newURL v = fromUndefOrPrim \"HashChangeEventInit.getnewURL\"\n prim__newURL\n prim__setNewURL\n \"\"\n (v :> HashChangeEventInit)\n \n export\n oldURL : (0 _ : JSType t)\n => {auto 0 _ : Elem HashChangeEventInit (Types t)}\n -> t\n -> Attribute True Optional String\n oldURL v = fromUndefOrPrim \"HashChangeEventInit.getoldURL\"\n prim__oldURL\n prim__setOldURL\n \"\"\n (v :> HashChangeEventInit)\n\n\nnamespace ImageBitmapOptions\n \n export\n new : (imageOrientation : Optional ImageOrientation)\n -> (premultiplyAlpha : Optional PremultiplyAlpha)\n -> (colorSpaceConversion : Optional ColorSpaceConversion)\n -> (resizeWidth : Optional Bits32)\n -> (resizeHeight : Optional Bits32)\n -> (resizeQuality : Optional ResizeQuality)\n -> JSIO ImageBitmapOptions\n new a b c d e f = primJS\n $ ImageBitmapOptions.prim__new (toFFI a)\n (toFFI b)\n (toFFI c)\n (toFFI d)\n (toFFI e)\n (toFFI f)\n\n export\n new' : JSIO ImageBitmapOptions\n new' = primJS\n $ ImageBitmapOptions.prim__new undef undef undef undef undef undef\n \n export\n colorSpaceConversion : (0 _ : JSType t)\n => {auto 0 _ : Elem ImageBitmapOptions (Types t)}\n -> t\n -> Attribute False Optional ColorSpaceConversion\n colorSpaceConversion v = fromUndefOrPrimNoDefault \"ImageBitmapOptions.getcolorSpaceConversion\"\n prim__colorSpaceConversion\n prim__setColorSpaceConversion\n (v :> ImageBitmapOptions)\n \n export\n imageOrientation : (0 _ : JSType t)\n => {auto 0 _ : Elem ImageBitmapOptions (Types t)}\n -> t\n -> Attribute False Optional ImageOrientation\n imageOrientation v = fromUndefOrPrimNoDefault \"ImageBitmapOptions.getimageOrientation\"\n prim__imageOrientation\n prim__setImageOrientation\n (v :> ImageBitmapOptions)\n \n export\n premultiplyAlpha : (0 _ : JSType t)\n => {auto 0 _ : Elem ImageBitmapOptions (Types t)}\n -> t\n -> Attribute False Optional PremultiplyAlpha\n premultiplyAlpha v = fromUndefOrPrimNoDefault \"ImageBitmapOptions.getpremultiplyAlpha\"\n prim__premultiplyAlpha\n prim__setPremultiplyAlpha\n (v :> ImageBitmapOptions)\n \n export\n resizeHeight : (0 _ : JSType t)\n => {auto 0 _ : Elem ImageBitmapOptions (Types t)}\n -> t\n -> Attribute False Optional Bits32\n resizeHeight v = fromUndefOrPrimNoDefault \"ImageBitmapOptions.getresizeHeight\"\n prim__resizeHeight\n prim__setResizeHeight\n (v :> ImageBitmapOptions)\n \n export\n resizeQuality : (0 _ : JSType t)\n => {auto 0 _ : Elem ImageBitmapOptions (Types t)}\n -> t\n -> Attribute False Optional ResizeQuality\n resizeQuality v = fromUndefOrPrimNoDefault \"ImageBitmapOptions.getresizeQuality\"\n prim__resizeQuality\n prim__setResizeQuality\n (v :> ImageBitmapOptions)\n \n export\n resizeWidth : (0 _ : JSType t)\n => {auto 0 _ : Elem ImageBitmapOptions (Types t)}\n -> t\n -> Attribute False Optional Bits32\n resizeWidth v = fromUndefOrPrimNoDefault \"ImageBitmapOptions.getresizeWidth\"\n prim__resizeWidth\n prim__setResizeWidth\n (v :> ImageBitmapOptions)\n\n\nnamespace ImageBitmapRenderingContextSettings\n \n export\n new : (alpha : Optional Bool) -> JSIO ImageBitmapRenderingContextSettings\n new a = primJS $ ImageBitmapRenderingContextSettings.prim__new (toFFI a)\n\n export\n new' : JSIO ImageBitmapRenderingContextSettings\n new' = primJS $ ImageBitmapRenderingContextSettings.prim__new undef\n \n export\n alpha : (0 _ : JSType t)\n => {auto 0 _ : Elem ImageBitmapRenderingContextSettings (Types t)}\n -> t\n -> Attribute True Optional Bool\n alpha v = fromUndefOrPrim \"ImageBitmapRenderingContextSettings.getalpha\"\n prim__alpha\n prim__setAlpha\n True\n (v :> ImageBitmapRenderingContextSettings)\n\n\nnamespace ImageEncodeOptions\n \n export\n new : (type : Optional String)\n -> (quality : Optional Double)\n -> JSIO ImageEncodeOptions\n new a b = primJS $ ImageEncodeOptions.prim__new (toFFI a) (toFFI b)\n\n export\n new' : JSIO ImageEncodeOptions\n new' = primJS $ ImageEncodeOptions.prim__new undef undef\n \n export\n quality : (0 _ : JSType t)\n => {auto 0 _ : Elem ImageEncodeOptions (Types t)}\n -> t\n -> Attribute False Optional Double\n quality v = fromUndefOrPrimNoDefault \"ImageEncodeOptions.getquality\"\n prim__quality\n prim__setQuality\n (v :> ImageEncodeOptions)\n \n export\n type : (0 _ : JSType t)\n => {auto 0 _ : Elem ImageEncodeOptions (Types t)}\n -> t\n -> Attribute True Optional String\n type v = fromUndefOrPrim \"ImageEncodeOptions.gettype\"\n prim__type\n prim__setType\n \"image\/png\"\n (v :> ImageEncodeOptions)\n\n\nnamespace MessageEventInit\n \n export\n new : (data_ : Optional Any)\n -> (origin : Optional String)\n -> (lastEventId : Optional String)\n -> (source : Optional (Maybe (NS I [ WindowProxy\n , MessagePort\n , ServiceWorker\n ])))\n -> (ports : Optional (Array MessagePort))\n -> JSIO MessageEventInit\n new a b c d e = primJS\n $ MessageEventInit.prim__new (toFFI a)\n (toFFI b)\n (toFFI c)\n (toFFI d)\n (toFFI e)\n\n export\n new' : JSIO MessageEventInit\n new' = primJS $ MessageEventInit.prim__new undef undef undef undef undef\n \n export\n data_ : (0 _ : JSType t)\n => {auto 0 _ : Elem MessageEventInit (Types t)}\n -> t\n -> Attribute True Optional Any\n data_ v = fromUndefOrPrim \"MessageEventInit.getdata\"\n prim__data\n prim__setData\n (MkAny $ null {a = ()})\n (v :> MessageEventInit)\n \n export\n lastEventId : (0 _ : JSType t)\n => {auto 0 _ : Elem MessageEventInit (Types t)}\n -> t\n -> Attribute True Optional String\n lastEventId v = fromUndefOrPrim \"MessageEventInit.getlastEventId\"\n prim__lastEventId\n prim__setLastEventId\n \"\"\n (v :> MessageEventInit)\n \n export\n origin : (0 _ : JSType t)\n => {auto 0 _ : Elem MessageEventInit (Types t)}\n -> t\n -> Attribute True Optional String\n origin v = fromUndefOrPrim \"MessageEventInit.getorigin\"\n prim__origin\n prim__setOrigin\n \"\"\n (v :> MessageEventInit)\n \n export\n ports : (0 _ : JSType t)\n => {auto 0 _ : Elem MessageEventInit (Types t)}\n -> t\n -> Attribute False Optional (Array MessagePort)\n ports v = fromUndefOrPrimNoDefault \"MessageEventInit.getports\"\n prim__ports\n prim__setPorts\n (v :> MessageEventInit)\n \n export\n source : (0 _ : JSType t)\n => {auto 0 _ : Elem MessageEventInit (Types t)}\n -> t\n -> Attribute True Optional (Maybe (Union3 WindowProxy\n MessagePort\n ServiceWorker))\n source v = fromUndefOrPrim \"MessageEventInit.getsource\"\n prim__source\n prim__setSource\n Nothing\n (v :> MessageEventInit)\n\n\nnamespace PageTransitionEventInit\n \n export\n new : (persisted : Optional Bool) -> JSIO PageTransitionEventInit\n new a = primJS $ PageTransitionEventInit.prim__new (toFFI a)\n\n export\n new' : JSIO PageTransitionEventInit\n new' = primJS $ PageTransitionEventInit.prim__new undef\n \n export\n persisted : (0 _ : JSType t)\n => {auto 0 _ : Elem PageTransitionEventInit (Types t)}\n -> t\n -> Attribute True Optional Bool\n persisted v = fromUndefOrPrim \"PageTransitionEventInit.getpersisted\"\n prim__persisted\n prim__setPersisted\n False\n (v :> PageTransitionEventInit)\n\n\nnamespace PopStateEventInit\n \n export\n new : (state : Optional Any) -> JSIO PopStateEventInit\n new a = primJS $ PopStateEventInit.prim__new (toFFI a)\n\n export\n new' : JSIO PopStateEventInit\n new' = primJS $ PopStateEventInit.prim__new undef\n \n export\n state : (0 _ : JSType t)\n => {auto 0 _ : Elem PopStateEventInit (Types t)}\n -> t\n -> Attribute True Optional Any\n state v = fromUndefOrPrim \"PopStateEventInit.getstate\"\n prim__state\n prim__setState\n (MkAny $ null {a = ()})\n (v :> PopStateEventInit)\n\n\nnamespace PostMessageOptions\n \n export\n new : (transfer : Optional (Array Object)) -> JSIO PostMessageOptions\n new a = primJS $ PostMessageOptions.prim__new (toFFI a)\n\n export\n new' : JSIO PostMessageOptions\n new' = primJS $ PostMessageOptions.prim__new undef\n \n export\n transfer : (0 _ : JSType t)\n => {auto 0 _ : Elem PostMessageOptions (Types t)}\n -> t\n -> Attribute False Optional (Array Object)\n transfer v = fromUndefOrPrimNoDefault \"PostMessageOptions.gettransfer\"\n prim__transfer\n prim__setTransfer\n (v :> PostMessageOptions)\n\n\nnamespace PromiseRejectionEventInit\n \n export\n new : (promise : Promise AnyPtr)\n -> (reason : Optional Any)\n -> JSIO PromiseRejectionEventInit\n new a b = primJS $ PromiseRejectionEventInit.prim__new a (toFFI b)\n\n export\n new' : (promise : Promise AnyPtr) -> JSIO PromiseRejectionEventInit\n new' a = primJS $ PromiseRejectionEventInit.prim__new a undef\n \n export\n promise : (0 _ : JSType t)\n => {auto 0 _ : Elem PromiseRejectionEventInit (Types t)}\n -> t\n -> Attribute True I (Promise AnyPtr)\n promise v = fromPrim \"PromiseRejectionEventInit.getpromise\"\n prim__promise\n prim__setPromise\n (v :> PromiseRejectionEventInit)\n \n export\n reason : (0 _ : JSType t)\n => {auto 0 _ : Elem PromiseRejectionEventInit (Types t)}\n -> t\n -> Attribute False Optional Any\n reason v = fromUndefOrPrimNoDefault \"PromiseRejectionEventInit.getreason\"\n prim__reason\n prim__setReason\n (v :> PromiseRejectionEventInit)\n\n\nnamespace StorageEventInit\n \n export\n new : (key : Optional (Maybe String))\n -> (oldValue : Optional (Maybe String))\n -> (newValue : Optional (Maybe String))\n -> (url : Optional String)\n -> (storageArea : Optional (Maybe Storage))\n -> JSIO StorageEventInit\n new a b c d e = primJS\n $ StorageEventInit.prim__new (toFFI a)\n (toFFI b)\n (toFFI c)\n (toFFI d)\n (toFFI e)\n\n export\n new' : JSIO StorageEventInit\n new' = primJS $ StorageEventInit.prim__new undef undef undef undef undef\n \n export\n key : (0 _ : JSType t)\n => {auto 0 _ : Elem StorageEventInit (Types t)}\n -> t\n -> Attribute True Optional (Maybe String)\n key v = fromUndefOrPrim \"StorageEventInit.getkey\"\n prim__key\n prim__setKey\n Nothing\n (v :> StorageEventInit)\n \n export\n newValue : (0 _ : JSType t)\n => {auto 0 _ : Elem StorageEventInit (Types t)}\n -> t\n -> Attribute True Optional (Maybe String)\n newValue v = fromUndefOrPrim \"StorageEventInit.getnewValue\"\n prim__newValue\n prim__setNewValue\n Nothing\n (v :> StorageEventInit)\n \n export\n oldValue : (0 _ : JSType t)\n => {auto 0 _ : Elem StorageEventInit (Types t)}\n -> t\n -> Attribute True Optional (Maybe String)\n oldValue v = fromUndefOrPrim \"StorageEventInit.getoldValue\"\n prim__oldValue\n prim__setOldValue\n Nothing\n (v :> StorageEventInit)\n \n export\n storageArea : (0 _ : JSType t)\n => {auto 0 _ : Elem StorageEventInit (Types t)}\n -> t\n -> Attribute True Optional (Maybe Storage)\n storageArea v = fromUndefOrPrim \"StorageEventInit.getstorageArea\"\n prim__storageArea\n prim__setStorageArea\n Nothing\n (v :> StorageEventInit)\n \n export\n url : (0 _ : JSType t)\n => {auto 0 _ : Elem StorageEventInit (Types t)}\n -> t\n -> Attribute True Optional String\n url v = fromUndefOrPrim \"StorageEventInit.geturl\"\n prim__url\n prim__setUrl\n \"\"\n (v :> StorageEventInit)\n\n\nnamespace SubmitEventInit\n \n export\n new : (0 _ : JSType t1)\n => {auto 0 _ : Elem HTMLElement (Types t1)}\n -> (submitter : Optional (Maybe t1))\n -> JSIO SubmitEventInit\n new a = primJS $ SubmitEventInit.prim__new (omyUp a)\n\n export\n new' : JSIO SubmitEventInit\n new' = primJS $ SubmitEventInit.prim__new undef\n \n export\n submitter : (0 _ : JSType t)\n => {auto 0 _ : Elem SubmitEventInit (Types t)}\n -> t\n -> Attribute True Optional (Maybe HTMLElement)\n submitter v = fromUndefOrPrim \"SubmitEventInit.getsubmitter\"\n prim__submitter\n prim__setSubmitter\n Nothing\n (v :> SubmitEventInit)\n\n\nnamespace TrackEventInit\n \n export\n new : (track : Optional (Maybe (NS I [ VideoTrack\n , AudioTrack\n , TextTrack\n ])))\n -> JSIO TrackEventInit\n new a = primJS $ TrackEventInit.prim__new (toFFI a)\n\n export\n new' : JSIO TrackEventInit\n new' = primJS $ TrackEventInit.prim__new undef\n \n export\n track : (0 _ : JSType t)\n => {auto 0 _ : Elem TrackEventInit (Types t)}\n -> t\n -> Attribute True Optional (Maybe (NS I [ VideoTrack\n , AudioTrack\n , TextTrack\n ]))\n track v = fromUndefOrPrim \"TrackEventInit.gettrack\"\n prim__track\n prim__setTrack\n Nothing\n (v :> TrackEventInit)\n\n\nnamespace ValidityStateFlags\n \n export\n new : (valueMissing : Optional Bool)\n -> (typeMismatch : Optional Bool)\n -> (patternMismatch : Optional Bool)\n -> (tooLong : Optional Bool)\n -> (tooShort : Optional Bool)\n -> (rangeUnderflow : Optional Bool)\n -> (rangeOverflow : Optional Bool)\n -> (stepMismatch : Optional Bool)\n -> (badInput : Optional Bool)\n -> (customError : Optional Bool)\n -> JSIO ValidityStateFlags\n new a b c d e f g h i j = primJS\n $ ValidityStateFlags.prim__new (toFFI a)\n (toFFI b)\n (toFFI c)\n (toFFI d)\n (toFFI e)\n (toFFI f)\n (toFFI g)\n (toFFI h)\n (toFFI i)\n (toFFI j)\n\n export\n new' : JSIO ValidityStateFlags\n new' = primJS\n $ ValidityStateFlags.prim__new undef\n undef\n undef\n undef\n undef\n undef\n undef\n undef\n undef\n undef\n \n export\n badInput : (0 _ : JSType t)\n => {auto 0 _ : Elem ValidityStateFlags (Types t)}\n -> t\n -> Attribute True Optional Bool\n badInput v = fromUndefOrPrim \"ValidityStateFlags.getbadInput\"\n prim__badInput\n prim__setBadInput\n False\n (v :> ValidityStateFlags)\n \n export\n customError : (0 _ : JSType t)\n => {auto 0 _ : Elem ValidityStateFlags (Types t)}\n -> t\n -> Attribute True Optional Bool\n customError v = fromUndefOrPrim \"ValidityStateFlags.getcustomError\"\n prim__customError\n prim__setCustomError\n False\n (v :> ValidityStateFlags)\n \n export\n patternMismatch : (0 _ : JSType t)\n => {auto 0 _ : Elem ValidityStateFlags (Types t)}\n -> t\n -> Attribute True Optional Bool\n patternMismatch v = fromUndefOrPrim \"ValidityStateFlags.getpatternMismatch\"\n prim__patternMismatch\n prim__setPatternMismatch\n False\n (v :> ValidityStateFlags)\n \n export\n rangeOverflow : (0 _ : JSType t)\n => {auto 0 _ : Elem ValidityStateFlags (Types t)}\n -> t\n -> Attribute True Optional Bool\n rangeOverflow v = fromUndefOrPrim \"ValidityStateFlags.getrangeOverflow\"\n prim__rangeOverflow\n prim__setRangeOverflow\n False\n (v :> ValidityStateFlags)\n \n export\n rangeUnderflow : (0 _ : JSType t)\n => {auto 0 _ : Elem ValidityStateFlags (Types t)}\n -> t\n -> Attribute True Optional Bool\n rangeUnderflow v = fromUndefOrPrim \"ValidityStateFlags.getrangeUnderflow\"\n prim__rangeUnderflow\n prim__setRangeUnderflow\n False\n (v :> ValidityStateFlags)\n \n export\n stepMismatch : (0 _ : JSType t)\n => {auto 0 _ : Elem ValidityStateFlags (Types t)}\n -> t\n -> Attribute True Optional Bool\n stepMismatch v = fromUndefOrPrim \"ValidityStateFlags.getstepMismatch\"\n prim__stepMismatch\n prim__setStepMismatch\n False\n (v :> ValidityStateFlags)\n \n export\n tooLong : (0 _ : JSType t)\n => {auto 0 _ : Elem ValidityStateFlags (Types t)}\n -> t\n -> Attribute True Optional Bool\n tooLong v = fromUndefOrPrim \"ValidityStateFlags.gettooLong\"\n prim__tooLong\n prim__setTooLong\n False\n (v :> ValidityStateFlags)\n \n export\n tooShort : (0 _ : JSType t)\n => {auto 0 _ : Elem ValidityStateFlags (Types t)}\n -> t\n -> Attribute True Optional Bool\n tooShort v = fromUndefOrPrim \"ValidityStateFlags.gettooShort\"\n prim__tooShort\n prim__setTooShort\n False\n (v :> ValidityStateFlags)\n \n export\n typeMismatch : (0 _ : JSType t)\n => {auto 0 _ : Elem ValidityStateFlags (Types t)}\n -> t\n -> Attribute True Optional Bool\n typeMismatch v = fromUndefOrPrim \"ValidityStateFlags.gettypeMismatch\"\n prim__typeMismatch\n prim__setTypeMismatch\n False\n (v :> ValidityStateFlags)\n \n export\n valueMissing : (0 _ : JSType t)\n => {auto 0 _ : Elem ValidityStateFlags (Types t)}\n -> t\n -> Attribute True Optional Bool\n valueMissing v = fromUndefOrPrim \"ValidityStateFlags.getvalueMissing\"\n prim__valueMissing\n prim__setValueMissing\n False\n (v :> ValidityStateFlags)\n\n\nnamespace WindowPostMessageOptions\n \n export\n new : (targetOrigin : Optional String) -> JSIO WindowPostMessageOptions\n new a = primJS $ WindowPostMessageOptions.prim__new (toFFI a)\n\n export\n new' : JSIO WindowPostMessageOptions\n new' = primJS $ WindowPostMessageOptions.prim__new undef\n \n export\n targetOrigin : (0 _ : JSType t)\n => {auto 0 _ : Elem WindowPostMessageOptions (Types t)}\n -> t\n -> Attribute True Optional String\n targetOrigin v = fromUndefOrPrim \"WindowPostMessageOptions.gettargetOrigin\"\n prim__targetOrigin\n prim__setTargetOrigin\n \"\/\"\n (v :> WindowPostMessageOptions)\n\n\nnamespace WorkerOptions\n \n export\n new : (type : Optional WorkerType)\n -> (credentials : Optional RequestCredentials)\n -> (name : Optional String)\n -> JSIO WorkerOptions\n new a b c = primJS $ WorkerOptions.prim__new (toFFI a) (toFFI b) (toFFI c)\n\n export\n new' : JSIO WorkerOptions\n new' = primJS $ WorkerOptions.prim__new undef undef undef\n \n export\n credentials : (0 _ : JSType t)\n => {auto 0 _ : Elem WorkerOptions (Types t)}\n -> t\n -> Attribute False Optional RequestCredentials\n credentials v = fromUndefOrPrimNoDefault \"WorkerOptions.getcredentials\"\n prim__credentials\n prim__setCredentials\n (v :> WorkerOptions)\n \n export\n name : (0 _ : JSType t)\n => {auto 0 _ : Elem WorkerOptions (Types t)}\n -> t\n -> Attribute True Optional String\n name v = fromUndefOrPrim \"WorkerOptions.getname\"\n prim__name\n prim__setName\n \"\"\n (v :> WorkerOptions)\n \n export\n type : (0 _ : JSType t)\n => {auto 0 _ : Elem WorkerOptions (Types t)}\n -> t\n -> Attribute False Optional WorkerType\n type v = fromUndefOrPrimNoDefault \"WorkerOptions.gettype\"\n prim__type\n prim__setType\n (v :> WorkerOptions)\n\n\nnamespace WorkletOptions\n \n export\n new : (credentials : Optional RequestCredentials) -> JSIO WorkletOptions\n new a = primJS $ WorkletOptions.prim__new (toFFI a)\n\n export\n new' : JSIO WorkletOptions\n new' = primJS $ WorkletOptions.prim__new undef\n \n export\n credentials : (0 _ : JSType t)\n => {auto 0 _ : Elem WorkletOptions (Types t)}\n -> t\n -> Attribute False Optional RequestCredentials\n credentials v = fromUndefOrPrimNoDefault \"WorkletOptions.getcredentials\"\n prim__credentials\n prim__setCredentials\n (v :> WorkletOptions)\n\n\n\n--------------------------------------------------------------------------------\n-- Callbacks\n--------------------------------------------------------------------------------\n\nnamespace BlobCallback\n \n export\n toBlobCallback : ( Nullable Blob -> IO () ) -> JSIO BlobCallback\n toBlobCallback cb = primJS $ prim__toBlobCallback cb\n\n\nnamespace CompositionEventHandler\n \n export\n toCompositionEventHandler : ( CompositionEvent -> IO () )\n -> JSIO CompositionEventHandler\n toCompositionEventHandler cb = primJS $ prim__toCompositionEventHandler cb\n\n\nnamespace CustomElementConstructor\n \n export\n toCustomElementConstructor : (() -> IO HTMLElement)\n -> JSIO CustomElementConstructor\n toCustomElementConstructor cb = primJS $ prim__toCustomElementConstructor cb\n\n\nnamespace EventHandlerNonNull\n \n export\n toEventHandlerNonNull : ( Event -> IO AnyPtr ) -> JSIO EventHandlerNonNull\n toEventHandlerNonNull cb = primJS $ prim__toEventHandlerNonNull cb\n\n\nnamespace FocusEventHandler\n \n export\n toFocusEventHandler : ( FocusEvent -> IO () ) -> JSIO FocusEventHandler\n toFocusEventHandler cb = primJS $ prim__toFocusEventHandler cb\n\n\nnamespace FunctionStringCallback\n \n export\n toFunctionStringCallback : ( String -> IO () ) -> JSIO FunctionStringCallback\n toFunctionStringCallback cb = primJS $ prim__toFunctionStringCallback cb\n\n\nnamespace InputEventHandler\n \n export\n toInputEventHandler : ( InputEvent -> IO () ) -> JSIO InputEventHandler\n toInputEventHandler cb = primJS $ prim__toInputEventHandler cb\n\n\nnamespace KeyboardEventHandler\n \n export\n toKeyboardEventHandler : ( KeyboardEvent -> IO () )\n -> JSIO KeyboardEventHandler\n toKeyboardEventHandler cb = primJS $ prim__toKeyboardEventHandler cb\n\n\nnamespace MouseEventHandler\n \n export\n toMouseEventHandler : ( MouseEvent -> IO () ) -> JSIO MouseEventHandler\n toMouseEventHandler cb = primJS $ prim__toMouseEventHandler cb\n\n\nnamespace OnBeforeUnloadEventHandlerNonNull\n \n export\n toOnBeforeUnloadEventHandlerNonNull : ( Event -> IO (Nullable String) )\n -> JSIO OnBeforeUnloadEventHandlerNonNull\n toOnBeforeUnloadEventHandlerNonNull cb = primJS $ prim__toOnBeforeUnloadEventHandlerNonNull cb\n\n\nnamespace OnErrorEventHandlerNonNull\n \n export\n toOnErrorEventHandlerNonNull : ( Union2 Event String\n -> UndefOr String\n -> UndefOr Bits32\n -> UndefOr Bits32\n -> UndefOr AnyPtr\n -> IO AnyPtr\n )\n -> JSIO OnErrorEventHandlerNonNull\n toOnErrorEventHandlerNonNull cb = primJS $ prim__toOnErrorEventHandlerNonNull cb\n\n\nnamespace UIEventHandler\n \n export\n toUIEventHandler : ( UIEvent -> IO () ) -> JSIO UIEventHandler\n toUIEventHandler cb = primJS $ prim__toUIEventHandler cb\n\n\nnamespace WheelEventHandler\n \n export\n toWheelEventHandler : ( WheelEvent -> IO () ) -> JSIO WheelEventHandler\n toWheelEventHandler cb = primJS $ prim__toWheelEventHandler cb\n\n","avg_line_length":34.0163395437,"max_line_length":101,"alphanum_fraction":0.555157547} +{"size":2345,"ext":"idr","lang":"Idris","max_stars_count":85.0,"content":"module Language.LSP.Message.Progress\n\nimport Language.JSON\nimport Language.LSP.Message.Derive\nimport Language.LSP.Message.Utils\nimport Language.Reflection\n\n%language ElabReflection\n%default total\n\n||| Refer to https:\/\/microsoft.github.io\/language-server-protocol\/specification.html#progress\npublic export\nProgressToken : Type\nProgressToken = OneOf [Int, String]\n\n||| Refer to https:\/\/microsoft.github.io\/language-server-protocol\/specification.html#clientInitiatedProgress\npublic export\nrecord WorkDoneProgressOptions where\n constructor MkWorkDoneProgressOptions\n workDoneProgress : Maybe Bool\n%runElab deriveJSON defaultOpts `{WorkDoneProgressOptions}\n\n||| Refer to https:\/\/microsoft.github.io\/language-server-protocol\/specification.html#clientInitiatedProgress\npublic export\nrecord WorkDoneProgressParams where\n constructor MkWorkDoneProgressParams\n workDoneToken : Maybe ProgressToken\n%runElab deriveJSON defaultOpts `{WorkDoneProgressParams}\n\n||| Refer to https:\/\/microsoft.github.io\/language-server-protocol\/specification.html#partialResultParams\npublic export\nrecord PartialResultParams where\n constructor MkPartialResultParams\n partialResultToken : Maybe ProgressToken\n%runElab deriveJSON defaultOpts `{PartialResultParams}\n\n||| Refer to https:\/\/microsoft.github.io\/language-server-protocol\/specification.html#workDoneProgressBegin\npublic export\nrecord WorkDoneProgressBegin where\n constructor MkWorkDoneProgressBegin\n title : String\n cancellable : Maybe Bool\n message : Maybe String\n percentage : Maybe Int\n%runElab deriveJSON (record {staticFields = [(\"kind\", JString \"begin\")]} defaultOpts) `{WorkDoneProgressBegin}\n\n||| Refer to https:\/\/microsoft.github.io\/language-server-protocol\/specification.html#workDoneProgressReport\npublic export\nrecord WorkDoneProgressReport where\n constructor MkWorkDoneProgressReport\n cancellable : Maybe Bool\n message : Maybe String\n percentage : Maybe Int\n%runElab deriveJSON (record {staticFields = [(\"kind\", JString \"report\")]} defaultOpts) `{WorkDoneProgressReport}\n\n||| Refer to https:\/\/microsoft.github.io\/language-server-protocol\/specification.html#workDoneProgressEnd\npublic export\nrecord WorkDoneProgressEnd where\n constructor MkWorkDoneProgressEnd\n message : Maybe String\n%runElab deriveJSON (record {staticFields = [(\"kind\", JString \"end\")]} defaultOpts) `{WorkDoneProgressEnd}\n","avg_line_length":37.8225806452,"max_line_length":112,"alphanum_fraction":0.8230277186} +{"size":548,"ext":"idr","lang":"Idris","max_stars_count":9.0,"content":"module Node\n\nimport Data.Buffer\n\n%foreign \"node:lambda: (ty, a) => JSON.stringify(a, null, 2)\"\nffi_toJsonString : a -> String\n\nexport\ntoJsonString : a -> String\ntoJsonString a = ffi_toJsonString a\n\n\n%foreign \"node:lambda: (ty, a) => console.log(a)\"\nffi_debugJsValue : a -> PrimIO ()\n\nexport\ndebugJsValue : a -> IO ()\ndebugJsValue a = primIO $ ffi_debugJsValue a\n\n%foreign \"node:lambda: cb => setTimeout(() => cb(), 0)\"\nffi_defer : PrimIO () -> PrimIO ()\n\nexport\ndefer : HasIO io => IO () -> io ()\ndefer action = primIO $ ffi_defer $ toPrim action\n\n","avg_line_length":20.2962962963,"max_line_length":61,"alphanum_fraction":0.6697080292} +{"size":23371,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"||| Reading and writing 'Defs' from\/to a binary file. In order to be saved, a\n||| name must have been flagged using 'toSave'. (Otherwise we'd save out\n||| everything, not just the things in the current file).\nmodule Core.Binary\n\nimport public Core.Binary.Prims\nimport Core.CaseTree\nimport Core.Context\nimport Core.Context.Log\nimport Core.Core\nimport Core.Hash\nimport Core.Name.Namespace\nimport Core.Normalise\nimport Core.Options\nimport Core.TT\nimport Core.TTC\nimport Core.UnifyState\n\nimport Data.Buffer\nimport Data.List\nimport Data.String\n\nimport System.File\n\nimport Libraries.Data.IntMap\nimport Libraries.Data.NameMap\n\nimport public Libraries.Utils.Binary\n\n%default covering\n\n||| TTC files can only be compatible if the version number is the same\n||| (Increment this when changing anything in the data format)\nexport\nttcVersion : Int\nttcVersion = 63\n\nexport\ncheckTTCVersion : String -> Int -> Int -> Core ()\ncheckTTCVersion file ver exp\n = when (ver \/= exp) (throw $ TTCError $ Format file ver exp)\n\nrecord TTCFile extra where\n constructor MkTTCFile\n version : Int\n totalReq : TotalReq\n sourceHash : Maybe String\n ifaceHash : Int\n importHashes : List (Namespace, Int)\n incData : List (CG, String, List String)\n context : List (Name, Binary)\n userHoles : List Name\n autoHints : List (Name, Bool)\n typeHints : List (Name, Name, Bool)\n imported : List (ModuleIdent, Bool, Namespace)\n nextVar : Int\n currentNS : Namespace\n nestedNS : List Namespace\n pairnames : Maybe PairNames\n rewritenames : Maybe RewriteNames\n primnames : PrimNames\n namedirectives : List (Name, List String)\n cgdirectives : List (CG, String)\n transforms : List (Name, Transform)\n extraData : extra\n\nHasNames a => HasNames (List a) where\n full c ns = full_aux c [] ns\n where full_aux : Context -> List a -> List a -> Core (List a)\n full_aux c res [] = pure (reverse res)\n full_aux c res (n :: ns) = full_aux c (!(full c n):: res) ns\n\n\n resolved c ns = resolved_aux c [] ns\n where resolved_aux : Context -> List a -> List a -> Core (List a)\n resolved_aux c res [] = pure (reverse res)\n resolved_aux c res (n :: ns) = resolved_aux c (!(resolved c n) :: res) ns\nHasNames (Int, FC, Name) where\n full c (i, fc, n) = pure (i, fc, !(full c n))\n resolved c (i, fc, n) = pure (i, fc, !(resolved c n))\n\nHasNames (Name, Bool) where\n full c (n, b) = pure (!(full c n), b)\n resolved c (n, b) = pure (!(resolved c n), b)\n\nHasNames (Name, List String) where\n full c (n, b) = pure (!(full c n), b)\n resolved c (n, b) = pure (!(resolved c n), b)\n\nHasNames (Name, Transform) where\n full c (n, b) = pure (!(full c n), !(full c b))\n resolved c (n, b) = pure (!(resolved c n), !(resolved c b))\n\nHasNames (Name, Name, Bool) where\n full c (n1, n2, b) = pure (!(full c n1), !(full c n2), b)\n resolved c (n1, n2, b) = pure (!(resolved c n1), !(resolved c n2), b)\n\nHasNames e => HasNames (TTCFile e) where\n full gam (MkTTCFile version totalReq sourceHash ifaceHash iHashes incData\n context userHoles\n autoHints typeHints\n imported nextVar currentNS nestedNS\n pairnames rewritenames primnames\n namedirectives cgdirectives trans\n extra)\n = pure $ MkTTCFile version totalReq sourceHash ifaceHash iHashes incData\n context userHoles\n !(traverse (full gam) autoHints)\n !(traverse (full gam) typeHints)\n imported nextVar currentNS nestedNS\n !(fullPair gam pairnames)\n !(fullRW gam rewritenames)\n !(fullPrim gam primnames)\n !(full gam namedirectives)\n cgdirectives\n !(full gam trans)\n !(full gam extra)\n where\n fullPair : Context -> Maybe PairNames -> Core (Maybe PairNames)\n fullPair gam Nothing = pure Nothing\n fullPair gam (Just (MkPairNs t f s))\n = pure $ Just $ MkPairNs !(full gam t) !(full gam f) !(full gam s)\n\n fullRW : Context -> Maybe RewriteNames -> Core (Maybe RewriteNames)\n fullRW gam Nothing = pure Nothing\n fullRW gam (Just (MkRewriteNs e r))\n = pure $ Just $ MkRewriteNs !(full gam e) !(full gam r)\n\n fullPrim : Context -> PrimNames -> Core PrimNames\n fullPrim gam (MkPrimNs mi ms mc md)\n = [| MkPrimNs (full gam mi) (full gam ms) (full gam mc) (full gam md) |]\n\n\n -- I don't think we ever actually want to call this, because after we read\n -- from the file we're going to add them to learn what the resolved names\n -- are supposed to be! But for completeness, let's do it right.\n resolved gam (MkTTCFile version totalReq sourceHash ifaceHash iHashes incData\n context userHoles\n autoHints typeHints\n imported nextVar currentNS nestedNS\n pairnames rewritenames primnames\n namedirectives cgdirectives trans\n extra)\n = pure $ MkTTCFile version totalReq sourceHash ifaceHash iHashes incData\n context userHoles\n !(traverse (resolved gam) autoHints)\n !(traverse (resolved gam) typeHints)\n imported nextVar currentNS nestedNS\n !(resolvedPair gam pairnames)\n !(resolvedRW gam rewritenames)\n !(resolvedPrim gam primnames)\n !(resolved gam namedirectives)\n cgdirectives\n !(resolved gam trans)\n !(resolved gam extra)\n where\n resolvedPair : Context -> Maybe PairNames -> Core (Maybe PairNames)\n resolvedPair gam Nothing = pure Nothing\n resolvedPair gam (Just (MkPairNs t f s))\n = pure $ Just $ MkPairNs !(resolved gam t) !(resolved gam f) !(resolved gam s)\n\n resolvedRW : Context -> Maybe RewriteNames -> Core (Maybe RewriteNames)\n resolvedRW gam Nothing = pure Nothing\n resolvedRW gam (Just (MkRewriteNs e r))\n = pure $ Just $ MkRewriteNs !(resolved gam e) !(resolved gam r)\n\n resolvedPrim : Context -> PrimNames -> Core PrimNames\n resolvedPrim gam (MkPrimNs mi ms mc md)\n = pure $ MkPrimNs !(resolved gam mi)\n !(resolved gam ms)\n !(resolved gam mc)\n !(resolved gam md)\n\n-- NOTE: TTC files are only compatible if the version number is the same,\n-- *and* the 'annot\/extra' type are the same, or there are no holes\/constraints\nwriteTTCFile : (HasNames extra, TTC extra) =>\n {auto c : Ref Ctxt Defs} ->\n Ref Bin Binary -> TTCFile extra -> Core ()\nwriteTTCFile b file_in\n = do file <- toFullNames file_in\n toBuf b \"TT2\"\n toBuf @{Wasteful} b (version file)\n toBuf b (totalReq file)\n toBuf b (sourceHash file)\n toBuf b (ifaceHash file)\n toBuf b (importHashes file)\n toBuf b (incData file)\n toBuf b (imported file)\n toBuf b (extraData file)\n toBuf b (context file)\n toBuf b (userHoles file)\n toBuf b (autoHints file)\n toBuf b (typeHints file)\n toBuf b (nextVar file)\n toBuf b (currentNS file)\n toBuf b (nestedNS file)\n toBuf b (pairnames file)\n toBuf b (rewritenames file)\n toBuf b (primnames file)\n toBuf b (namedirectives file)\n toBuf b (cgdirectives file)\n toBuf b (transforms file)\n\nreadTTCFile : TTC extra =>\n {auto c : Ref Ctxt Defs} ->\n Bool -> String -> Maybe (Namespace) ->\n Ref Bin Binary -> Core (TTCFile extra)\nreadTTCFile readall file as b\n = do hdr <- fromBuf b\n chunk <- get Bin\n when (hdr \/= \"TT2\") $\n corrupt (\"TTC header in \" ++ file ++ \" \" ++ show hdr)\n ver <- fromBuf @{Wasteful} b\n checkTTCVersion file ver ttcVersion\n totalReq <- fromBuf b\n sourceFileHash <- fromBuf b\n ifaceHash <- fromBuf b\n importHashes <- fromBuf b\n incData <- fromBuf b\n imp <- fromBuf b\n ex <- fromBuf b\n if not readall\n then pure (MkTTCFile ver totalReq\n sourceFileHash ifaceHash importHashes\n incData [] [] [] [] []\n 0 (mkNamespace \"\") [] Nothing\n Nothing\n (MkPrimNs Nothing Nothing Nothing Nothing)\n [] [] [] ex)\n else do\n defs <- fromBuf b\n uholes <- fromBuf b\n autohs <- fromBuf b\n typehs <- fromBuf b\n nextv <- fromBuf b\n cns <- fromBuf b\n nns <- fromBuf b\n pns <- fromBuf b\n rws <- fromBuf b\n prims <- fromBuf b\n nds <- fromBuf b\n cgds <- fromBuf b\n trans <- fromBuf b\n pure (MkTTCFile ver totalReq\n sourceFileHash ifaceHash importHashes incData\n (map (replaceNS cns) defs) uholes\n autohs typehs imp nextv cns nns\n pns rws prims nds cgds trans ex)\n where\n -- We don't store full names in 'defs' - we remove the namespace if it's\n -- the same as the current namespace. So, this puts it back.\n replaceNS : Namespace -> (Name, a) -> (Name, a)\n replaceNS ns n@(NS _ _, d) = n\n replaceNS ns (n, d) = (NS ns n, d)\n\n-- Pull out the list of GlobalDefs that we want to save\ngetSaveDefs : Namespace -> List Name -> List (Name, Binary) -> Defs ->\n Core (List (Name, Binary))\ngetSaveDefs modns [] acc _ = pure acc\ngetSaveDefs modns (n :: ns) acc defs\n = do Just gdef <- lookupCtxtExact n (gamma defs)\n | Nothing => getSaveDefs modns ns acc defs -- 'n' really should exist though!\n -- No need to save builtins\n case definition gdef of\n Builtin _ => getSaveDefs modns ns acc defs\n _ => do bin <- initBinaryS 16384\n toBuf bin (trimNS modns !(full (gamma defs) gdef))\n b <- get Bin\n getSaveDefs modns ns ((trimName (fullname gdef), b) :: acc) defs\n where\n trimName : Name -> Name\n trimName n@(NS defns d) = if defns == modns then d else n\n trimName n = n\n\n-- Write out the things in the context which have been defined in the\n-- current source file\nexport\nwriteToTTC : (HasNames extra, TTC extra) =>\n {auto c : Ref Ctxt Defs} ->\n {auto u : Ref UST UState} ->\n extra -> (sourceFileName : String) ->\n (ttcFileName : String) -> Core ()\nwriteToTTC extradata sourceFileName ttcFileName\n = do bin <- initBinary\n defs <- get Ctxt\n ust <- get UST\n gdefs <- getSaveDefs (currentNS defs) (keys (toSave defs)) [] defs\n sourceHash <- hashFileWith defs.options.hashFn sourceFileName\n totalReq <- getDefaultTotalityOption\n log \"ttc.write\" 5 $ unwords\n [ \"Writing\", ttcFileName\n , \"with source hash\", show sourceHash\n , \"and interface hash\", show (ifaceHash defs)\n ]\n writeTTCFile bin\n (MkTTCFile ttcVersion totalReq\n sourceHash\n (ifaceHash defs) (importHashes defs)\n (incData defs)\n gdefs\n (keys (userHoles defs))\n (saveAutoHints defs)\n (saveTypeHints defs)\n (imported defs)\n (nextName ust)\n (currentNS defs)\n (nestedNS defs)\n (pairnames (options defs))\n (rewritenames (options defs))\n (primnames (options defs))\n (NameMap.toList (namedirectives defs))\n (cgdirectives defs)\n (saveTransforms defs)\n extradata)\n\n Right ok <- coreLift $ writeToFile ttcFileName !(get Bin)\n | Left err => throw (InternalError (ttcFileName ++ \": \" ++ show err))\n pure ()\n\naddGlobalDef : {auto c : Ref Ctxt Defs} ->\n (modns : ModuleIdent) -> Namespace ->\n (importAs : Maybe Namespace) ->\n (Name, Binary) -> Core ()\naddGlobalDef modns filens asm (n, def)\n = do defs <- get Ctxt\n codedentry <- lookupContextEntry n (gamma defs)\n -- Don't update the coded entry because some names might not be\n -- resolved yet\n entry <- maybe (pure Nothing)\n (\\ p => do x <- decode (gamma defs) (fst p) False (snd p)\n pure (Just x))\n codedentry\n unless (completeDef entry) $\n ignore $ addContextEntry filens n def\n\n whenJust asm $ \\ as => addContextAlias (asName modns as n) n\n\n where\n -- If the definition already exists, don't overwrite it with an empty\n -- definition or hole. This might happen if a function is declared in one\n -- module and defined in another.\n completeDef : Maybe GlobalDef -> Bool\n completeDef Nothing = False\n completeDef (Just def)\n = case definition def of\n None => False\n Hole _ _ => False\n _ => True\n\naddTypeHint : {auto c : Ref Ctxt Defs} ->\n FC -> (Name, Name, Bool) -> Core ()\naddTypeHint fc (tyn, hintn, d)\n = do logC \"ttc.read\" 10 (pure (show !(getFullName hintn) ++ \" for \" ++\n show !(getFullName tyn)))\n addHintFor fc tyn hintn d True\n\naddAutoHint : {auto c : Ref Ctxt Defs} ->\n (Name, Bool) -> Core ()\naddAutoHint (hintn_in, d)\n = do defs <- get Ctxt\n hintn <- toResolvedNames hintn_in\n\n put Ctxt (record { autoHints $= insert hintn d } defs)\n\nexport\nupdatePair : {auto c : Ref Ctxt Defs} ->\n Maybe PairNames -> Core ()\nupdatePair p\n = do defs <- get Ctxt\n put Ctxt (record { options->pairnames $= (p <+>) } defs)\n\nexport\nupdateRewrite : {auto c : Ref Ctxt Defs} ->\n Maybe RewriteNames -> Core ()\nupdateRewrite r\n = do defs <- get Ctxt\n put Ctxt (record { options->rewritenames $= (r <+>) } defs)\n\nexport\nupdatePrimNames : PrimNames -> PrimNames -> PrimNames\nupdatePrimNames p\n = record { fromIntegerName $= ((fromIntegerName p) <+>),\n fromStringName $= ((fromStringName p) <+>),\n fromCharName $= ((fromCharName p) <+>),\n fromDoubleName $= ((fromDoubleName p) <+>)\n }\n\nexport\nupdatePrims : {auto c : Ref Ctxt Defs} ->\n PrimNames -> Core ()\nupdatePrims p\n = do defs <- get Ctxt\n put Ctxt (record { options->primnames $= updatePrimNames p } defs)\n\nexport\nupdateNameDirectives : {auto c : Ref Ctxt Defs} ->\n List (Name, List String) -> Core ()\nupdateNameDirectives [] = pure ()\nupdateNameDirectives ((t, ns) :: nds)\n = do defs <- get Ctxt\n put Ctxt (record { namedirectives $= insert t ns } defs)\n updateNameDirectives nds\n\nexport\nupdateCGDirectives : {auto c : Ref Ctxt Defs} ->\n List (CG, String) -> Core ()\nupdateCGDirectives cgs\n = do defs <- get Ctxt\n let cgs' = nub (cgs ++ cgdirectives defs)\n put Ctxt (record { cgdirectives = cgs' } defs)\n\nexport\nupdateTransforms : {auto c : Ref Ctxt Defs} ->\n List (Name, Transform) -> Core ()\nupdateTransforms [] = pure ()\nupdateTransforms ((n, t) :: ts)\n = do addT !(toResolvedNames n) !(toResolvedNames t)\n updateTransforms ts\n where\n addT : Name -> Transform -> Core ()\n addT n t\n = do defs <- get Ctxt\n case lookup n (transforms defs) of\n Nothing =>\n put Ctxt (record { transforms $= insert n [t] } defs)\n Just ts =>\n put Ctxt (record { transforms $= insert n (t :: ts) } defs)\n\n\ngetNSas : (String, (ModuleIdent, Bool, Namespace)) ->\n (ModuleIdent, Namespace)\ngetNSas (a, (b, c, d)) = (b, d)\n\n-- Add definitions from a binary file to the current context\n-- Returns the \"extra\" section of the file (user defined data), the interface\n-- hash and the list of additional TTCs that need importing\n-- (we need to return these, rather than do it here, because after loading\n-- the data that's when we process the extra data...)\nexport\nreadFromTTC : TTC extra =>\n {auto c : Ref Ctxt Defs} ->\n {auto u : Ref UST UState} ->\n Bool -> -- set nested namespaces (for records, to use at the REPL)\n FC ->\n Bool -> -- importing as public\n (fname : String) -> -- file containing the module\n (modNS : ModuleIdent) -> -- module namespace\n (importAs : Namespace) -> -- namespace to import as\n Core (Maybe (extra, Int,\n List (ModuleIdent, Bool, Namespace)))\nreadFromTTC nestedns loc reexp fname modNS importAs\n = do defs <- get Ctxt\n -- If it's already in the context, with the same visibility flag,\n -- don't load it again (we do need to load it again if it's visible\n -- this time, because we need to reexport the dependencies.)\n let False = (modNS, reexp, importAs) `elem` map snd (allImported defs)\n | True => pure Nothing\n put Ctxt (record { allImported $= ((fname, (modNS, reexp, importAs)) :: ) } defs)\n\n Right buffer <- coreLift $ readFromFile fname\n | Left err => throw (InternalError (fname ++ \": \" ++ show err))\n bin <- newRef Bin buffer -- for reading the file into\n let as = if importAs == miAsNamespace modNS\n then Nothing\n else Just importAs\n\n -- If it's already imported, but without reexporting, then all we're\n -- interested in is returning which other modules to load.\n -- Otherwise, add the data\n if alreadyDone modNS importAs (allImported defs)\n then do ttc <- readTTCFile False fname as bin\n let ex = extraData ttc\n pure (Just (ex, ifaceHash ttc, imported ttc))\n else do\n ttc <- readTTCFile True fname as bin\n let ex = extraData ttc\n traverse_ (addGlobalDef modNS (currentNS ttc) as) (context ttc)\n traverse_ (addUserHole True) (userHoles ttc)\n setNS (currentNS ttc)\n when nestedns $ setNestedNS (nestedNS ttc)\n -- Only do the next batch if the module hasn't been loaded\n -- in any form\n unless (modNS `elem` map (fst . getNSas) (allImported defs)) $\n -- Set up typeHints and autoHints based on the loaded data\n do traverse_ (addTypeHint loc) (typeHints ttc)\n traverse_ addAutoHint (autoHints ttc)\n addImportedInc modNS (incData ttc)\n defs <- get Ctxt\n -- Set up pair\/rewrite etc names\n updatePair (pairnames ttc)\n updateRewrite (rewritenames ttc)\n updatePrims (primnames ttc)\n updateNameDirectives (reverse (namedirectives ttc))\n updateCGDirectives (cgdirectives ttc)\n updateTransforms (transforms ttc)\n\n when (not reexp) clearSavedHints\n resetFirstEntry\n\n -- Finally, update the unification state with the holes from the\n -- ttc\n ust <- get UST\n put UST (record { nextName = nextVar ttc } ust)\n pure (Just (ex, ifaceHash ttc, imported ttc))\n where\n alreadyDone : ModuleIdent -> Namespace ->\n List (String, (ModuleIdent, Bool, Namespace)) ->\n Bool\n alreadyDone modns importAs [] = False\n -- If we've already imported 'modns' as 'importAs', or we're importing\n -- 'modns' as itself and it's already imported as anything, then no\n -- need to load again.\n alreadyDone modns importAs ((_, (m, _, a)) :: rest)\n = (modns == m && importAs == a)\n || (modns == m && miAsNamespace modns == importAs)\n || alreadyDone modns importAs rest\n\ngetImportHashes : String -> Ref Bin Binary ->\n Core (List (Namespace, Int))\ngetImportHashes file b\n = do hdr <- fromBuf {a = String} b\n when (hdr \/= \"TT2\") $ corrupt (\"TTC header in \" ++ file ++ \" \" ++ show hdr)\n ver <- fromBuf @{Wasteful} b\n checkTTCVersion file ver ttcVersion\n totalReq <- fromBuf {a = TotalReq} b\n sourceFileHash <- fromBuf {a = Maybe String} b\n interfaceHash <- fromBuf {a = Int} b\n fromBuf b\n\nexport\ngetTotalReq : String -> Ref Bin Binary -> Core TotalReq\ngetTotalReq file b\n = do hdr <- fromBuf {a = String} b\n when (hdr \/= \"TT2\") $ corrupt (\"TTC header in \" ++ file ++ \" \" ++ show hdr)\n ver <- fromBuf @{Wasteful} b\n checkTTCVersion file ver ttcVersion\n fromBuf b\n\nexport\nreadTotalReq : (fileName : String) -> -- file containing the module\n Core (Maybe TotalReq)\nreadTotalReq fileName\n = do Right buffer <- coreLift $ readFromFile fileName\n | Left err => pure Nothing\n b <- newRef Bin buffer\n catch (Just <$> getTotalReq fileName b)\n (\\err => pure Nothing)\n\nexport\ngetHashes : String -> Ref Bin Binary -> Core (Maybe String, Int)\ngetHashes file b\n = do hdr <- fromBuf {a = String} b\n when (hdr \/= \"TT2\") $ corrupt (\"TTC header in \" ++ file ++ \" \" ++ show hdr)\n ver <- fromBuf @{Wasteful} b\n checkTTCVersion file ver ttcVersion\n totReq <- fromBuf {a = TotalReq} b\n sourceFileHash <- fromBuf b\n interfaceHash <- fromBuf b\n pure (sourceFileHash, interfaceHash)\n\nexport\nreadHashes : (fileName : String) -> -- file containing the module\n Core (Maybe String, Int)\nreadHashes fileName\n = do Right buffer <- coreLift $ readFromFile fileName\n | Left err => pure (Nothing, 0)\n b <- newRef Bin buffer\n catch (getHashes fileName b)\n (\\err => pure (Nothing, 0))\n\nexport\nreadImportHashes : (fname : String) -> -- file containing the module\n Core (List (Namespace, Int))\nreadImportHashes fname\n = do Right buffer <- coreLift $ readFromFile fname\n | Left err => pure []\n b <- newRef Bin buffer\n catch (do res <- getImportHashes fname b\n pure res)\n (\\err => pure [])\n","avg_line_length":40.2254733219,"max_line_length":91,"alphanum_fraction":0.5539771512} +{"size":705,"ext":"idr","lang":"Idris","max_stars_count":2.0,"content":"module Sprintf\n\n%access export\n%default total\n\npublic export\nstrToSty : (curr : String) -> (str : List Char) -> (t : Type ** t)\nstrToSty c [] = (_ ** c)\nstrToSty c ('%'::'%'::ks) = strToSty (c ++ \"%\") ks\nstrToSty c ('%'::'d'::ks) = (_ ** \\n : Integer => snd $ strToSty (c ++ show n) ks)\nstrToSty c ('%'::'f'::ks) = (_ ** \\x : Double => snd $ strToSty (c ++ show x) ks)\nstrToSty c ('%'::'c'::ks) = (_ ** \\k : Char => snd $ strToSty (c ++ singleton k) ks)\nstrToSty c ('%':: ks) = (_ ** \\v : Void => snd $ strToSty c ks)\nstrToSty c ( k :: ks) = strToSty (c ++ singleton k) ks\n\nsprintf : (str : String) -> fst (strToSty \"\" $ unpack str)\nsprintf str = snd (strToSty \"\" $ unpack str)\n","avg_line_length":39.1666666667,"max_line_length":87,"alphanum_fraction":0.5219858156} +{"size":3251,"ext":"idr","lang":"Idris","max_stars_count":1.0,"content":"import Common\n\ndepVect : (init: Iso a b) ->\n (step: a -> Iso a b) ->\n Iso (Vect n a) (Vect n b)\ndepVect init step = MkIso (to init) (from init) (tf init) (ft init)\n where\n to : Iso a b -> Vect n a -> Vect n b\n to s [] = []\n to s (x::xs) = appIso s x :: to (step x) xs\n from : Iso a b -> Vect n b -> Vect n a\n from s [] = []\n from s (x::xs) = unappIso s x :: from (step (unappIso s x)) xs\n tf : (step : Iso a b) -> (v : Vect n b) -> to step (from step v) = v\n tf i [] = Refl\n tf i (x::xs) = rewrite (tf (step (unappIso i x)) xs) in case i of\n (MkIso ito ifrom itf ift) => cong (itf x) {f=flip (::) xs}\n ft : (step : Iso a b) -> (v : Vect n a) -> from step (to step v) = v\n ft i [] = Refl\n ft (MkIso ito ifrom itf ift) (x::xs) = rewrite (ift x) in cong (ft (step x) xs) {f=(::) x}\n\nstateVect : (init: Iso a b) ->\n (initS: s) ->\n (step: s -> a -> s) ->\n (gen: s -> Iso a b) ->\n Iso (Vect n a) (Vect n b)\nstateVect {s=s} i is step gen = MkIso (to is i) (from is i) (tf is i) (ft is i)\n where\n to : s -> Iso a b -> Vect n a -> Vect n b\n to _ _ [] = []\n to st iso (x::xs) = appIso iso x :: to (step st x) (gen (step st x)) xs\n from : s -> Iso a b -> Vect n b -> Vect n a\n from st iso [] = []\n from st iso (x::xs) = unappIso iso x :: from (step st (unappIso iso x)) (gen (step st (unappIso iso x))) xs\n tf : (st : s) -> (iso : Iso a b) -> (v : Vect n b) -> to st iso (from st iso v) = v\n tf _ _ [] = Refl\n tf st iso (x::xs) = rewrite (tf (step st (unappIso iso x)) (gen (step st (unappIso iso x))) xs) in\n case iso of\n (MkIso ito ifrom itf ift) => cong (itf x) {f=flip (::) xs}\n ft : (st : s) -> (iso : Iso a b) -> (v : Vect n a) -> from st iso (to st iso v) = v\n ft _ _ [] = Refl\n ft st (MkIso ito ifrom itf ift) (x::xs) = rewrite (ift x) in\n cong (ft (step st x) (gen (step st x)) xs) {f=(::) x}\n\n\n\n\n-- examples\n\n\n\nxor : Bool -> Bool -> Bool\nxor = (\/=)\n\nxorTwice : (x,y : Bool) -> xor x (xor x y) = y\nxorTwice True True = Refl\nxorTwice False False = Refl\nxorTwice False True = Refl\nxorTwice True False = Refl\n\ntest : Iso (Vect n Bool) (Vect n Bool)\ntest = stateVect idIso False step gen\n where\n idIso = (MkIso id id (\\x => Refl) (\\x => Refl))\n -- change state when state and value match\n step True True = False\n step False False = True\n step s _ = s\n -- just xor with state\n gen s = MkIso (xor s) (xor s) (xorTwice s) (xorTwice s)\n\n-- \u03bb\u03a0> appIso test [True, True, True, True, True, True, True]\n-- [True, True, True, True, True, True, True] : Vect 7 Bool\n-- \u03bb\u03a0> appIso test [False, True, False, True, False, True, False]\n-- [False, False, False, False, False, False, False] : Vect 7 Bool\n-- \u03bb\u03a0> appIso test [False, True, False, False, False, True, False]\n-- [False, False, False, True, True, False, False] : Vect 7 Bool\n\ntest2 : Iso (Vect n Bool) (Vect n Bool)\ntest2 = stateVect idIso Z step gen\n where\n idIso = (MkIso id id (\\x => Refl) (\\x => Refl))\n step Z False = Z\n step (S n) False = n\n step n True = S n\n gen s = MkIso (xor (s == 0)) (xor (s == 0)) (xorTwice (s == 0)) (xorTwice (s == 0))\n\n-- \u03bb\u03a0> appIso test2 [True, True, True, False, False, False, False]\n-- [True, True, True, False, False, False, True] : Vect 7 Bool\n\n","avg_line_length":35.7252747253,"max_line_length":109,"alphanum_fraction":0.5515226084} +{"size":959,"ext":"idr","lang":"Idris","max_stars_count":128.0,"content":"module Compiler.Erlang.Utils.PrimTerm\n\nimport Data.List\nimport Compiler.Erlang.Utils.CompositeString\nimport Compiler.Erlang.Utils.String\n\n\n%default total\n\n\npublic export\ndata PrimTerm\n = PAtom String\n | PChar Char\n | PFloat Double\n | PInteger Integer\n | PTuple (List PrimTerm)\n | PList (List PrimTerm)\n | PCharlist String\n\n\nexport\nprimTermToCS : PrimTerm -> CompositeString\nprimTermToCS (PAtom str) = Nested [Str \"'\", Str (escapeString (unpack str) \"\"), Str \"'\"]\nprimTermToCS (PChar x) = Nested [Str \"$\", Str (escapeChar x \"\")]\nprimTermToCS (PFloat x) = Str (showDouble x)\nprimTermToCS (PInteger x) = Str (show x)\nprimTermToCS (PTuple xs) = Nested [Str \"{\", Nested $ intersperse (Str \",\") (assert_total (map primTermToCS xs)), Str \"}\"]\nprimTermToCS (PList xs) = Nested [Str \"[\", Nested $ intersperse (Str \",\") (assert_total (map primTermToCS xs)), Str \"]\"]\nprimTermToCS (PCharlist str) = Nested [Str \"\\\"\", Str (escapeString (unpack str) \"\"), Str \"\\\"\"]\n","avg_line_length":30.935483871,"max_line_length":121,"alphanum_fraction":0.700729927} +{"size":1421,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"module Hangman\n\nimport Data.Vect\nimport Pred\n\n\ndata GameState : (guesses_remaining : Nat) -> (letters : Nat) -> Type where\n MkGameState : (word : String)\n -> (missing : Vect letters Char)\n -> GameState guesses_remaining letters\n\n\ndata Finished : Type where\n Lost : (game : GameState 0 (S letters)) -> Finished\n Won : (game : GameState (S guesses) 0) -> Finished\n\n\ndata ValidInput : List Char -> Type where\n Letter : (c : Char) -> ValidInput [c]\n\n\nprocessGuess : (letter : Char) ->\n GameState (S guesses) (S letters) ->\n Either (GameState guesses (S letters)) (GameState (S guesses) letters)\nprocessGuess letter (MkGameState word missing)\n = case isElem letter missing of\n Yes prf => Right (MkGameState word (removeElem_auto letter missing))\n No contra => Left (MkGameState word missing)\n\n\nisValidInput : (cs : List Char) -> Dec (ValidInput cs)\n\n\nisValidString : (s : String) -> Dec (ValidInput (unpack s))\n\n\nreadGuess : IO (x ** ValidInput x)\nreadGuess = do putStr \"Guess:\"\n x <- getLine\n case isValidString (toUpper x) of\n Yes prf => pure (_ ** prf)\n No contra => do putStrLn \"Invalid guess\"\n readGuess\n\ngame : GameState (S guesses) (S letters) -> IO Finished\ngame st = ?game_rhs\n","avg_line_length":30.2340425532,"max_line_length":91,"alphanum_fraction":0.5791695989} +{"size":5077,"ext":"idr","lang":"Idris","max_stars_count":9.0,"content":"module LightClick.IR.ModuleCentric\n\nimport Data.String\nimport Data.Vect\n\nimport Toolkit.Data.DList\nimport Toolkit.Data.DVect\n\nimport Language.SystemVerilog.Gates\n\nimport LightClick.Types\nimport LightClick.Values\n\n%default total\n\npublic export\ndata TyIR = PORT\n | UNIT\n | MODULE\n | CONN\n | DATA\n | CHAN\n | GATE\n\nexport\nShow TyIR where\n show PORT = \"MTyPORT\"\n show UNIT = \"MTyUNIT\"\n show MODULE = \"MTyMODULE\"\n show CONN = \"MTyCONN\"\n show DATA = \"MTyDATA\"\n show CHAN = \"MTyCHAN\"\n show GATE = \"MTyGATE\"\n\npublic export\ndata ModuleIR : TyIR -> Type where\n MRef : (name : String) -> (type : TyIR) -> ModuleIR type\n MLet : {term : TyIR} -> (name : String)\n -> (beThis : ModuleIR (term))\n -> (inThis : ModuleIR (expr)) -> ModuleIR (expr)\n\n MSeq : {a,b : TyIR} -> (doThis : ModuleIR a)\n -> (thenThis : ModuleIR b) -> ModuleIR b\n\n MEnd : ModuleIR UNIT\n\n MPort : (label : String)\n -> (dir : Direction)\n -> (type : ModuleIR DATA) -> ModuleIR PORT\n\n MModule : {n : Nat} -> Vect (S n) (ModuleIR PORT) -> ModuleIR MODULE\n\n MDataLogic : ModuleIR DATA\n MDataArray : ModuleIR DATA -> Nat -> ModuleIR DATA\n MDataStruct : {n : Nat} -> Vect (S n) (Pair String (ModuleIR DATA)) -> ModuleIR DATA\n MDataUnion : {n : Nat} -> Vect (S n) (Pair String (ModuleIR DATA)) -> ModuleIR DATA\n\n MChan : ModuleIR DATA -> ModuleIR CHAN\n\n MIDX : (label : String)\n -> ModuleIR MODULE\n -> ModuleIR PORT\n -> ModuleIR PORT\n\n MConn : {n : Nat}\n -> (cname : ModuleIR CHAN)\n -> (input : ModuleIR PORT)\n -> (output : Vect (S n) $ ModuleIR PORT)\n -> ModuleIR CONN\n\n MNot : ModuleIR CHAN\n -> ModuleIR CHAN\n -> ModuleIR GATE\n\n MGate : {n : Nat}\n -> TyGateComb\n -> ModuleIR CHAN\n -> Vect (S (S n)) (ModuleIR CHAN)\n -> ModuleIR GATE\n\n MConnG : ModuleIR CHAN\n -> ModuleIR PORT\n -> ModuleIR CONN\n\n-- go from value (with proof of normal form) to moduleIR\npublic export\ninterp : TyValue -> TyIR\ninterp (PORT x) = PORT\ninterp UNIT = UNIT\ninterp (MODULE xs) = MODULE\ninterp CONN = CONN\ninterp DATA = DATA\ninterp CHAN = CHAN\ninterp GATE = GATE\n\ncovering\nconvert : Value type -> ModuleIR (interp type)\nconvert (VRef name type) = MRef name (interp type)\nconvert (VLet name beThis inThis) = MLet name (convert beThis) (convert inThis)\nconvert (VSeq this thenThis) = MSeq (convert this) (convert thenThis)\nconvert VEnd = MEnd\n\nconvert (VPort label dir type) = MPort label dir (convert type)\nconvert (VModule x) = MModule $ mapToVect (\\p => (convert p)) x\n\nconvert VDataLogic = MDataLogic\nconvert (VDataArray x k) = MDataArray (convert x) k\nconvert (VDataStruct xs) = MDataStruct $ map (\\(l,p) => (l,convert p)) xs\nconvert (VDataUnion xs) = MDataUnion $ map (\\(l,p) => (l,convert p)) xs\n\nconvert (VChan x) = MChan (convert x)\nconvert (VIDX name x y) = MIDX name (convert x) (convert y)\n\nconvert (VConnD x y z) = MConn (convert x) (convert y) [convert z]\nconvert (VConnFO x y z) = MConn (convert x) (convert y) (mapToVect (\\p => convert p) z)\nconvert (VNot o i) = MNot (convert o) (convert i)\nconvert (VGate ty o ins) = MGate ty (convert o) (map convert ins)\nconvert (VConnG c idx) = MConnG (convert c) (convert idx)\n\n\ncovering\nexport\nrunConvert : Value type -> ModuleIR (interp type)\nrunConvert = convert\n\ncovering\nshowM : ModuleIR type -> String\nshowM (MRef name type) =\n \"(MRef \" <+> show name <+> \")\"\n\nshowM (MLet x y z) =\n \"(MLet \"\n <+> show x <+> \" \"\n <+> showM y <+> \" \"\n <+> showM z\n <+> \")\"\n\nshowM (MSeq x y) =\n \"(MSeq \"\n <+> showM x <+> \" \"\n <+> showM y\n <+> \")\"\nshowM MEnd = \"(MEnd)\"\n\nshowM (MPort x y z) =\n \"(MPort \"\n <+> show x <+> \" \"\n <+> show y <+> \" \"\n <+> showM z <+> \" \"\n <+> \")\"\n\nshowM (MModule x) =\n \"(MModule \"\n <+> show (map showM x)\n <+> \")\"\n\nshowM MDataLogic = \"(MTyLogic)\"\n\nshowM (MDataArray x k) =\n \"(MTyArray \"\n <+> showM x <+> \" \"\n <+> show k\n <+> \")\"\n\nshowM (MDataStruct {n} xs) = \"(MTyStruct \" <+> show ps <+> \")\"\n where\n covering\n ps : Vect (S n) String\n ps = map (\\(l,c) => \"(\" <+> show l <+> \" \" <+> showM c <+> \")\") xs\n\n\nshowM (MDataUnion {n} xs) = \"(TyUnion \" <+> show ps <+> \")\"\n where\n covering\n ps : Vect (S n) String\n ps = map (\\(l,c) => \"(\" <+> show l <+> \" \" <+> showM c <+> \")\") xs\n\nshowM (MChan x) = \"(MChan \" <+> showM x <+> \")\"\n\nshowM (MIDX x y z) =\n \"(MIndex \"\n <+> show x <+> \" \"\n <+> showM y <+> \" \"\n <+> showM z\n <+> \")\"\n\nshowM (MConn x y ps) =\n \"(MDConn \"\n <+> showM x <+> \" \"\n <+> showM y <+> \" \"\n <+> show (map showM ps)\n <+> \")\"\n\nshowM (MNot o i)\n = unwords [\"(MNot\", showM o, showM i, \")\"]\n\nshowM (MGate ty o ins)\n = unwords [\"(MGate\", show ty, showM o, ins', \")\"]\n\n where\n covering\n ins' : String\n ins' = unwords $ toList $ map (\\c => \"(\" <+> showM c <+> \")\") ins\n\nshowM (MConnG c idx)\n = unwords [\"(MConnG\", showM c, showM idx, \")\"]\n\n\nexport\nShow (ModuleIR type) where\n show = assert_total showM -- TODO\n","avg_line_length":23.9481132075,"max_line_length":87,"alphanum_fraction":0.5672641324} +{"size":1300,"ext":"idr","lang":"Idris","max_stars_count":396.0,"content":"||| Implementation of ordering relations for `Fin`ite numbers\nmodule Data.Fin.Order\n\nimport Data.Fin\nimport Data.Fun\nimport Data.Rel\nimport Data.Nat\nimport Data.Nat.Order\nimport Decidable.Decidable\nimport Decidable.Order\n\n%default total\n\nusing (k : Nat)\n\n public export\n data FinLTE : Fin k -> Fin k -> Type where\n FromNatPrf : {m, n : Fin k} -> LTE (finToNat m) (finToNat n) -> FinLTE m n\n\n public export\n implementation Preorder (Fin k) FinLTE where\n transitive m n o (FromNatPrf p1) (FromNatPrf p2) =\n FromNatPrf (LTEIsTransitive (finToNat m) (finToNat n) (finToNat o) p1 p2)\n reflexive n = FromNatPrf (LTEIsReflexive (finToNat n))\n\n public export\n implementation Poset (Fin k) FinLTE where\n antisymmetric m n (FromNatPrf p1) (FromNatPrf p2) =\n finToNatInjective m n (LTEIsAntisymmetric (finToNat m) (finToNat n) p1 p2)\n\n public export\n implementation Decidable 2 [Fin k, Fin k] FinLTE where\n decide m n with (decideLTE (finToNat m) (finToNat n))\n decide m n | Yes prf = Yes (FromNatPrf prf)\n decide m n | No disprf = No (\\ (FromNatPrf prf) => disprf prf)\n\n public export\n implementation Ordered (Fin k) FinLTE where\n order m n =\n either (Left . FromNatPrf)\n (Right . FromNatPrf)\n (order (finToNat m) (finToNat n))\n","avg_line_length":30.2325581395,"max_line_length":80,"alphanum_fraction":0.6861538462} +{"size":2781,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"module Math.Algebra.Quantum.Qubit\n\nimport public Data.Fin\nimport public Data.Vect\nimport public Data.Matrix\nimport public Data.Matrix.Algebraic\n--import public Data.Matrix.Numeric\nimport public Data.Complex\n\nimport public Control.Algebra\nimport public Control.Algebra.VectorSpace\n\n%access public export\n%default total\n\nC : Type\nC = Complex Double\n\n-- Euler\ne : Double\ne = exp 1\n\n-- Imaginary unit\ni : C\ni = 0:+1\n\n-- Complex Pi\npii : C \npii = pi:+0\n\n-- Complex exponentiation\nexpi : C -> C\nexpi z = \n let es = exp $ realPart z in \n es * (cos $ imagPart z) :+ es * (sin $ imagPart z) \n\n\n-- WIP\n-- really to enforce conjugate transpose we need to have a 1-col matrix\n-- and a 1-row matrix as a Bra i.e. \n-- Ket = Matrix 2 1 C\n-- Bra = Matrix 1 2 C\n-- them implement all the Semigroup\/Monoid\/Group\/InnerProductSpace etc. instances for these\n-- along with interfaces for (ant general matrix classes, definite, normal, semi-definite etc.?)\n-- Operator = Matrix 2 2 C\n-- Unitary : Operator where ... \n-- Hermitian : Unitary where ... \n\n-- in some sense a vector is a linear transformation anyway especially when\n-- you consider dot product as linear transformation to 1-d field\n-- hermitian = dagger = adjoint\n\n\nmmap : (a -> a) -> Matrix n m a -> Matrix n m a\nmmap = map . map\n\n-- TODO instead of aliases we should define new types and classes\n\nKet : Type\nKet = Matrix 2 1 C\n\nBra: Type\nBra = Matrix 1 2 C\n\nket : C -> C -> Ket\nket a b = [[a], [b]]\n\nbra : C -> C -> Bra\nbra a b = [[a, b]]\n\nqubit : C -> C -> Ket\nqubit = ket\n\none : Ket\none = qubit (0:+0) (1:+0)\n\nzero : Ket\nzero = qubit (1:+0) (0:+0)\n\n\nbra2ket : Bra -> Ket\nbra2ket b = Data.Vect.transpose $ mmap conjugate b\n\nket2bra : Ket -> Bra\nket2bra k = Data.Vect.transpose $ mmap conjugate k\n\n\n--\n\nOperator : Type\nOperator = Matrix 2 2 C\n\n\nId : Operator\nId = [[1:+0, 0:+0], [0:+0, 1:+0]]\n\n\n\n{- \nData.Matrix.Agebraic now takes care of these implementations\n\n[AddComplexSemigroup] Semigroup C where\n (<+>) z w = z + w\n\n[MulComplexSemigroup] Semigroup C where\n (<+>) z w = z * w\n\n[AddComplexMonoid] Monoid C using AddComplexSemigroup where\n neutral = 0:+0\n\n[MulComplexMonoid] Monoid C using MulComplexSemigroup where\n neutral = 1:+0\n \nGroup C using MulComplexMonoid where\n inverse z = 1 \/ z\n\nAbelianGroup C where { }\n\nRing C where\n (<.>) z w = z * w\n\nRingWithUnity C where\n unity = 1:+0\n \n\n-- Kets upto InnerProductSpace\n\nSemigroup Ket where\n (<+>) u v = zipWith (+) u v \n\nMonoid Ket where\n neutral = [0:+0, 0:+0]\n\n\nGroup Ket where \n inverse u = map (1 \/) u\n\n\nAbelianGroup Ket where { }\n\n\nModule C Ket where\n (<#>) c v = map (* c) v\n\n-}\n\n{-\nInnerProductSpace C Ket where \n (<||>) u v = sum $ zipWith (*) u v\n \n\ntest : C\ntest = one <||> one\n-}\n\n\n\n\n\n-- Local Variables:\n-- idris-load-packages: (\"base\" \"contrib\")\n-- End:\n","avg_line_length":17.0613496933,"max_line_length":96,"alphanum_fraction":0.656238763} +{"size":806,"ext":"idr","lang":"Idris","max_stars_count":396.0,"content":"import Data.So\n\n%doubleLit fromDouble\n\npublic export\ninterface FromDouble ty where\n fromDouble : Double -> ty\n\n%allow_overloads fromDouble\n\n\nrecord Newtype where\n constructor\n MkNewtype\n wrapped : Double\n\nFromDouble Newtype where\n fromDouble = MkNewtype\n\nShow Newtype where\n showPrec p (MkNewtype v) = showCon p \"MkNewtype\" $ showArg v\n\n\nrecord InUnit where\n constructor MkInUnit\n value : Double\n 0 inBounds : So (0 <= value && value <= 1)\n\nShow InUnit where\n showPrec p (MkInUnit v _) = showCon p \"MkInUnit\" $ showArg v ++ \" _\"\n\nnamespace InUnit\n public export\n fromDouble : (v : Double)\n -> {auto 0 prf : So (0 <= v && v <= 1)}\n -> InUnit\n fromDouble v = MkInUnit v prf\n\n\nmain : IO ()\nmain = do printLn $ the InUnit 0.25\n printLn $ the Newtype 123.456\n","avg_line_length":18.7441860465,"max_line_length":70,"alphanum_fraction":0.6625310174} +{"size":25388,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"module Sub13Apply108x36\r\n\r\nimport ProofColDivSeqBase\r\nimport ProofColDivSeqPostulate\r\n\r\n%default total\r\n-- %language ElabReflection\r\n\r\n\r\n-- 3(36x+12) --F[5,-2]->B[1,-2]--> 3(16x+5)\r\nfb108x36To48x15 :\r\n (o:Nat) -> P (S (S (S (S (S (plus (plus (plus (plus (plus (plus o o) o) (plus (plus o o) o)) (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o)) (S (plus (plus (plus o o) o) (plus (plus o o) o)))))))\r\n (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o)) (S (plus (plus (plus o o) o) (plus (plus o o) o)))))))))))) 2\r\n -> P (S (S (S (S (S (plus (plus (plus (plus o o) (plus o o)) (plus (plus o o) (plus o o))) (plus (plus (plus o o) (plus o o)) (plus (plus o o) (plus o o))))))))) 2\r\nfb108x36To48x15 o prf =\r\n let prf2 = lvDown (S (S (S (S (S (plus (plus (plus (plus (plus (plus o o) o) (plus (plus o o) o)) (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o)) (S (plus (plus (plus o o) o) (plus (plus o o) o)))))))\r\n (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o)) (S (plus (plus (plus o o) o) (plus (plus o o) o)))))))))))) 2\r\n prf in\r\n let prf3 = fb108x36To48x15' o prf2 in lvDown (S (S (S (S (S (plus (plus (plus (plus o o) (plus o o)) (plus (plus o o) (plus o o))) (plus (plus (plus o o) (plus o o)) (plus (plus o o) (plus o o))))))))) 3 prf3\r\n\r\n\r\nexport\r\napply108x36 : P (S (S (S (S (S (plus (plus (plus (plus (plus (plus o o) o) (plus (plus o o) o)) (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o)) (S (plus (plus (plus o o) o) (plus (plus o o) o)))))))\r\n (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o)) (S (plus (plus (plus o o) o) (plus (plus o o) o)))))))))))) 2\r\n -> (m : Nat **\r\n (LTE (S m)\r\n (S (S (S (S (S (plus (plus (plus (plus (plus (plus o o) o) (plus (plus o o) o)) (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o)) (S (plus (plus (plus o o) o) (plus (plus o o) o)))))))\r\n (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o)) (S (plus (plus (plus o o) o) (plus (plus o o) o)))))))))))),\r\n P m 2))\r\napply108x36 {o} col = let col2 = fb108x36To48x15 o col in ((S (S (S (S (S (plus (plus (plus (plus o o) (plus o o)) (plus (plus o o) (plus o o))) (plus (plus (plus o o) (plus o o)) (plus (plus o o) (plus o o)))))))))\r\n ** (lte108x36 o, col2)) where\r\n lte108x36 : (o:Nat) -> LTE (S (S (S (S (S (S (plus (plus (plus (plus o o) (plus o o)) (plus (plus o o) (plus o o)))\r\n (plus (plus (plus o o) (plus o o)) (plus (plus o o) (plus o o))))))))))\r\n (S (S (S (S (S (plus (plus (plus (plus (plus (plus o o) o) (plus (plus o o) o)) (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o)) (S (plus (plus (plus o o) o) (plus (plus o o) o)))))))\r\n (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o)) (S (plus (plus (plus o o) o) (plus (plus o o) o))))))))))))\r\n lte108x36 Z = (lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . LTESucc . LTESucc . LTESucc . LTESucc . LTESucc . LTESucc) LTEZero\r\n lte108x36 (S o) = let lemma = lte108x36 o in\r\n\r\n rewrite (sym (plusSuccRightSucc o o)) in\r\n\r\n rewrite (sym (plusSuccRightSucc (plus o o) (S (plus o o)))) in\r\n rewrite (sym (plusSuccRightSucc (plus o o) (plus o o))) in\r\n\r\n rewrite (sym (plusSuccRightSucc (plus (plus o o) (plus o o)) (S (S (S (plus (plus o o) (plus o o))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus o o) (plus o o)) (S (S (plus (plus o o) (plus o o)))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus o o) (plus o o)) (S (plus (plus o o) (plus o o))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus o o) (plus o o)) (plus (plus o o) (plus o o)))) in\r\n\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus o o) (plus o o)) (plus (plus o o) (plus o o))) (S (S (S (S (S (S (S (plus (plus (plus o o) (plus o o))\r\n (plus (plus o o) (plus o o)))))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus o o) (plus o o)) (plus (plus o o) (plus o o))) (S (S (S (S (S (S (plus (plus (plus o o) (plus o o))\r\n (plus (plus o o) (plus o o))))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus o o) (plus o o)) (plus (plus o o) (plus o o))) (S (S (S (S (S (plus (plus (plus o o) (plus o o))\r\n (plus (plus o o) (plus o o)))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus o o) (plus o o)) (plus (plus o o) (plus o o))) (S (S (S (S (plus (plus (plus o o) (plus o o))\r\n (plus (plus o o) (plus o o))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus o o) (plus o o)) (plus (plus o o) (plus o o))) (S (S (S (plus (plus (plus o o) (plus o o))\r\n (plus (plus o o) (plus o o)))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus o o) (plus o o)) (plus (plus o o) (plus o o))) (S (S (plus (plus (plus o o) (plus o o))\r\n (plus (plus o o) (plus o o))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus o o) (plus o o)) (plus (plus o o) (plus o o))) (S (plus (plus (plus o o) (plus o o))\r\n (plus (plus o o) (plus o o)))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus o o) (plus o o)) (plus (plus o o) (plus o o))) (plus (plus (plus o o) (plus o o))\r\n (plus (plus o o) (plus o o))))) in\r\n\r\n rewrite (sym (plusSuccRightSucc (plus o o) o)) in\r\n\r\n rewrite (sym (plusSuccRightSucc (plus (plus o o) o) (S (S (plus (plus o o) o))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus o o) o) (S (plus (plus o o) o)))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus o o) o) (plus (plus o o) o))) in\r\n\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (S (S (S (S (S (plus (plus (plus o o) o) (plus (plus o o) o)))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (S (S (S (S (plus (plus (plus o o) o) (plus (plus o o) o))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (S (S (S (plus (plus (plus o o) o) (plus (plus o o) o)))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (S (S (plus (plus (plus o o) o) (plus (plus o o) o))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (S (plus (plus (plus o o) o) (plus (plus o o) o)))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o))))) in\r\n\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (S (S (S (S (S (S (S (S (S (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o)\r\n (plus (plus o o) o))))))))))))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (S (S (S (S (S (S (S (S (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o)\r\n (plus (plus o o) o)))))))))))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (S (S (S (S (S (S (S (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o)\r\n (plus (plus o o) o))))))))))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (S (S (S (S (S (S (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o)\r\n (plus (plus o o) o)))))))))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (S (S (S (S (S (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o)\r\n (plus (plus o o) o))))))))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (S (S (S (S (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o)\r\n (plus (plus o o) o)))))))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (S (S (S (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o)\r\n (plus (plus o o) o))))))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (S (S (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o)\r\n (plus (plus o o) o)))))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (S (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o)\r\n (plus (plus o o) o))))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o)\r\n (plus (plus o o) o)))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o)\r\n (plus (plus o o) o))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o)\r\n (plus (plus o o) o)))))))) in\r\n\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus (plus (plus o o) o)\r\n (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o)))))))\r\n (S (S (S (S (S (S (S (S (S (S (S (S (S (plus (plus (plus (plus o o) o)\r\n (plus (plus o o) o)) (S (plus (plus (plus o o)\r\n o)\r\n (plus (plus o o)\r\n o))))))))))))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus (plus (plus o o) o)\r\n (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o)))))))\r\n (S (S (S (S (S (S (S (S (S (S (S (S (plus (plus (plus (plus o o) o)\r\n (plus (plus o o) o)) (S (plus (plus (plus o o)\r\n o)\r\n (plus (plus o o)\r\n o)))))))))))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus (plus (plus o o) o)\r\n (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o)))))))\r\n (S (S (S (S (S (S (S (S (S (S (S (plus (plus (plus (plus o o) o)\r\n (plus (plus o o) o)) (S (plus (plus (plus o o)\r\n o)\r\n (plus (plus o o)\r\n o))))))))))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus (plus (plus o o) o)\r\n (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o)))))))\r\n (S (S (S (S (S (S (S (S (S (S (plus (plus (plus (plus o o) o)\r\n (plus (plus o o) o)) (S (plus (plus (plus o o)\r\n o)\r\n (plus (plus o o)\r\n o)))))))))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus (plus (plus o o) o)\r\n (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o)))))))\r\n (S (S (S (S (S (S (S (S (S (plus (plus (plus (plus o o) o)\r\n (plus (plus o o) o)) (S (plus (plus (plus o o)\r\n o)\r\n (plus (plus o o)\r\n o))))))))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus (plus (plus o o) o)\r\n (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o)))))))\r\n (S (S (S (S (S (S (S (S (plus (plus (plus (plus o o) o)\r\n (plus (plus o o) o)) (S (plus (plus (plus o o)\r\n o)\r\n (plus (plus o o)\r\n o)))))))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus (plus (plus o o) o)\r\n (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o)))))))\r\n (S (S (S (S (S (S (S (plus (plus (plus (plus o o) o)\r\n (plus (plus o o) o)) (S (plus (plus (plus o o)\r\n o)\r\n (plus (plus o o)\r\n o))))))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus (plus (plus o o) o)\r\n (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o)))))))\r\n (S (S (S (S (S (S (plus (plus (plus (plus o o) o)\r\n (plus (plus o o) o)) (S (plus (plus (plus o o)\r\n o)\r\n (plus (plus o o)\r\n o)))))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus (plus (plus o o) o)\r\n (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o)))))))\r\n (S (S (S (S (S (plus (plus (plus (plus o o) o)\r\n (plus (plus o o) o)) (S (plus (plus (plus o o)\r\n o)\r\n (plus (plus o o)\r\n o))))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus (plus (plus o o) o)\r\n (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o)))))))\r\n (S (S (S (S (plus (plus (plus (plus o o) o)\r\n (plus (plus o o) o)) (S (plus (plus (plus o o)\r\n o)\r\n (plus (plus o o)\r\n o)))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus (plus (plus o o) o)\r\n (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o)))))))\r\n (S (S (S (plus (plus (plus (plus o o) o)\r\n (plus (plus o o) o)) (S (plus (plus (plus o o)\r\n o)\r\n (plus (plus o o)\r\n o))))))))) in\r\n rewrite (sym (plusSuccRightSucc (plus (plus (plus (plus (plus o o) o)\r\n (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o))))\r\n (S (S (plus (plus (plus (plus o o) o) (plus (plus o o) o))\r\n (S (plus (plus (plus o o) o) (plus (plus o o) o)))))))\r\n (S (S (plus (plus (plus (plus o o) o)\r\n (plus (plus o o) o)) (S (plus (plus (plus o o)\r\n o)\r\n (plus (plus o o)\r\n o)))))))) in\r\n\r\n (lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . lteSuccRight . LTESucc . LTESucc . LTESucc . LTESucc . LTESucc . LTESucc . LTESucc . LTESucc . LTESucc . LTESucc . LTESucc . LTESucc . LTESucc . LTESucc . LTESucc . LTESucc) lemma\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n","avg_line_length":89.0807017544,"max_line_length":472,"alphanum_fraction":0.3303529226} +{"size":19672,"ext":"idr","lang":"Idris","max_stars_count":128.0,"content":"module TTImp.Elab.Case\n\nimport Core.Context\nimport Core.Context.Log\nimport Core.Core\nimport Core.Env\nimport Core.Metadata\nimport Core.Normalise\nimport Core.Unify\nimport Core.TT\nimport Core.Value\n\nimport Idris.Syntax\n\nimport TTImp.Elab.Check\nimport TTImp.Elab.Delayed\nimport TTImp.Elab.ImplicitBind\nimport TTImp.Elab.Utils\nimport TTImp.TTImp\nimport TTImp.Utils\n\nimport Data.List\nimport Data.Maybe\nimport Data.String\nimport Libraries.Data.NameMap\n\n%default covering\n\nexport\nchangeVar : (old : Var vs) -> (new : Var vs) -> Term vs -> Term vs\nchangeVar (MkVar {i=x} old) (MkVar new) (Local fc r idx p)\n = if x == idx\n then Local fc r _ new\n else Local fc r _ p\nchangeVar old new (Meta fc nm i args)\n = Meta fc nm i (map (changeVar old new) args)\nchangeVar (MkVar old) (MkVar new) (Bind fc x b sc)\n = Bind fc x (assert_total (map (changeVar (MkVar old) (MkVar new)) b))\n (changeVar (MkVar (Later old)) (MkVar (Later new)) sc)\nchangeVar old new (App fc fn arg)\n = App fc (changeVar old new fn) (changeVar old new arg)\nchangeVar old new (As fc s nm p)\n = As fc s (changeVar old new nm) (changeVar old new p)\nchangeVar old new (TDelayed fc r p)\n = TDelayed fc r (changeVar old new p)\nchangeVar old new (TDelay fc r t p)\n = TDelay fc r (changeVar old new t) (changeVar old new p)\nchangeVar old new (TForce fc r p)\n = TForce fc r (changeVar old new p)\nchangeVar old new tm = tm\n\nfindLater : (x : Name) -> (newer : List Name) -> Var (newer ++ x :: older)\nfindLater x [] = MkVar First\nfindLater {older} x (_ :: xs)\n = let MkVar p = findLater {older} x xs in\n MkVar (Later p)\n\ntoRig1 : {idx : Nat} -> (0 p : IsVar nm idx vs) -> Env Term vs -> Env Term vs\ntoRig1 First (b :: bs)\n = if isErased (multiplicity b)\n then setMultiplicity b linear :: bs\n else b :: bs\ntoRig1 (Later p) (b :: bs) = b :: toRig1 p bs\n\ntoRig0 : {idx : Nat} -> (0 p : IsVar nm idx vs) -> Env Term vs -> Env Term vs\ntoRig0 First (b :: bs) = setMultiplicity b erased :: bs\ntoRig0 (Later p) (b :: bs) = b :: toRig0 p bs\n\n-- When we abstract over the evironment, pi needs to be explicit\nexplicitPi : Env Term vs -> Env Term vs\nexplicitPi (Pi fc c _ ty :: env) = Pi fc c Explicit ty :: explicitPi env\nexplicitPi (b :: env) = b :: explicitPi env\nexplicitPi [] = []\n\nallow : Maybe (Var vs) -> Env Term vs -> Env Term vs\nallow Nothing env = env\nallow (Just (MkVar p)) env = toRig1 p env\n\n-- If the name is used elsewhere, update its multiplicity so it's\n-- not required to be used in the case block\nupdateMults : List (Var vs) -> Env Term vs -> Env Term vs\nupdateMults [] env = env\nupdateMults (MkVar p :: us) env = updateMults us (toRig0 p env)\n\nfindImpsIn : {vars : _} ->\n FC -> Env Term vars -> List (Name, Term vars) -> Term vars ->\n Core ()\nfindImpsIn fc env ns (Bind _ n b@(Pi _ _ Implicit ty) sc)\n = findImpsIn fc (b :: env)\n ((n, weaken ty) :: map (\\x => (fst x, weaken (snd x))) ns)\n sc\nfindImpsIn fc env ns (Bind _ n b sc)\n = findImpsIn fc (b :: env)\n (map (\\x => (fst x, weaken (snd x))) ns)\n sc\nfindImpsIn fc env ns ty\n = when (not (isNil ns)) $\n throw (TryWithImplicits fc env (reverse ns))\n\nmerge : {vs : List Name} ->\n List (Var vs) -> List (Var vs) -> List (Var vs)\nmerge [] xs = xs\nmerge (v :: vs) xs\n = merge vs (v :: filter (not . sameVar v) xs)\n\n-- Extend the list of variables we need in the environment so far, removing\n-- duplicates\nextendNeeded : {vs : _} ->\n Binder (Term vs) ->\n Env Term vs -> List (Var vs) -> List (Var vs)\nextendNeeded (Let _ _ ty val) env needed\n = merge (findUsedLocs env ty) (merge (findUsedLocs env val) needed)\nextendNeeded (PLet _ _ ty val) env needed\n = merge (findUsedLocs env ty) (merge (findUsedLocs env val) needed)\nextendNeeded b env needed\n = merge (findUsedLocs env (binderType b)) needed\n\nisNeeded : Nat -> List (Var vs) -> Bool\nisNeeded x [] = False\nisNeeded x (MkVar {i} _ :: xs) = x == i || isNeeded x xs\n\nfindScrutinee : {vs : _} ->\n Env Term vs -> RawImp -> Maybe (Var vs)\nfindScrutinee {vs = n' :: _} (b :: bs) (IVar loc' n)\n = if n' == n && not (isLet b)\n then Just (MkVar First)\n else do MkVar p <- findScrutinee bs (IVar loc' n)\n Just (MkVar (Later p))\nfindScrutinee _ _ = Nothing\n\ngetNestData : (Name, (Maybe Name, List (Var vars), a)) ->\n (Name, Maybe Name, List (Var vars))\ngetNestData (n, (mn, enames, _)) = (n, mn, enames)\n\nbindCaseLocals : FC -> List (Name, Maybe Name, List (Var vars)) ->\n List (Name, Name)-> RawImp -> RawImp\nbindCaseLocals fc [] args rhs = rhs\nbindCaseLocals fc ((n, mn, envns) :: rest) argns rhs\n = -- trace (\"Case local \" ++ show (n,mn,envns) ++ \" from \" ++ show argns) $\n ICaseLocal fc n (fromMaybe n mn)\n (map getNameFrom envns)\n (bindCaseLocals fc rest argns rhs)\n where\n getArg : List (Name, Name) -> Nat -> Maybe Name\n getArg [] _ = Nothing\n getArg ((_, x) :: xs) Z = Just x\n getArg (x :: xs) (S k) = getArg xs k\n\n getNameFrom : Var vars -> Name\n getNameFrom (MkVar {i} _)\n = case getArg argns i of\n Nothing => n\n Just n' => n'\n\nexport\ncaseBlock : {vars : _} ->\n {auto c : Ref Ctxt Defs} ->\n {auto m : Ref MD Metadata} ->\n {auto u : Ref UST UState} ->\n {auto e : Ref EST (EState vars)} ->\n {auto s : Ref Syn SyntaxInfo} ->\n RigCount ->\n ElabInfo -> FC ->\n NestedNames vars ->\n Env Term vars ->\n RawImp -> -- original scrutinee\n Term vars -> -- checked scrutinee\n Term vars -> -- its type\n RigCount -> -- its multiplicity\n List ImpClause -> Maybe (Glued vars) ->\n Core (Term vars, Glued vars)\ncaseBlock {vars} rigc elabinfo fc nest env scr scrtm scrty caseRig alts expected\n = do -- TODO (or to decide): Blodwen allowed ambiguities in the scrutinee\n -- to be delayed, but now I think it's better to have simpler\n -- resolution rules, and not delay\n\n est <- get EST\n fullImps <- getToBind fc (elabMode elabinfo)\n (implicitMode elabinfo) env []\n log \"elab.case\" 5 $ \"Doing a case under unbound implicits \" ++ show fullImps\n\n scrn <- genVarName \"scr\"\n casen <- genCaseName !(prettyName !(toFullNames (Resolved (defining est))))\n\n -- Update environment so that linear bindings which were used\n -- (esp. in the scrutinee!) are set to 0 in the case type\n let env = updateMults (linearUsed est) env\n defs <- get Ctxt\n parentDef <- lookupCtxtExact (Resolved (defining est)) (gamma defs)\n let vis = case parentDef of\n Just gdef =>\n if visibility gdef == Public\n then Public\n else Private\n Nothing => Public\n\n -- if the scrutinee is ones of the arguments in 'env' we should\n -- split on that, rather than adding it as a new argument\n let splitOn = findScrutinee env scr\n\n caseretty_in <- case expected of\n Just ty => getTerm ty\n _ =>\n do nmty <- genName \"caseTy\"\n u <- uniVar fc\n metaVar fc erased env nmty (TType fc u)\n\n u <- uniVar fc\n (caseretty, _) <- bindImplicits fc (implicitMode elabinfo) defs env\n fullImps caseretty_in (TType fc u)\n let casefnty\n = abstractFullEnvType fc (allow splitOn (explicitPi env))\n (maybe (Bind fc scrn (Pi fc caseRig Explicit scrty)\n (weaken caseretty))\n (const caseretty) splitOn)\n -- If we can normalise the type without the result being excessively\n -- big do it. It's the depth of stuck applications - 10 is already\n -- pretty much unreadable!\n casefnty <- normaliseSizeLimit defs 10 [] casefnty\n (erasedargs, _) <- findErased casefnty\n\n logEnv \"elab.case\" 10 \"Case env\" env\n logTermNF \"elab.case\" 2 (\"Case function type: \" ++ show casen) [] casefnty\n traverse_ addToSave (keys (getMetas casefnty))\n\n -- If we've had to add implicits to the case type (because there\n -- were unbound implicits) then we're in a bit of a mess. Easiest\n -- way out is to throw an error and try again with the implicits\n -- actually bound! This is rather hacky, but a lot less fiddly than\n -- the alternative of fixing up the environment\n when (not (isNil fullImps)) $ findImpsIn fc [] [] casefnty\n cidx <- addDef casen ({ eraseArgs := erasedargs }\n (newDef fc casen (if isErased rigc then erased else top)\n [] casefnty vis None))\n\n -- set the totality of the case block to be the same as that\n -- of the parent function\n let tot = fromMaybe PartialOK $ do findSetTotal (flags !parentDef)\n log \"elab.case\" 5 $\n unwords [ \"Setting totality requirement for\", show casen\n , \"to\", show tot]\n setFlag fc (Resolved cidx) (SetTotal tot)\n let caseRef : Term vars = Ref fc Func (Resolved cidx)\n\n let applyEnv = applyToFull fc caseRef env\n let appTm : Term vars\n = maybe (App fc applyEnv scrtm)\n (const applyEnv)\n splitOn\n\n let alts' = map (updateClause casen splitOn nest env) alts\n log \"elab.case\" 2 $ \"Nested: \" ++ show (map getNestData (names nest))\n log \"elab.case\" 2 $ \"Generated alts: \" ++ show alts'\n logTermNF \"elab.case\" 2 \"Case application\" env appTm\n\n -- Start with empty nested names, since we've extended the rhs with\n -- ICaseLocal so they'll get rebuilt with the right environment\n let nest' = MkNested []\n ust <- get UST\n -- We don't want to keep rechecking delayed elaborators in the\n -- case block, because they're not going to make progress until\n -- we come out again, so save them\n let olddelayed = delayedElab ust\n put UST ({ delayedElab := [] } ust)\n processDecl [InCase] nest' [] (IDef fc casen alts')\n\n -- If there's no duplication of the scrutinee in the block,\n -- flag it as inlinable.\n -- This will be the case either if the scrutinee is a variable, in\n -- which case the duplication won't hurt, or if there's no variable\n -- duplicated in the body (what ghc calls W-safe)\n -- We'll check that second condition later, after generating the\n -- runtime (erased) case trees\n let inlineOK = maybe False (const True) splitOn\n when inlineOK $ setFlag fc casen Inline\n\n ust <- get UST\n put UST ({ delayedElab := olddelayed } ust)\n\n pure (appTm, gnf env caseretty)\n where\n mkLocalEnv : Env Term vs -> Env Term vs\n mkLocalEnv [] = []\n mkLocalEnv (b :: bs)\n = let b' = if isLinear (multiplicity b)\n then setMultiplicity b erased\n else b in\n b' :: mkLocalEnv bs\n\n -- Return the original name in the environment, and what it needs to be\n -- called in the case block. We need to mapping to build the ICaseLocal\n -- so that it applies to the right original variable\n getBindName : Int -> Name -> List Name -> (Name, Name)\n getBindName idx n@(UN un) vs\n = if n `elem` vs then (n, MN (displayUserName un) idx) else (n, n)\n getBindName idx n vs\n = if n `elem` vs then (n, MN \"_cn\" idx) else (n, n)\n\n -- Returns a list of names that nestednames should be applied to, mapped\n -- to what the name has become in the case block, and a list of terms for\n -- the LHS of the case to be applied to.\n addEnv : {vs : _} ->\n Int -> Env Term vs -> List Name -> (List (Name, Name), List RawImp)\n addEnv idx [] used = ([], [])\n addEnv idx {vs = v :: vs} (b :: bs) used\n = let n = getBindName idx v used\n (ns, rest) = addEnv (idx + 1) bs (snd n :: used)\n ns' = n :: ns in\n (ns', IAs fc EmptyFC UseLeft (snd n) (Implicit fc True) :: rest)\n\n -- Replace a variable in the argument list; if the reference is to\n -- a variable kept in the outer environment (therefore not an argument\n -- in the list) don't consume it\n replace : (idx : Nat) -> RawImp -> List RawImp -> List RawImp\n replace Z lhs (old :: xs)\n = let lhs' = case old of\n IAs loc' nameLoc' side n _ => IAs loc' nameLoc' side n lhs\n _ => lhs in\n lhs' :: xs\n replace (S k) lhs (x :: xs)\n = x :: replace k lhs xs\n replace _ _ xs = xs\n\n mkSplit : Maybe (Var vs) ->\n RawImp -> List RawImp ->\n List RawImp\n mkSplit Nothing lhs args = reverse (lhs :: args)\n mkSplit (Just (MkVar {i} prf)) lhs args\n = reverse (replace i lhs args)\n\n -- Names used in the pattern we're matching on, so don't bind them\n -- in the generated case block\n usedIn : RawImp -> List Name\n usedIn (IBindVar _ n) = [UN $ Basic n]\n usedIn (IApp _ f a) = usedIn f ++ usedIn a\n usedIn (IAs _ _ _ n a) = n :: usedIn a\n usedIn (IAlternative _ _ alts) = concatMap usedIn alts\n usedIn _ = []\n\n -- Get a name update for the LHS (so that if there's a nested data declaration\n -- the constructors are applied to the environment in the case block)\n nestLHS : FC -> (Name, (Maybe Name, List (Var vars), a)) -> (Name, RawImp)\n nestLHS fc (n, (mn, ns, t))\n = (n, apply (IVar fc (fromMaybe n mn))\n (map (const (Implicit fc False)) ns))\n\n applyNested : NestedNames vars -> RawImp -> RawImp\n applyNested nest lhs\n = let fc = getFC lhs in\n substNames [] (map (nestLHS fc) (names nest)) lhs\n\n updateClause : Name -> Maybe (Var vars) ->\n NestedNames vars ->\n Env Term vars -> ImpClause -> ImpClause\n updateClause casen splitOn nest env (PatClause loc' lhs rhs)\n = let (ns, args) = addEnv 0 env (usedIn lhs)\n args' = mkSplit splitOn lhs args\n lhs' = apply (IVar loc' casen) args' in\n PatClause loc' (applyNested nest lhs')\n (bindCaseLocals loc' (map getNestData (names nest))\n ns rhs)\n -- With isn't allowed in a case block but include for completeness\n updateClause casen splitOn nest env (WithClause loc' lhs wval prf flags cs)\n = let (_, args) = addEnv 0 env (usedIn lhs)\n args' = mkSplit splitOn lhs args\n lhs' = apply (IVar loc' casen) args' in\n WithClause loc' (applyNested nest lhs') wval prf flags cs\n updateClause casen splitOn nest env (ImpossibleClause loc' lhs)\n = let (_, args) = addEnv 0 env (usedIn lhs)\n args' = mkSplit splitOn lhs args\n lhs' = apply (IVar loc' casen) args' in\n ImpossibleClause loc' (applyNested nest lhs')\n\n\nexport\ncheckCase : {vars : _} ->\n {auto c : Ref Ctxt Defs} ->\n {auto m : Ref MD Metadata} ->\n {auto u : Ref UST UState} ->\n {auto e : Ref EST (EState vars)} ->\n {auto s : Ref Syn SyntaxInfo} ->\n RigCount -> ElabInfo ->\n NestedNames vars -> Env Term vars ->\n FC -> (scr : RawImp) -> (ty : RawImp) -> List ImpClause ->\n Maybe (Glued vars) ->\n Core (Term vars, Glued vars)\ncheckCase rig elabinfo nest env fc scr scrty_in alts exp\n = delayElab fc rig env exp CaseBlock $\n do scrty_exp <- case scrty_in of\n Implicit _ _ => guessScrType alts\n _ => pure scrty_in\n u <- uniVar fc\n (scrtyv, scrtyt) <- check erased elabinfo nest env scrty_exp\n (Just (gType fc u))\n logTerm \"elab.case\" 10 \"Expected scrutinee type\" scrtyv\n -- Try checking at the given multiplicity; if that doesn't work,\n -- try checking at Rig1 (meaning that we're using a linear variable\n -- so the scrutinee should be linear)\n let chrig = if isErased rig then erased else top\n log \"elab.case\" 5 $ \"Checking \" ++ show scr ++ \" at \" ++ show chrig\n\n (scrtm_in, gscrty, caseRig) <- handle\n (do c <- runDelays (const True) $ check chrig elabinfo nest env scr (Just (gnf env scrtyv))\n pure (fst c, snd c, chrig))\n $ \\case\n e@(LinearMisuse _ _ r _)\n => branchOne\n (do c <- runDelays (const True) $ check linear elabinfo nest env scr\n (Just (gnf env scrtyv))\n pure (fst c, snd c, linear))\n (throw e)\n r\n e => throw e\n\n scrty <- getTerm gscrty\n logTermNF \"elab.case\" 5 \"Scrutinee type\" env scrty\n defs <- get Ctxt\n checkConcrete !(nf defs env scrty)\n caseBlock rig elabinfo fc nest env scr scrtm_in scrty caseRig alts exp\n where\n -- For the moment, throw an error if we haven't been able to work out\n -- the type of the case scrutinee, because we'll need it to build the\n -- type of the case block. But (TODO) consider delaying on failure?\n checkConcrete : NF vs -> Core ()\n checkConcrete (NApp _ (NMeta n i _) _)\n = throw (GenericMsg fc \"Can't infer type for case scrutinee\")\n checkConcrete _ = pure ()\n\n applyTo : Defs -> RawImp -> NF [] -> Core RawImp\n applyTo defs ty (NBind fc _ (Pi _ _ Explicit _) sc)\n = applyTo defs (IApp fc ty (Implicit fc False))\n !(sc defs (toClosure defaultOpts [] (Erased fc False)))\n applyTo defs ty (NBind _ x (Pi _ _ _ _) sc)\n = applyTo defs (INamedApp fc ty x (Implicit fc False))\n !(sc defs (toClosure defaultOpts [] (Erased fc False)))\n applyTo defs ty _ = pure ty\n\n -- Get the name and type of the family the scrutinee is in\n getRetTy : Defs -> NF [] -> Core (Maybe (Name, NF []))\n getRetTy defs (NBind fc _ (Pi _ _ _ _) sc)\n = getRetTy defs !(sc defs (toClosure defaultOpts [] (Erased fc False)))\n getRetTy defs (NTCon _ n _ arity _)\n = do Just ty <- lookupTyExact n (gamma defs)\n | Nothing => pure Nothing\n pure (Just (n, !(nf defs [] ty)))\n getRetTy _ _ = pure Nothing\n\n -- Guess a scrutinee type by looking at the alternatives, so that we\n -- have a hint for building the case type\n guessScrType : List ImpClause -> Core RawImp\n guessScrType [] = pure $ Implicit fc False\n guessScrType (PatClause _ x _ :: xs)\n = case getFn x of\n IVar _ n =>\n do defs <- get Ctxt\n [(n', (_, ty))] <- lookupTyName n (gamma defs)\n | _ => guessScrType xs\n Just (tyn, tyty) <- getRetTy defs !(nf defs [] ty)\n | _ => guessScrType xs\n applyTo defs (IVar fc tyn) tyty\n _ => guessScrType xs\n guessScrType (_ :: xs) = guessScrType xs\n","avg_line_length":42.4881209503,"max_line_length":105,"alphanum_fraction":0.5670496137} +{"size":5107,"ext":"idr","lang":"Idris","max_stars_count":6.0,"content":"module Data.Bytes.Lazy.IO\n\n-- functions for reading\/writing Bytes to and from files\n\n-- Data.Bytes.Strict.IO should be safe and stable to depend on, though the\n-- module might move over time. Conversely Data.Bytes.Lazy.IO is not a good\n-- idea to depend on despite being the more useful API. It is being provided\n-- for the purposes of developing this library and for people to prototype with\n-- but it is lazy IO, and one of the lessons of Haskell is that while lazyness\n-- is good, lazy io isn't. There's just no way to deal with IO errors in pure\n-- code, and doing IO lazily will give you exactly that. Say we've read some\n-- file into a lazy bytes and pass it along to our pure code. If the file is\n-- closed before we start consuming the LBytes, we'll get a file error in a\n-- place it can't be addressed\/handled. We don't have an exception mechanism in\n-- idris2 currently so this is slightly less of a problem than it is in haskell\n-- but at the same time it'd be a real hassle to make every LBytes method end\n-- with `Either Error a`. The ideal way to go is a streaming IO library that\n-- provides our LBytes rather than lazy io because you can structure your\n-- program around the streaming lib and have confidence about when issues will\n-- crop up and where to handle them.\n\n\n\nimport Data.Bytes.Lazy\nimport Data.Bytes.Strict\nimport Data.Bytes.Util\n\nimport Data.Word.Word8\n\nimport System.File\n\n-------------------------------------------------\n-- primmmmmsssss\n-------------------------------------------------\n\n-- fGetChar grabs an `c unsigned char` and casts it to idris2 Char\n-- Should really just have our own that casts to Word8\n-- an fGetByte iow, idris2 just calls fgetc and so can we\n\nsupport : String -> String\nsupport fn = \"C:\" ++ fn ++ \", libidris2_support\"\n\n%foreign support \"idris2_fileError\"\nprim_error' : FilePtr -> PrimIO Int\n\n%foreign support \"idris2_fileErrno\"\nprim_fileErrno' : PrimIO Int\n\n%foreign support \"fgetc\"\nprim__readChar' : FilePtr -> PrimIO Int\n\nreturnError : IO (Either FileError a)\nreturnError\n = do err <- primIO prim_fileErrno'\n case err of\n 0 => pure $ Left FileReadError\n 1 => pure $ Left FileWriteError\n 2 => pure $ Left FileNotFound\n 3 => pure $ Left PermissionDenied\n 4 => pure $ Left FileExists\n _ => pure $ Left (GenericFileError (err-5))\n\nfGetByte : (h : File) -> IO (Either FileError Word8)\nfGetByte (FHandle h)\n = do c <- primIO (prim__readChar' h)\n ferr <- primIO (prim_error' h)\n if (ferr \/= 0)\n then returnError\n else pure (Right (cast c))\n\n-------------------------------------------------\n\n-- read some number of file chacters, crash with msg on problem or eof, this is\n-- to check if we're reading lazily.\n-- If we eof crash then we read the whole file at once.\npartial\nreadN : File -> Int -> IO (List Word8)\nreadN f n = if 0 >= n then pure []\n else\n do Right c <- fGetByte f\n | Left err => idris_crash \"readN Left\"\n False <- fEOF f\n | True => pure []\n -- If we're at fEOF then c was \\NUL !\n [| pure c :: readN f (n-1) |]\n\ntake : Nat -> LBytes -> LBytes\ntake Z lb = Empty\ntake (S k) Empty = Empty\ntake (S k) (Chunk b bs) = Chunk b (take k bs)\n\npartial\nfileTest : IO LBytes\nfileTest = do Right f <- openFile \"foo.txt\" Read\n | Left err => idris_crash (show err)\n r <- make f []\n pure $ buildup f r\n where\n partial\n make : File -> List Word8 -> IO (Bytes, List Word8)\n make f rem\n = do rs@(_::_) <- readN f 32\n | [] => pure (empty,[])\n pure (packUpToNBytes 32 (rem ++ rs))\n partial\n buildup : File -> (Bytes, List Word8) -> LBytes\n buildup f (b,rem)\n = if null b then Empty\n else Chunk b (buildup f (unsafePerformIO $ make f rem))\n -- ^ unsafePerformIO is so that we're not in IO, so we can do this creation\n -- lazily, don't do this yourself! Make or use a streaming IO lib. In the\n -- real world we desire predictable errors, thus our use of IO should be\n -- predictable, who knows where in our program our errrors are going to\n -- explode up now that we've lied and said `make` is pure.\n\nprinto : LBytes -> IO ()\nprinto lb = go 0 lb\n where\n go : Int -> LBytes -> IO ()\n go n Empty = putStrLn $ \"End of lazy bytes. If you didn't get an eof\"\n ++ \"error\\nthen we succeeded in reading only part of the file.\"\n go n (Chunk _ lbs) = do\n putStrLn $ \"Chunk \" ++ show n\n go (n + 1) lbs\n\nexport\npartial\nlazyIOTest : IO ()\nlazyIOTest = do f <- fileTest\n putStrLn \"Lazy Bytes test:\"\n printo (take 2 f)\n putStrLn \"Eat to eof test:\"\n printo f -- This should eof crash.\n \n\n\n-- super basic boys\n\nreadFile : (filename : String) -> IO (Either FileError LBytes)\n\nwriteFile : File -> (filename : String) -> LBytes -> IO (Maybe FileError)\n\n","avg_line_length":35.7132867133,"max_line_length":79,"alphanum_fraction":0.6075974153} +{"size":333,"ext":"idr","lang":"Idris","max_stars_count":161.0,"content":"identityInt : Int -> Int\nidentityInt x = x\n\nidentityString : String -> String\nidentityString x = x\n\nidentityBool : Bool -> Bool\nidentityBool x = x\n\nidentity : ty -> ty\nidentity x = x\n\ndoubleNat : Nat -> Nat\ndoubleNat x = x * x\n\ndoubleInteger : Integer -> Integer\ndoubleInteger x = x * x\n\ndouble : Num ty => ty -> ty\ndouble x = x * x\n","avg_line_length":15.8571428571,"max_line_length":34,"alphanum_fraction":0.6666666667} +{"size":1046,"ext":"idr","lang":"Idris","max_stars_count":null,"content":"module Test\n\nimport Data.Universe\nimport Control.Monad.Ref\n\n\n\n-- Universe --------------------------------------------------------------------\n\n\ndata Basic\n = INT\n | STR\n\n\nUninhabited (INT = STR) where\n uninhabited Refl impossible\n\n\nDecEq Basic where\n decEq INT INT = Yes Refl\n decEq STR STR = Yes Refl\n\n decEq INT STR = No absurd\n decEq STR INT = No (negEqSym absurd)\n\n\n[basic] Universe Basic where\n typeOf INT = Int\n typeOf STR = String\n\n defaultOf INT = 0\n defaultOf STR = \"\"\n\n\n\n-- Tests -----------------------------------------------------------------------\n\n\ntest0 : IO Int\ntest0 = do\n r <- newIORef 5\n writeIORef r 10\n x <- readIORef r\n pure x\n\n\ntest1 : MonadRef IORef IO => IO Int\ntest1 = do\n r <- ref (the Int 5)\n r := (the Int 10)\n x <- deref r\n pure x\n\n\ntest2 : MonadRef IORef IO => IO String\ntest2 = do\n r <- ref \"Hello\"\n r := !(deref r) ++ \" World!\"\n x <- deref r\n pure x\n\n\n-- testRef : Ref @{Test.basic} Int\n-- testRef = do\n-- r <- ref (the Int 5)\n-- r := (the Int 10)\n-- x <- deref r\n-- pure (x + 2)\n","avg_line_length":14.9428571429,"max_line_length":80,"alphanum_fraction":0.5239005736} +{"size":727,"ext":"idr","lang":"Idris","max_stars_count":1.0,"content":"module VectMissing\n\nusing (x : a, xs : Vect n a)\n data IsElem : a -> Vect n a -> Type where\n First : IsElem x (x :: xs)\n Later : IsElem x xs -> IsElem x (y :: xs)\n\n instance Uninhabited (IsElem x []) where\n uninhabited First impossible\n uninhabited (Later p) impossible\n\n isElem : DecEq a => (x : a) -> (xs : Vect n a) -> Maybe (IsElem x xs)\n isElem x [] = Nothing\n isElem x (y :: xs) with (decEq x y)\n isElem x (x :: xs) | (Yes refl) = Just First\n isElem x (y :: xs) | (No f) = Just (Later !(isElem x xs))\n\n shrink : (xs : Vect (S n) a) -> IsElem x xs -> Vect n a\n shrink (x :: ys) First = ys\n shrink (y :: []) (Later p) = absurd p\n shrink (y :: (x :: xs)) (Later p) = y :: shrink (x :: xs) p\n","avg_line_length":33.0454545455,"max_line_length":71,"alphanum_fraction":0.552957359}