diff options
author | Ben Sima <ben@bsima.me> | 2021-01-27 22:24:37 -0500 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2021-01-27 22:24:37 -0500 |
commit | 1c07b112aa8c721beadc0494972c18462a5946bf (patch) | |
tree | 9e15cb6c118f8d6dda35b09c481360e0e266f3f2 /Biz/Id.hs | |
parent | 6c72ee7b29b5b69e93854fde67cbc7a53f998ed7 (diff) |
Set subscription in user page, operator precedence
I'm still working on figuring out operator precedence with my custom operators.
The normal precedences don't work well for writing code in a pipeline as I like,
so I have to re-define the operators with my own fixity settings. This will take
some fiddling to get right.
The user subscription allows setting to "Free" only now. It's fine because I
still need to do a design refresh on the pages I just made. One thing I noticed
is that it's getting harder to make changes without breaking stuff, so I either
need to make smaller incremental changes, or actually write some real tests.
I'll probably write tests soon.
Diffstat (limited to 'Biz/Id.hs')
-rw-r--r-- | Biz/Id.hs | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -14,6 +14,7 @@ import Alpha import Data.Aeson (FromJSON (..), ToJSON (..)) import Data.Binary (Binary) import Data.Data (Data) +import Servant (FromHttpApiData (..), ToHttpApiData (..)) newtype Id entity = Id Int deriving (Eq, Ord, Show, Generic, Typeable, Data) @@ -47,3 +48,9 @@ instance Semigroup (Id entity) where instance Monoid (Id entity) where mempty = mk (Proxy :: Proxy entity) 0 + +instance FromHttpApiData (Id entity) where + parseUrlPiece p = mk (Proxy :: Proxy entity) </ parseUrlPiece p + +instance ToHttpApiData (Id entity) where + toUrlPiece p = untag p |> tshow |