使用 let 解析错误可能是不正确的缩进或不匹配的括号

问题描述

我明白

分析错误(可能不正确压痕或不匹配的括号中)

import SiteFeature from '../common/SiteFeature'; import AboutPage from '../components/pages/AboutPage'; import ActualsPage from '../components/pages/ActualsPage'; import EventsPage from '../components/pages/EventsPage'; const getSiteFeatures = (): SiteFeature[] => { const siteEmabledFeatures: SiteFeature[] = []; const inactive: SiteFeature[] = []; siteEmabledFeatures.push( new SiteFeature('null1',ActualsPage,{ name: 'actual',displayName: 'Aktuális',path: '/actuals',icon: 'new_releases',isEnabled: true,isNavOpion: true,}),new SiteFeature('null2',AboutPage,{ name: 'about',displayName: 'Bemutatkozás',path: '/about',icon: 'info',new SiteFeature('null3',EventsPage,{ name: 'events',displayName: 'Események',path: '/events',icon: 'events',return siteEmabledFeatures; }; export default getSiteFeatures;

| i > j = do swap axs p j

我真的很困惑这是什么原因,有人可以帮我澄清一下吗?

解决方法

这是一个缩进错误,你需要在 loop 的定义开始的右边至少放置一个保护符,所以:

apartition :: Ord a => STArray s Int a -> Int -> Int -> ST s Int
apartition axs p q = do 
  x <- readArray axs p
  let loop i j
       | i > j = do swap axs p j
                    return j
       | otherwise = do u <- readArray axs i
                        if u < x 
                        then do loop (i + 1) j 
                        else do swap axs i j
                                loop i (j - 1)
  loop (p + 1) q