Damus
YoshikuniJujo profile picture
YoshikuniJujo
@YoshikuniJujo

Haskell好き

Relays (11)
  • wss://relay.nostr.band/ – read & write
  • wss://nos.lol/ – read & write
  • wss://relay.damus.io/ – read & write
  • wss://relay-jp.nostr.wirednet.jp/ – read & write
  • wss://nostr-relay.nokotaro.com/ – read & write
  • wss://yabu.me/ – read & write
  • wss://r.kojira.io/ – read & write
  • wss://nrelay-jp.c-stellar.net/ – read & write
  • wss://relay.primal.net/ – read & write
  • wss://nostr.mom/ – read & write
  • wss://nostr-kyomu-haskell.onrender.com/ – read & write

Recent Notes

YoshikuniJujo profile picture
「基本的に自動運転のほうが人間による運転よりも安全であることが期待できるが、テスラに関してはその限りではない」って感じかな。
YoshikuniJujo profile picture
あまり進まないな。
とりあえず、フィルターを表すデータ型からJSONの表現に変換する部分を書いた。
次は逆の変換をする部分を書く。

それができたら、フィルターを表現するデータ型からSQLのwhere節(句?)を作る部分を書く。
1
YoshikuniJujo · 21h
https://github.com/YoshikuniJujo/test_haskell/blob/master/themes/sns/nostr/try-nostr-event-ng/src/Nostr/Filter.hs Nostrのフィルターを表す型
YoshikuniJujo profile picture
たとえば、モジュールFooのなかで、Barとの相互変換の関数を書くとしたら名前は

fromBar :: Bar -> Foo
toBar :: Foo -> Bar

みたいになる。
で、モジュールFoo.Barのなかでそれらの相互変換の関数を書くとしたら、もし明らかにBarのほうがより平坦であれば、

encode :: Foo -> Bar
decode :: Bar -> Maybe Foo

みたいにするかな。どっちも平坦さの度合いが変わらなかったら、

fToB :: Foo -> Bar
bToF :: Bar -> Foo

みたいな感じかな。
YoshikuniJujo profile picture
--(encode)->
構造を持つ値 平坦な値
<-(decode)--

--(pretty print)->
構造を持つ値 平坦な値
<-(parse)--

みたいな感じ。pretty printとかencodeは基本的な失敗がないのに対して、decodeとかparseにはerrorがあり得る。

ppr :: Value -> String
encode :: Value -> Binary

parse :: String -> Maybe Value
decode :: Binary -> Maybe Value