All Projects → iokasimov → apart

iokasimov / apart

Licence: BSD-3-Clause License
Get all your structure and rip it apart.

Programming Languages

haskell
3896 projects

Projects that are alternatives of or similar to apart

lessram
Pure PHP implementation of array data structures that use less memory.
Stars: ✭ 20 (-23.08%)
Mutual labels:  structures
semicon
A collection of icons for the Semantic Web and Linked Open Data world.
Stars: ✭ 20 (-23.08%)
Mutual labels:  structures
vue-vuex-persist
vuex持久化插件
Stars: ✭ 16 (-38.46%)
Mutual labels:  persistence
sched
⏳ a high performance reliable task scheduling package in Go.
Stars: ✭ 46 (+76.92%)
Mutual labels:  persistence
sharpy
Simulation of High Aspect Ratio aeroplanes and wind turbines in Python: a nonlinear aeroelastic code
Stars: ✭ 81 (+211.54%)
Mutual labels:  structures
android-room-example
Android Kotlin app showcasing the Room persistence library
Stars: ✭ 45 (+73.08%)
Mutual labels:  persistence
SMBRat
A Windows Remote Administration Tool in Visual Basic with UNC paths
Stars: ✭ 23 (-11.54%)
Mutual labels:  persistence
microstream
High-Performance Java-Native-Persistence. Store and load any Java Object Graph or Subgraphs partially, Relieved of Heavy-weight JPA. Microsecond Response Time. Ultra-High Throughput. Minimum of Latencies. Create Ultra-Fast In-Memory Database Applications & Microservices.
Stars: ✭ 283 (+988.46%)
Mutual labels:  persistence
PlacenoteSDK-Unity
Placenote SDK and sample app for Unity
Stars: ✭ 78 (+200%)
Mutual labels:  persistence
vue-auto-storage
🍻 An automatic storage plugin for Vue2, persist the data with localStorage.
Stars: ✭ 84 (+223.08%)
Mutual labels:  persistence
js-coalaip
Javascript implementation for COALA IP
Stars: ✭ 18 (-30.77%)
Mutual labels:  persistence
sts
sts: struct to struct transformers generator.
Stars: ✭ 18 (-30.77%)
Mutual labels:  structures
Rebus.SqlServer
🚌 Microsoft SQL Server transport and persistence for Rebus
Stars: ✭ 35 (+34.62%)
Mutual labels:  persistence
SilentETHMiner
A Silent (Hidden) Ethereum (ETH & ETC) Miner Builder
Stars: ✭ 219 (+742.31%)
Mutual labels:  persistence
monopati
Well-typed paths
Stars: ✭ 20 (-23.08%)
Mutual labels:  cofree
Sqlable
Swift library for making storing data in a SQLite database simple and magic-free
Stars: ✭ 83 (+219.23%)
Mutual labels:  persistence
linper
Linux Persistence Toolkit
Stars: ✭ 20 (-23.08%)
Mutual labels:  persistence
bee-apm
BeeAPM is a distributed tracing system and APM ( Application Performance Monitoring )
Stars: ✭ 137 (+426.92%)
Mutual labels:  persistence
acolyte
🐯 Mockup/testing JDBC & MongoDB driver (or Chmeee's son on the Ringworld).
Stars: ✭ 58 (+123.08%)
Mutual labels:  persistence
Persistence
Plugin para almacenar datos de forma persistente en Godot Engine 3
Stars: ✭ 20 (-23.08%)
Mutual labels:  persistence

Get all your structure and rip it apart 🔪

The main idea: if you can describe your data structure via Cofree, you got:

  • Comonadic methods, you always can extract a focus value or extend with some function
  • With apart you can serialize, persistent or hash a segment of your structure!

Example usage

Let's define a simple non-empty list type:

type Stack a = Cofree Maybe a

Then, build a value of this type, stack of integers, the whole structure in memory (ignore lazy evaluation aspects now):

inmemory :: Stack Int
inmemory = 1 :< Just (2 :< Just (3 :< Just (4 :< Just (5 :< Nothing))))

Set a limit for structure

Sometimes, we don’t need to hold a whole structure in memory, can it be good just cut a part of it and save to file?

save_to_file :: FilePath -> Segment Stack Int -> IO FilePath
save_to_file fp structure = writeFile fp (show structure) *> pure fp

scattered = IO (Scattered Stack Int FilePath)
scattered = limit 2 (save_to_file "part.txt") inmemory

And our structure transformed into:

scattered :: Scattered Stack Int FilePath
scattered = Apart $ 1 :< Ready (Just $ 2 :< Ready (Just $ 3 :< Converted "part.txt"))

Traverse over scattered structure

We also can fluently traverse over scattered structure with action and function for recover a segment:

fluently :: IO (Stack ())
fluently = fluent print read_from_file scattered

Recover scattered structure

Return back to memory our stack of integers:

read_from_file :: FilePath -> IO (Segment Stack Int)
read_from_file fp = read @(Segment Stack Int) <$> readFile fp

inmemory :: IO (Stack Int)
inmemory = recover read_from_file scattered
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].