fission-codes / ipfs-haskell

IPFS wrapper for Haskell
https://hackage.haskell.org/package/ipfs
Apache License 2.0
43 stars 5 forks source link

Remote class should use CIDs #5

Closed expede closed 4 years ago

expede commented 4 years ago

Problem

Right now, the remote class accepts arbitrary Text. Both for reasons of documentation, and ensuring that we're expressing our intent, this should be strengthened at the type level.

Solution

Use the existing CID type newtype CID = CID { unaddress :: Text }

  ipfsCat   :: Text            -> m (Either ClientError File.Serialized)
  ipfsPin   :: Text            -> m (Either ClientError Pin.Response)
  ipfsUnpin :: Text -> Bool    -> m (Either ClientError Pin.Response)

should read

  ipfsCat   :: CID            -> m (Either ClientError File.Serialized)
  ipfsPin   :: CID            -> m (Either ClientError Pin.Response)
  ipfsUnpin :: CID -> Bool    -> m (Either ClientError Pin.Response)
dholms commented 4 years ago

Fixed in https://github.com/fission-suite/ipfs-haskell/pull/6