{-# LANGUAGE TupleSections #-} module Language.Dickinson.Probability ( weight ) where import Data.List.NonEmpty (NonEmpty) weight :: NonEmpty a -> NonEmpty (Double, a) weight :: forall a. NonEmpty a -> NonEmpty (Double, a) weight NonEmpty a es = (Double recip', ) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b <$> NonEmpty a es where recip' :: Double recip' = Double 1 forall a. Fractional a => a -> a -> a / forall a b. (Integral a, Num b) => a -> b fromIntegral (forall (t :: * -> *) a. Foldable t => t a -> Int length NonEmpty a es)