stan-0.2.0.0: Haskell STatic ANalyser

Copyright | (c) 2020 Kowainik
License | MPL-2.0
Maintainer | Kowainik <xrom.xkov@gmail.com>
Safe Haskell | None
Language | Haskell2010

Stan.Core.Id

Description

Safe `Id` representation.

Synopsis

- newtype Id a = Id {
  - unId :: Text
  }
- type AnyId = Id ()
- castId :: forall to from to'. (to == to') ~ 'True => Id from -> Id to'

# Documentation

newtype Id a #

A wrapper around the textual value to safely represent IDs for different structures by using a phantom parameter.

Constructors

Id |
Fields unId :: Text

#### Instances

Instances details

Show (Id a) # |
Instance details Defined in Stan.Core.Id Methods showsPrec :: Int -> Id a -> ShowS # show :: Id a -> String # showList :: [Id a] -> ShowS #
Eq (Id a) # |
Instance details Defined in Stan.Core.Id Methods (==) :: Id a -> Id a -> Bool # (/=) :: Id a -> Id a -> Bool #
Ord (Id a) # |
Instance details Defined in Stan.Core.Id Methods compare :: Id a -> Id a -> Ordering # (<) :: Id a -> Id a -> Bool # (<=) :: Id a -> Id a -> Bool # (>) :: Id a -> Id a -> Bool # (>=) :: Id a -> Id a -> Bool # max :: Id a -> Id a -> Id a # min :: Id a -> Id a -> Id a #
Hashable (Id a) # |
Instance details Defined in Stan.Core.Id Methods hashWithSalt :: Int -> Id a -> Int # hash :: Id a -> Int #
ToJSON (Id a) # |
Instance details Defined in Stan.Core.Id Methods toJSON :: Id a -> Value #

type AnyId = Id () #

A type alias for the situations when we don't care about the parameter of `Id` but don't want to deal with type variables.

castId :: forall to from to'. (to == to') ~ 'True => Id from -> Id to' #

Unsafe cast of `Id`. Implementation uses smart trick to enforce usage always with `TypeApplications`.