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 DataKinds #-} | |
{-# LANGUAGE KindSignatures #-} | |
module Lib where | |
data Owner = Merchant | Customer | |
newtype MoneyAmount (a :: Owner) | |
= MoneyAmount Rational |
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
2020-07-20 09:36:38.995 [INF] DISC: Broadcasting 20 new announcements in 2 sub batches | |
2020-07-20 09:36:38.999 [INF] CRTR: Block 1628e0454b0330a4277f5d7e743dddcde09feb41d94764994352d2a5fcc76ea8 (height=10301) closed 0 channels | |
2020-07-20 09:36:39.005 [INF] NTFN: New block: height=10247, sha=7d095065eb246fae20fc8d814f7ea62d294fc9a17aaf105a578cc180a1969fe1 | |
2020-07-20 09:36:39.006 [INF] UTXN: Attempting to graduate height=10247: num_kids=0, num_babies=0 | |
2020-07-20 09:36:39.041 [INF] CRTR: Pruning channel graph using block 08318808781e2cc833ccf6898447622023b7ec04903ad141ee3fa53ac29916b6 (height=10302) | |
2020-07-20 09:36:39.048 [INF] CRTR: Block 08318808781e2cc833ccf6898447622023b7ec04903ad141ee3fa53ac29916b6 (height=10302) closed 0 channels | |
2020-07-20 09:36:39.065 [INF] NTFN: New block: height=10248, sha=2b8103231a7d7dfa9594f9b3ea0c167b88585d3256b51d8943b8bec8e74f66a1 | |
2020-07-20 09:36:39.067 [INF] UTXN: Attempting to graduate height=10248: num_kids=0, num_babies=0 | |
2020-07-20 09:36:39.107 [INF] NTFN: New block: heig |
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
2020-07-20 08:31:25.927 [INF] NTFN: New block: height=7627, sha=641a4c039868acfacab4dfe7340c46332a5d4add6a7f4fe06f41eb82d4999d1b | |
2020-07-20 08:31:25.928 [INF] UTXN: Attempting to graduate height=7627: num_kids=0, num_babies=0 | |
2020-07-20 08:31:26.004 [INF] CRTR: Pruning channel graph using block 7a76b3b60058179952242abeed4276f82a1bf879038aab39aed7c2a0ae5f74f0 (height=7666) | |
2020-07-20 08:31:26.015 [INF] CRTR: Block 7a76b3b60058179952242abeed4276f82a1bf879038aab39aed7c2a0ae5f74f0 (height=7666) closed 0 channels | |
2020-07-20 08:31:26.044 [INF] NTFN: New block: height=7628, sha=0a269f3ff891fbca7310258a1cd76e06e1de63be1037da868ee00070326e19d7 | |
2020-07-20 08:31:26.049 [INF] UTXN: Attempting to graduate height=7628: num_kids=0, num_babies=0 | |
2020-07-20 08:31:26.100 [INF] CRTR: Pruning channel graph using block 4bbbbaaa8eb8f85fb9b357d20b9223d1c135a21de89168e71128f742e3d9d661 (height=7667) | |
2020-07-20 08:31:26.106 [INF] CRTR: Block 4bbbbaaa8eb8f85fb9b357d20b9223d1c135a21de89168e71128f742e3d9d661 (height=7667) closed 0 chann |
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
safeFromIntegral :: | |
forall a b. | |
( Integral a, | |
Integral b, | |
Bounded b | |
) => | |
a -> | |
Maybe b | |
safeFromIntegral x = | |
if (intX >= intMin) && (intX <= intMax) |
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 MultiParamTypeClasses #-} | |
module Injective | |
( Injective (..), | |
Foo (..), | |
) | |
where | |
class Injective a b where | |
to :: a -> b |
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 MultiParamTypeClasses #-} | |
-- Am I reinventing the wheel? | |
-- Is there some standard Haskell type class which is already doing similar things? | |
module P88LND.Isomorphism | |
( Isomorphism (..), | |
Foo (..), | |
) | |
where |
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
-- pseudo-code, let's consider these types have corresponding lensens | |
-- from package proto-lens https://github.com/google/proto-lens | |
data Foo = Foo {foo :: Maybe Bar} | |
data Bar = Bar {bar :: Maybe Buz} | |
data Buz | |
= Buz | |
{ buz :: Bool, | |
buf :: 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
-- pseudo-code, let's consider these types have corresponding lensens | |
-- from package proto-lens https://github.com/google/proto-lens | |
data Foo = Foo{foo: Maybe Bar} | |
data Bar = Bar{bar: Maybe Buz} | |
data Buz = Buz{buz: Buf} | |
data Buf = Buf | |
-- I'm using bind here to handle Maybe | |
-- Is there better/shorter way to do it | |
-- with some lens-specific functions? |
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 InstanceSigs #-} | |
module Wai.Network.Middleware.WaiSemigroup (WaiApp(..)) where | |
import Data.Coerce (coerce) | |
import Network.HTTP.Types.Status (status404) | |
import Network.Wai (Application, responseStatus) | |
newtype WaiApp = WaiApp Application | |
instance Semigroup WaiApp where | |
(<>) :: WaiApp -> WaiApp -> WaiApp |