telescope-0.2.0: Astronomical Observations (FITS, ASDF, WCS, etc)
Safe HaskellNone
LanguageGHC2021

Telescope.Asdf

Synopsis

Documentation

class ToAsdf a where Source #

Convert a type to an Asdf Value or Node. The generic instance will encode to an Object with field names matching record selectors

data Example = Example
  { name :: Text
  , age :: Int
  , tags :: [Text]
  }
  deriving (Generic, ToAsdf)

instance ToAsdf Example where
  schema _ = "tag:example.org/schemas/example-1.0.0"

Minimal complete definition

Nothing

Methods

toValue :: a -> Value Source #

Specify how an object encodes to a Value

instance User ToAsdf where
  toValue user =
    Object
      [ ("name", toNode user.name)
      , ("age", toNode user.age)
      ]

default toValue :: (Generic a, GToObject (Rep a)) => a -> Value Source #

schema :: a -> SchemaTag Source #

Specify the schema for a type

instance ToAsdf Unit where
  schema _ = "!unit/unit-1.0.0"

default schema :: a -> SchemaTag Source #

anchor :: a -> Maybe Anchor Source #

Specify that this node be saved as an anchor

instance ToAsdf Config where
  anchor _ = Just "globalConfig"

default anchor :: a -> Maybe Anchor Source #

toNode :: a -> Node Source #

Manually control all aspects of how this is converted to a Node

default toNode :: a -> Node Source #

Instances

Instances details
ToAsdf ByteOrder Source # 
Instance details

Defined in Telescope.Asdf.Class

ToAsdf Int16 Source # 
Instance details

Defined in Telescope.Asdf.Class

ToAsdf Int32 Source # 
Instance details

Defined in Telescope.Asdf.Class

ToAsdf Int64 Source # 
Instance details

Defined in Telescope.Asdf.Class

ToAsdf Int8 Source # 
Instance details

Defined in Telescope.Asdf.Class

ToAsdf Asdf Source # 
Instance details

Defined in Telescope.Asdf.Core

ToAsdf ExtensionMetadata Source # 
Instance details

Defined in Telescope.Asdf.Core

ToAsdf History Source # 
Instance details

Defined in Telescope.Asdf.Core

ToAsdf Quantity Source # 
Instance details

Defined in Telescope.Asdf.Core

ToAsdf Software Source # 
Instance details

Defined in Telescope.Asdf.Core

ToAsdf Unit Source # 
Instance details

Defined in Telescope.Asdf.Core

ToAsdf BlockSource Source # 
Instance details

Defined in Telescope.Asdf.Class

ToAsdf Affine Source # 
Instance details

Defined in Telescope.Asdf.GWCS

ToAsdf AxisName Source # 
Instance details

Defined in Telescope.Asdf.GWCS

ToAsdf AxisType Source # 
Instance details

Defined in Telescope.Asdf.GWCS

ToAsdf CelestialFrame Source # 
Instance details

Defined in Telescope.Asdf.GWCS

ToAsdf CoordinateFrame Source # 
Instance details

Defined in Telescope.Asdf.GWCS

ToAsdf Direction Source # 
Instance details

Defined in Telescope.Asdf.GWCS

ToAsdf ICRSFrame Source # 
Instance details

Defined in Telescope.Asdf.GWCS

ToAsdf Identity Source # 
Instance details

Defined in Telescope.Asdf.GWCS

ToAsdf Lat Source # 
Instance details

Defined in Telescope.Asdf.GWCS

ToAsdf Lon Source # 
Instance details

Defined in Telescope.Asdf.GWCS

ToAsdf LonPole Source # 
Instance details

Defined in Telescope.Asdf.GWCS

ToAsdf Projection Source # 
Instance details

Defined in Telescope.Asdf.GWCS

ToAsdf Rotate3d Source # 
Instance details

Defined in Telescope.Asdf.GWCS

ToAsdf SpectralFrame Source # 
Instance details

Defined in Telescope.Asdf.GWCS

ToAsdf StokesFrame Source # 
Instance details

Defined in Telescope.Asdf.GWCS

ToAsdf Transformation Source # 
Instance details

Defined in Telescope.Asdf.GWCS

ToAsdf DataType Source # 
Instance details

Defined in Telescope.Asdf.Class

ToAsdf NDArrayData Source # 
Instance details

Defined in Telescope.Asdf.Class

ToAsdf Node Source # 
Instance details

Defined in Telescope.Asdf.Class

ToAsdf Tree Source # 
Instance details

Defined in Telescope.Asdf.Class

ToAsdf Value Source # 
Instance details

Defined in Telescope.Asdf.Class

ToAsdf Text Source # 
Instance details

Defined in Telescope.Asdf.Class

ToAsdf UTCTime Source # 
Instance details

Defined in Telescope.Asdf.Class

ToAsdf String Source # 
Instance details

Defined in Telescope.Asdf.Class

ToAsdf Integer Source # 
Instance details

Defined in Telescope.Asdf.Class

ToAsdf Bool Source # 
Instance details

Defined in Telescope.Asdf.Class

ToAsdf Double Source # 
Instance details

Defined in Telescope.Asdf.Class

ToAsdf Float Source # 
Instance details

Defined in Telescope.Asdf.Class

ToAsdf Int Source # 
Instance details

Defined in Telescope.Asdf.Class

ToAsdf a => ToAsdf (NonEmpty a) Source # 
Instance details

Defined in Telescope.Asdf.Class

ToAsdf as => ToAsdf (CompositeFrame as) Source # 
Instance details

Defined in Telescope.Asdf.GWCS

ToAsdf frame => ToAsdf (GWCSStep frame) Source # 
Instance details

Defined in Telescope.Asdf.GWCS

ToAsdf (Axes 'Row) Source # 
Instance details

Defined in Telescope.Asdf.Class

ToAsdf a => ToAsdf (Maybe a) Source # 
Instance details

Defined in Telescope.Asdf.Class

ToAsdf a => ToAsdf [a] Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

toValue :: [a] -> Value Source #

schema :: [a] -> SchemaTag Source #

anchor :: [a] -> Maybe Anchor Source #

toNode :: [a] -> Node Source #

(ToAsdf inp, ToAsdf out) => ToAsdf (GWCS inp out) Source # 
Instance details

Defined in Telescope.Asdf.GWCS

Methods

toValue :: GWCS inp out -> Value Source #

schema :: GWCS inp out -> SchemaTag Source #

anchor :: GWCS inp out -> Maybe Anchor Source #

toNode :: GWCS inp out -> Node Source #

ToAsdf (Linear a) Source # 
Instance details

Defined in Telescope.Asdf.GWCS

ToAsdf (Scale a) Source # 
Instance details

Defined in Telescope.Asdf.GWCS

ToAsdf (Shift a) Source # 
Instance details

Defined in Telescope.Asdf.GWCS

(ToAsdf a, ToAsdf b) => ToAsdf (a, b) Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

toValue :: (a, b) -> Value Source #

schema :: (a, b) -> SchemaTag Source #

anchor :: (a, b) -> Maybe Anchor Source #

toNode :: (a, b) -> Node Source #

(BinaryValue a, IsDataType a, Prim a, AxesIndex ix, PutArray ix) => ToAsdf (Array D ix a) Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

toValue :: Array D ix a -> Value Source #

schema :: Array D ix a -> SchemaTag Source #

anchor :: Array D ix a -> Maybe Anchor Source #

toNode :: Array D ix a -> Node Source #

(ToAsdf a, ToAsdf b, ToAsdf c) => ToAsdf (a, b, c) Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

toValue :: (a, b, c) -> Value Source #

schema :: (a, b, c) -> SchemaTag Source #

anchor :: (a, b, c) -> Maybe Anchor Source #

toNode :: (a, b, c) -> Node Source #

(ToAsdf a, ToAsdf b, ToAsdf c, ToAsdf d) => ToAsdf (a, b, c, d) Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

toValue :: (a, b, c, d) -> Value Source #

schema :: (a, b, c, d) -> SchemaTag Source #

anchor :: (a, b, c, d) -> Maybe Anchor Source #

toNode :: (a, b, c, d) -> Node Source #

class FromAsdf a where Source #

Parse an Asdf Value or Node into a type. The generic instance will decode an Object with field names matching record selectors

data Example = Example
  { name :: Text
  , age :: Int
  , tags :: [Text]
  }
  deriving (Generic, FromAsdf)

Minimal complete definition

Nothing

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es a Source #

Specify how a type is parsed from a Value

instance FromAsdf Integer where
  parseValue = \case
    Integer n -> pure $ fromIntegral n
    node -> expected "Integer" node

default parseValue :: forall (es :: [Effect]). (Generic a, GParseObject (Rep a), Parser :> es) => Value -> Eff es a Source #

Instances

Instances details
FromAsdf ByteOrder Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es ByteOrder Source #

FromAsdf Int16 Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es Int16 Source #

FromAsdf Int32 Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es Int32 Source #

FromAsdf Int64 Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es Int64 Source #

FromAsdf Int8 Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es Int8 Source #

FromAsdf Asdf Source # 
Instance details

Defined in Telescope.Asdf.Core

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es Asdf Source #

FromAsdf ExtensionMetadata Source # 
Instance details

Defined in Telescope.Asdf.Core

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es ExtensionMetadata Source #

FromAsdf History Source # 
Instance details

Defined in Telescope.Asdf.Core

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es History Source #

FromAsdf Quantity Source # 
Instance details

Defined in Telescope.Asdf.Core

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es Quantity Source #

FromAsdf Software Source # 
Instance details

Defined in Telescope.Asdf.Core

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es Software Source #

FromAsdf Unit Source # 
Instance details

Defined in Telescope.Asdf.Core

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es Unit Source #

FromAsdf DataType Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es DataType Source #

FromAsdf NDArrayData Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es NDArrayData Source #

FromAsdf Node Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es Node Source #

FromAsdf Tree Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es Tree Source #

FromAsdf Value Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es Value Source #

FromAsdf Text Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es Text Source #

FromAsdf UTCTime Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es UTCTime Source #

FromAsdf String Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es String Source #

FromAsdf Integer Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es Integer Source #

FromAsdf Bool Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es Bool Source #

FromAsdf Double Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es Double Source #

FromAsdf Float Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es Float Source #

FromAsdf Int Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es Int Source #

FromAsdf a => FromAsdf (NonEmpty a) Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es (NonEmpty a) Source #

FromAsdf a => FromAsdf (Maybe a) Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es (Maybe a) Source #

FromAsdf [Int16] Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es [Int16] Source #

FromAsdf [Int32] Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es [Int32] Source #

FromAsdf [Int64] Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es [Int64] Source #

FromAsdf [Int8] Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es [Int8] Source #

FromAsdf [Text] Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es [Text] Source #

FromAsdf [Double] Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es [Double] Source #

FromAsdf [Int] Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es [Int] Source #

FromAsdf a => FromAsdf [a] Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es [a] Source #

(FromAsdf a, FromAsdf b) => FromAsdf (a, b) Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es (a, b) Source #

(BinaryValue a, Prim a, AxesIndex ix) => FromAsdf (Array D ix a) Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es (Array D ix a) Source #

(FromAsdf a, FromAsdf b, FromAsdf c) => FromAsdf (a, b, c) Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es (a, b, c) Source #

(FromAsdf a, FromAsdf b, FromAsdf c, FromAsdf d) => FromAsdf (a, b, c, d) Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es (a, b, c, d) Source #

decode :: forall a (es :: [Effect]). (FromAsdf a, IOE :> es, Error AsdfError :> es) => ByteString -> Eff es a Source #

Decode a ByteString to a FromAsdf

encodeM :: (ToAsdf a, MonadIO m, MonadThrow m) => a -> m ByteString Source #

Encode a ToAsdf to a ByteString

encode :: forall a (es :: [Effect]). (ToAsdf a, IOE :> es, Error AsdfError :> es) => a -> Eff es ByteString Source #

Encode a ToAsdf to a ByteString

class FromNDArray a where Source #

Convert an NDArrayData into a type https:/asdf-standard.readthedocs.ioenlatestgeneratedstsci.eduasdfcorendarray-1.1.0.html

Methods

fromNDArray :: forall (es :: [Effect]). Parser :> es => NDArrayData -> Eff es a Source #

Instances

Instances details
FromNDArray [Text] Source # 
Instance details

Defined in Telescope.Asdf.NDArray

Methods

fromNDArray :: forall (es :: [Effect]). Parser :> es => NDArrayData -> Eff es [Text] Source #

BinaryValue a => FromNDArray [[a]] Source # 
Instance details

Defined in Telescope.Asdf.NDArray

Methods

fromNDArray :: forall (es :: [Effect]). Parser :> es => NDArrayData -> Eff es [[a]] Source #

BinaryValue a => FromNDArray [a] Source # 
Instance details

Defined in Telescope.Asdf.NDArray

Methods

fromNDArray :: forall (es :: [Effect]). Parser :> es => NDArrayData -> Eff es [a] Source #

(BinaryValue a, Prim a, AxesIndex ix) => FromNDArray (Array D ix a) Source # 
Instance details

Defined in Telescope.Asdf.NDArray

Methods

fromNDArray :: forall (es :: [Effect]). Parser :> es => NDArrayData -> Eff es (Array D ix a) Source #

class ToNDArray a where Source #

Convert a type to an NDArrayData https:/asdf-standard.readthedocs.ioenlatestgeneratedstsci.eduasdfcorendarray-1.1.0.html

Methods

toNDArray :: a -> NDArrayData Source #

Instances

Instances details
(BinaryValue a, IsDataType a) => ToNDArray [[a]] Source # 
Instance details

Defined in Telescope.Asdf.NDArray

Methods

toNDArray :: [[a]] -> NDArrayData Source #

(BinaryValue a, IsDataType a) => ToNDArray [a] Source # 
Instance details

Defined in Telescope.Asdf.NDArray

Methods

toNDArray :: [a] -> NDArrayData Source #

(BinaryValue a, IsDataType a, Prim a, AxesIndex ix, PutArray ix) => ToNDArray (Array D ix a) Source # 
Instance details

Defined in Telescope.Asdf.NDArray

Methods

toNDArray :: Array D ix a -> NDArrayData Source #

data SchemaTag Source #

Specify a schema using schema from ToAsdf

Instances

Instances details
IsString SchemaTag Source # 
Instance details

Defined in Telescope.Asdf.Node

Monoid SchemaTag Source # 
Instance details

Defined in Telescope.Asdf.Node

Semigroup SchemaTag Source # 
Instance details

Defined in Telescope.Asdf.Node

Show SchemaTag Source # 
Instance details

Defined in Telescope.Asdf.Node

Eq SchemaTag Source # 
Instance details

Defined in Telescope.Asdf.Node

data Node Source #

A Node is a Value with an optional SchemaTag and Anchor

Constructors

Node 

Instances

Instances details
IsString Node Source # 
Instance details

Defined in Telescope.Asdf.Node

Methods

fromString :: String -> Node #

Show Node Source # 
Instance details

Defined in Telescope.Asdf.Node

Methods

showsPrec :: Int -> Node -> ShowS #

show :: Node -> String #

showList :: [Node] -> ShowS #

Eq Node Source # 
Instance details

Defined in Telescope.Asdf.Node

Methods

(==) :: Node -> Node -> Bool #

(/=) :: Node -> Node -> Bool #

FromAsdf Node Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es Node Source #

ToAsdf Node Source # 
Instance details

Defined in Telescope.Asdf.Class

data Value Source #

All allowed node values. We can't use Aeson's Value, because it doesn't support tags, binary data, or references

Instances

Instances details
IsString Value Source # 
Instance details

Defined in Telescope.Asdf.Node

Methods

fromString :: String -> Value #

Monoid Value Source # 
Instance details

Defined in Telescope.Asdf.Node

Methods

mempty :: Value #

mappend :: Value -> Value -> Value #

mconcat :: [Value] -> Value #

Semigroup Value Source # 
Instance details

Defined in Telescope.Asdf.Node

Methods

(<>) :: Value -> Value -> Value #

sconcat :: NonEmpty Value -> Value #

stimes :: Integral b => b -> Value -> Value #

Show Value Source # 
Instance details

Defined in Telescope.Asdf.Node

Methods

showsPrec :: Int -> Value -> ShowS #

show :: Value -> String #

showList :: [Value] -> ShowS #

Eq Value Source # 
Instance details

Defined in Telescope.Asdf.Node

Methods

(==) :: Value -> Value -> Bool #

(/=) :: Value -> Value -> Bool #

FromAsdf Value Source # 
Instance details

Defined in Telescope.Asdf.Class

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es Value Source #

ToAsdf Value Source # 
Instance details

Defined in Telescope.Asdf.Class

type Key = Text Source #

type Object = [(Key, Node)] Source #

fromValue :: Value -> Node Source #

Makes a node from a value

data NDArrayData Source #

In-tree representation of an NDArray. You can parse a file as this and get it back. Not really what we want though but in haskell we can't easily just parse a multi-dimensional array we could do a simpler representation. Using an ADT

data JSONReference Source #

Constructors

JSONReference 

Fields

Instances

Instances details
Show JSONReference Source # 
Instance details

Defined in Telescope.Asdf.Node

Eq JSONReference Source # 
Instance details

Defined in Telescope.Asdf.Node

newtype JSONPointer Source #

Constructors

JSONPointer Path 

Instances

Instances details
Show JSONPointer Source # 
Instance details

Defined in Telescope.Asdf.Node

Eq JSONPointer Source # 
Instance details

Defined in Telescope.Asdf.Node

newtype Anchor Source #

Constructors

Anchor 

Fields

Instances

Instances details
IsString Anchor Source # 
Instance details

Defined in Telescope.Asdf.Node

Methods

fromString :: String -> Anchor #

Show Anchor Source # 
Instance details

Defined in Telescope.Asdf.Node

Eq Anchor Source # 
Instance details

Defined in Telescope.Asdf.Node

Methods

(==) :: Anchor -> Anchor -> Bool #

(/=) :: Anchor -> Anchor -> Bool #

data Parser (a :: Type -> Type) b Source #

Instances

Instances details
type DispatchOf Parser Source # 
Instance details

Defined in Telescope.Data.Parser

data Asdf Source #

Root ASDF node

Constructors

Asdf 

Instances

Instances details
FromAsdf Asdf Source # 
Instance details

Defined in Telescope.Asdf.Core

Methods

parseValue :: forall (es :: [Effect]). Parser :> es => Value -> Eff es Asdf Source #

ToAsdf Asdf Source # 
Instance details

Defined in Telescope.Asdf.Core