| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Mischief.Assets.AssetRef
Synopsis
- data AssetRef a where
- Ref :: forall a. (Asset a, Bundle a) => Text -> AssetRef a
- EntityRef :: forall a. (Asset a, Bundle a) => Entity -> AssetRef a
- SubRef :: forall b a. AssetRef b -> (b -> a) -> AssetRef a
- TransRef :: forall a b. AssetRef b -> (b -> AssetRef a) -> AssetRef a
- PureRef :: forall a. a -> AssetRef a
- AppRef :: forall a1 a. AssetRef (a1 -> a) -> AssetRef a1 -> AssetRef a
- NullRef :: forall a. AssetRef a
- getAsset :: AssetRef a -> IsRec -> Set TypeRep -> System (Maybe a)
- getAsset' :: forall a w m. MonadSystem w m => AssetRef a -> m (Maybe a)
- getRefEntity :: AssetRef a -> System (Maybe Entity)
- qasset :: AssetRef a -> Query System a
- qassetRec :: AssetRef a -> Query System a
- qasset' :: forall a (m :: Type -> Type) w. MonadSystem w m => AssetRef a -> Query m a
- class ToAssetRef (r :: Type -> Type) where
Documentation
data AssetRef a where Source #
Constructors
| Ref :: forall a. (Asset a, Bundle a) => Text -> AssetRef a | |
| EntityRef :: forall a. (Asset a, Bundle a) => Entity -> AssetRef a | |
| SubRef :: forall b a. AssetRef b -> (b -> a) -> AssetRef a | |
| TransRef :: forall a b. AssetRef b -> (b -> AssetRef a) -> AssetRef a | |
| PureRef :: forall a. a -> AssetRef a | |
| AppRef :: forall a1 a. AssetRef (a1 -> a) -> AssetRef a1 -> AssetRef a | |
| NullRef :: forall a. AssetRef a |
Instances
| Applicative AssetRef Source # | |
| Functor AssetRef Source # | |
| Monad AssetRef Source # | |
| Asset a => IsString (AssetRef a) Source # | |
Defined in Mischief.Assets.Internal.Asset Methods fromString :: String -> AssetRef a # | |
| Show (AssetRef a) Source # | |
| (Asset a, Bundle a) => KdlAsset (AssetRef a) Source # | |
Defined in Mischief.Assets.Internal.Kdl Methods decodeKdl :: RelativePath -> NodeDecoder (AssetRef a) Source # | |
getAsset :: AssetRef a -> IsRec -> Set TypeRep -> System (Maybe a) Source #
Try to get an AssetRef's value. Will trigger it to load it it's currently unloaded.
getAsset' :: forall a w m. MonadSystem w m => AssetRef a -> m (Maybe a) Source #
Try to get an asset by its AssetRef. Won't trigger any IO.
getRefEntity :: AssetRef a -> System (Maybe Entity) Source #
Gets an AssetRef's entity. If it is unloaded, it will create an entity and return it.
qasset :: AssetRef a -> Query System a Source #
Gets the value of an asset. If it isn't loaded, it will attempt to start loading it.