From 9da4feb106126940264dd27925ea3c19b04aac20 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Wed, 30 Dec 2020 12:24:47 -0500 Subject: bild: build everyting Now bild knows how to determine between modules that require ghcjs and ghc. It also knows what *not* to build, meaning it won't try to build non-buildable nix targets, for example (unfortunately this is just hardcoded for now), but it also won't build scm or py targets that I haven't implemented yet. It just silently fails, which is fine, because it means I can do `bild **/*` and everything just works. Of course, if I want to build scm code then I will have to implement that, but that's not a priority right now. --- System/Random/Shuffle.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'System/Random/Shuffle.hs') diff --git a/System/Random/Shuffle.hs b/System/Random/Shuffle.hs index d26361f..435f083 100644 --- a/System/Random/Shuffle.hs +++ b/System/Random/Shuffle.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE NoImplicitPrelude #-} {-# OPTIONS_GHC -funbox-strict-fields #-} -- | @@ -24,6 +26,7 @@ module System.Random.Shuffle ) where +import Alpha import Control.Monad ( liftM2, ) @@ -70,7 +73,7 @@ shuffle elements = shuffleTree (buildTree elements) shuffleTree (Leaf e) [] = [e] shuffleTree tree (r : rs) = let (b, rest) = extractTree r tree in b : shuffleTree rest rs - shuffleTree _ _ = error "[shuffle] called with lists of different lengths" + shuffleTree _ _ = panic "[shuffle] called with lists of different lengths" -- Extracts the n-th element from the tree and returns -- that element, paired with a tree with the element -- deleted. @@ -86,7 +89,7 @@ shuffle elements = shuffleTree (buildTree elements) let (e, l') = extractTree n l in (e, Node (c - 1) l' r) | otherwise = let (e, r') = extractTree (n - cl) r in (e, Node (c - 1) l r') - extractTree _ _ = error "[extractTree] impossible" + extractTree _ _ = panic "[extractTree] impossible" -- | Given a sequence (e1,...en) to shuffle, its length, and a random -- generator, compute the corresponding permutation of the input -- cgit v1.2.3