standardSpread :: Int -> SpreadEnv -> Azimuth -> (Spread, SpreadAtAzimuth)
standardSpread fuel env azimuth = unsafePerformIO $ do
  let f = fromIntegral fuel
      d g = fmap (g . realToFrac)
  withCatalog $ \catalog@(Catalog c) -> do
    initFuel catalog fuel env
    spread <- Spread
      <$> d (*~btuSqFtMin) [C.exp|double {
             Fuel_RxIntensity((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~footMin) [C.exp|double {
             Fuel_Spread0((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~btuSqFt) [C.exp|double {
             Fuel_HeatPerUnitArea((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~one) [C.exp|double {
             Fuel_PhiEffWind((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~footMin) [C.exp|double {
             Fuel_SpreadMax((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~degree) [C.exp|double {
             Fuel_AzimuthMax((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~one) [C.exp|double {
             Fuel_Eccentricity((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~btuFtSec) [C.exp|double {
             Fuel_ByramsIntensity((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~foot) [C.exp|double {
             Fuel_FlameLength((FuelCatalogPtr)$(void *c), $(size_t f))}|]
    setAzimuth catalog fuel azimuth
    spreadAz <- SpreadAtAzimuth
      <$> d (*~footMin) [C.exp|double {
             Fuel_SpreadAny((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~btuFtSec) [C.exp|double {
             Fuel_ByramsIntensity((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~foot) [C.exp|double {
             Fuel_FlameLength((FuelCatalogPtr)$(void *c), $(size_t f))}|]
    return (spread, spreadAz)
standardSpread :: Int -> SpreadEnv -> Azimuth -> (Spread, SpreadAtAzimuth)
standardSpread fuel env azimuth = unsafePerformIO $ do
  let f = fromIntegral fuel
      d g = fmap (g . realToFrac)
  withCatalog $ \catalog@(Catalog c) -> do
    initFuel catalog fuel env
    spread <- Spread
      <$> d (*~btuSqFtMin) [C.exp|double {
             Fuel_RxIntensity((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~footMin) [C.exp|double {
             Fuel_Spread0((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~btuSqFt) [C.exp|double {
             Fuel_HeatPerUnitArea((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~one) [C.exp|double {
             Fuel_PhiEffWind((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~footMin) [C.exp|double {
             Fuel_SpreadMax((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~degree) [C.exp|double {
             Fuel_AzimuthMax((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~one) [C.exp|double {
             Fuel_Eccentricity((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~btuFtSec) [C.exp|double {
             Fuel_ByramsIntensity((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~foot) [C.exp|double {
             Fuel_FlameLength((FuelCatalogPtr)$(void *c), $(size_t f))}|]
    setAzimuth catalog fuel azimuth
    spreadAz <- SpreadAtAzimuth
      <$> d (*~footMin) [C.exp|double {
             Fuel_SpreadAny((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~btuFtSec) [C.exp|double {
             Fuel_ByramsIntensity((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~foot) [C.exp|double {
             Fuel_FlameLength((FuelCatalogPtr)$(void *c), $(size_t f))}|]
    return (spread, spreadAz)
standardSpread fuel env azimuth = unsafePerformIO $ do
  let f = fromIntegral fuel
      d g = fmap (g . realToFrac)
  withCatalog $ \catalog@(Catalog c) -> do
    initFuel catalog fuel env
    spread <- Spread
      <$> d (*~btuSqFtMin) [C.exp|double {
             Fuel_RxIntensity((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~footMin) [C.exp|double {
             Fuel_Spread0((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~btuSqFt) [C.exp|double {
             Fuel_HeatPerUnitArea((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~one) [C.exp|double {
             Fuel_PhiEffWind((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~footMin) [C.exp|double {
             Fuel_SpreadMax((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~degree) [C.exp|double {
             Fuel_AzimuthMax((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~one) [C.exp|double {
             Fuel_Eccentricity((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~btuFtSec) [C.exp|double {
             Fuel_ByramsIntensity((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~foot) [C.exp|double {
             Fuel_FlameLength((FuelCatalogPtr)$(void *c), $(size_t f))}|]
    setAzimuth catalog fuel azimuth
    spreadAz <- SpreadAtAzimuth
      <$> d (*~footMin) [C.exp|double {
             Fuel_SpreadAny((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~btuFtSec) [C.exp|double {
             Fuel_ByramsIntensity((FuelCatalogPtr)$(void *c), $(size_t f))}|]
      <*> d (*~foot) [C.exp|double {
             Fuel_FlameLength((FuelCatalogPtr)$(void *c), $(size_t f))}|]
    return (spread, spreadAz)