HORIZON HASKELLDocslts/ghc-10.0.x8c2f8e82026-10-19Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8c2f8e8 · 2026-10-19

Modulehnix-0.17.0Haskell2010

Nix.Utils

This is a module of custom Prelude code. It is for import for projects other then HNix. For HNix - this module gets reexported by Prelude, so for HNix please fix-up pass-through there.

  • 7 types
  • 1 class
  • 37 values
  • Packagehnix-0.17.0
  • Exports45
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceUtils.hs
valuedup :: a -> (a, a)
#

Duplicates object into a tuple.

valueboth :: (a -> b) -> (a, a) -> (b, b)
#

Apply a single function to both components of a pair.

both succ (1,2) == (2,3)

Taken From package extra

valuemapPair :: (a -> c, b -> d) -> (a, b) -> (c, d)
#

Gives tuple laziness.

Takem from utility-ht.

valueiterateN
  1. :: Int

    Recursively apply Int times

  2. -> (a -> a)

    the function

  3. -> a

    starting from argument

  4. -> a
#
valuenestM
  1. :: Monad m
  2. => Int

    Recursively apply Int times

  3. -> (a -> m a)

    function (Kleisli arrow).

  4. -> a

    to value

  5. -> m a

    & join layers of m

#
valuefree :: (a -> b) -> (f (Free f a) -> b) -> Free f a -> b
#

Lambda analog of maybe or either for Free monad.

newtypenewtype Path
#

Explicit type boundary between FilePath & String.

Constructors

Instances22Eq, Data, Ord, Read, Show, IsString, …
valueisAbsolute :: Path -> Bool
#

This set of Path funcs is to control system filepath types & typesafety and to easily migrate from FilePath to anything suitable (like path or so).

Paths isAbsolute.

typetype Alg (f :: Type -> Type) a = f a -> a
#

F-algebra defines how to reduce the fixed-point of a functor to a value. > type Alg f a = f a -> a

typetype Transform (f :: Type -> Type) a = TransformF (Fix f) a
#

Do according transformation.

It is a transformation of a recursion scheme. See TransformF.

typetype TransformF f a = (f -> a) -> f -> a
#

Do according transformation.

It is a transformation between functors.

valueadi :: Functor f => Transform f a -> Alg f a -> Fix f -> a
#

adi is Abstracting Definitional Interpreters:

https://arxiv.org/abs/1707.04755

All ADI does is interleaves every layer of evaluation by inserting intermitten layers between them, in that way the evaluation can be extended/embelished in any way wanted. Look at its use to see great examples.

Essentially, it does for evaluation what recursion schemes do for representation: allows threading layers through existing structure, only in this case through behavior.

classclass Has a b where
#

Methods

Instances7Has, …
  • Has a aDefined in hnix-0.17.0 · Nix.Utils
  • Has (Context m t) SrcSpanDefined in hnix-0.17.0 · Nix.Context
  • Has (Context m t) FramesDefined in hnix-0.17.0 · Nix.Context
  • Has (Context m t) OptionsDefined in hnix-0.17.0 · Nix.Context
  • Has (a, b) aDefined in hnix-0.17.0 · Nix.Utils
  • Has (a, b) bDefined in hnix-0.17.0 · Nix.Utils
  • Has (Context m t) (Scopes m t)Defined in hnix-0.17.0 · Nix.Context
valueover :: Setter s t a b -> (a -> b) -> s -> t
#

Demote a setter to a semantic editor combinator.

over :: Prism s t a b -> Reviwer s t a b
over :: Grid s t a b -> Grate s t a b
over :: Adapter s t a b -> Grate s t a b

Covert an AdapterLike optic into a GrateLike optic.

valueview :: FoldLike a s t a b -> s -> a
#
view :: Getter s t a b -> s -> a

Demote a lens or getter to a projection function.

view :: Monoid a => Fold s t a b -> s -> a

Returns the monoidal summary of a traversal or a fold.