This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @module("ethers") external decodeBase58Unsafe: string => bigint = "decodeBase58" | |
| @get external code: Js.Exn.t => string = "code" | |
| @get external argument: Js.Exn.t => string = "argument" | |
| @get external value: Js.Exn.t => string = "value" | |
| @get external shortMessage: Js.Exn.t => string = "shortMessage" | |
| type decodeBase58Error = | |
| | UnknownError | |
| | InputError({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module ListParser (module ListParser) where | |
| import Data.Void (Void) | |
| import Text.Megaparsec (Parsec, optional, parseTest, sepBy, (<|>)) | |
| import Text.Megaparsec.Char (char, space, string) | |
| import Text.Megaparsec.Char.Lexer (decimal) | |
| type Parser = Parsec Void String | |
| parseInt :: Parser Int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // NOTE: Provided Haskell signatures were simplified for learning purposes. | |
| // Such as: renaming `<*>` as `apply`. Operators may unnecessarily confuse the | |
| // reader of this file. Check out the documentation if you want to apply this | |
| // knowledge in real Haskell. | |
| type Option<A> = | |
| | { _tag: "None" } | |
| | { _tag: "Some", value: A } | |
| const none = <A>(): Option<A> => ({ _tag: "None" }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| universe u | |
| inductive Color where | |
| | red | |
| | black | |
| deriving Repr | |
| inductive RBTree (α : Type u) where | |
| | leaf | |
| | node (c : Color) (l : RBTree α) (v : α) (r : RBTree α) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| zero = f => a => a | |
| once = f => a => f(a) | |
| twice = f => a => f(f(a)) | |
| thrice = f => a => f(f(f(a))) | |
| succ = n => f => a => f(n(f)(a)) | |
| succB = n => f => B(f)(n(f)) | |
| num = n => n(x => x + 1)(0) | |
| n0 = zero | |
| n1 = succ(n0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| inductive Color : Type where | |
| | red | black | |
| inductive Node (α : Type) : Color → Nat → Type where | |
| | leaf : Node α .black 0 | |
| | nodeB : Node α lc h → α → Node α rc h → Node α .black (h + 1) | |
| | nodeR : Node α .black h → α → Node α .black h → Node α .red h | |
| inductive RedBlackTree (α : Type) : Type where | |
| | tree : Node α .black h → RedBlackTree α |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::fmt; | |
| // List definition | |
| #[derive(Debug, Clone)] | |
| enum List<A> { | |
| Nil, | |
| Cons(A, Box<List<A>>), | |
| } | |
| use List::{Cons, Nil}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import axios, { AxiosRequestConfig } from "axios"; | |
| import { Effect as IO, Option, pipe } from "effect"; | |
| import { credentials } from "@store/global"; | |
| import { BackendPath, UnauthenticatedError, RequestFailedError } from "@common/index"; | |
| const Headers = { | |
| Authorization: "Authorization", | |
| RefreshToken: "x-refresh-token", | |
| } as const; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Data.Bits (Bits (shiftL, shiftR, (.&.), (.|.))) | |
| import Data.Word (Word32, Word64, Word8) | |
| word64 :: (Word32, Word8) -> Word64 | |
| word64 (w32, w8) = ((fromIntegral w32 :: Word64) `shiftL` 8) .|. (fromIntegral w8 :: Word64) | |
| {-# INLINE [0] word64 #-} | |
| unword64Fst :: Word64 -> Word32 | |
| unword64Fst w = fromIntegral (w `shiftR` 8) | |
| {-# INLINE [0] unword64Fst #-} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE BlockArguments #-} | |
| {-# LANGUAGE DeriveAnyClass #-} | |
| {-# LANGUAGE DerivingStrategies #-} | |
| {-# LANGUAGE DuplicateRecordFields #-} | |
| {-# LANGUAGE LambdaCase #-} | |
| module Main (main) where | |
| import Control.DeepSeq (NFData, force) | |
| import Control.Exception (evaluate) |