GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Lean-zh/binary

BranchesTags
Open more actions menu

Latest commit

 

History

39 Commits
39 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
Binary
Binary
 
 
.gitignore
.gitignore
 
 
Binary.lean
Binary.lean
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
Test.lean
Test.lean
 
 
lake-manifest.json
lake-manifest.json
 
 
lakefile.lean
lakefile.lean
 
 
lean-toolchain
lean-toolchain
 
 

Repository files navigation

binary

Lean 4 package for binary data serialization and deserialization, with name binary inspired by Haskell's binary package.

Usage

Add to lakefile.lean:

require binary from git "https://github.com/Lean-zh/binary.git"

Deriving

import Binary

open Binary Primitive

open LE in
@[bin_enum 4 [0, 2]]
inductive A where
  | a -- 0
  | b (s : Int32) -- 2
deriving Encode, Decode

open BE in
structure B where
  s : Int32
deriving Encode, Decode

#eval Put.run 128 (put (A.b 1234))

Serialization/Deserialization

import Binary

open Binary Primitive.LE
...

Or open Primitive.BE when you want to handle data in big endian.

The recommended usage is

import Binary

open Binary Primitive

open LE in
def serialize_xxx : Put := do
  ...

About

No description, website, or topics provided.

Resources

Readme
MIT license

Contributing

Contributing
Activity
Custom properties

Stars

4 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.